Commit ce6ee76b571641aeb2ce25a08f857b5eb9c2c24f

Authored by dg
1 parent 5fc5769b

switch


git-svn-id: http://svn.net-core.org/repos/t-engine4@2881 51575b47-30f0-44d4-a5cc-537603b46e54
... ... @@ -272,6 +272,7 @@ function _M:instanciate(mod, name, new_game, no_reboot)
272 272 -- Add user chat if needed
273 273 if mod.allow_userchat and _G.game.key then
274 274 profile.chat:setupOnGame()
  275 + profile.chat:join("global")
275 276 profile.chat:join(mod.short_name)
276 277 end
277 278
... ...
... ... @@ -54,9 +54,9 @@ function _M:setupOnGame()
54 54 }
55 55 end
56 56
57   -function _M:addMessage(channel, user, msg)
  57 +function _M:addMessage(channel, login, name, msg)
58 58 local log = self.channels[channel].log
59   - table.insert(log, 1, {user=user, msg=msg})
  59 + table.insert(log, 1, {login=login, name=name, msg=msg})
60 60 while #log > self.max do table.remove(log) end
61 61 self.changed = true
62 62 end
... ... @@ -66,18 +66,18 @@ function _M:event(e)
66 66 e.msg = e.msg:removeColorCodes()
67 67
68 68 self.channels[e.channel] = self.channels[e.channel] or {users={}, log={}}
69   - self:addMessage(e.channel, e.user, e.msg)
  69 + self:addMessage(e.channel, e.login, e.name, e.msg)
70 70
71   - if type(game) == "table" and game.log then game.log("#YELLOW#<%s> %s", e.user, e.msg) end
  71 + if type(game) == "table" and game.log then game.log("#YELLOW#<%s> %s", e.name, e.msg) end
72 72 elseif e.se == "Join" then
73 73 self.channels[e.channel] = self.channels[e.channel] or {users={}, log={}}
74   - self.channels[e.channel].users[e.user] = {name=e.user}
  74 + self.channels[e.channel].users[e.login] = {name=e.name, login=e.login}
75 75 self.channels_changed = true
76 76 self:addMessage(e.channel, e.user, "#{italic}##FIREBRICK#has joined the channel#{normal}#")
77 77 if type(game) == "table" and game.log and e.channel == self.cur_channel then game.log("#{italic}##FIREBRICK#%s has joined channel %s (press space to talk).#{normal}#", e.user, e.channel) end
78 78 elseif e.se == "Part" then
79 79 self.channels[e.channel] = self.channels[e.channel] or {users={}, log={}}
80   - self.channels[e.channel].users[e.user] = nil
  80 + self.channels[e.channel].users[e.login] = nil
81 81 self.channels_changed = true
82 82 self:addMessage(e.channel, e.user, "#{italic}##FIREBRICK#has left the channel#{normal}#")
83 83 if type(game) == "table" and game.log and e.channel == self.cur_channel then game.log("#{italic}##FIREBRICK#%s has left channel %s.#{normal}#", e.user, e.channel) end
... ... @@ -89,7 +89,8 @@ function _M:event(e)
89 89 if not info then return end
90 90 self.channels[e.channel].users = {}
91 91 for _, user in ipairs(info.users) do
92   - self.channels[e.channel].users[user.name] = {
  92 + self.channels[e.channel].users[user.login] = {
  93 + login=user.login,
93 94 name=user.name,
94 95 cur_char=user.cur_char and user.cur_char.title or "unknown",
95 96 module=user.cur_char and user.cur_char.module or "unknown",
... ... @@ -211,8 +212,8 @@ function _M:resize(x, y, w, h, fontname, fontsize, color, bgcolor)
211 212 local item = self.dlist[i]
212 213 if item.dh and y >= item.dh - self.mouse.delegate_offset_y then citem = item break end
213 214 end
214   - if citem and citem.user and self.channels[self.cur_channel].users[citem.user] then
215   - self.on_mouse(self.channels[self.cur_channel].users[citem.user], button, event)
  215 + if citem and citem.login and self.channels[self.cur_channel].users[citem.login] then
  216 + self.on_mouse(self.channels[self.cur_channel].users[citem.login], button, event)
216 217 end
217 218 end
218 219 end)
... ... @@ -265,10 +266,10 @@ function _M:display()
265 266 local old_style = self.font:getStyle()
266 267 for z = 1 + self.scroll, #log do
267 268 local stop = false
268   - local tstr = ("<%s> %s"):format(log[z].user, log[z].msg):toTString()
  269 + local tstr = ("<%s> %s"):format(log[z].name, log[z].msg):toTString()
269 270 local gen = tstring.makeLineTextures(tstr, self.w, self.font_mono)
270 271 for i = #gen, 1, -1 do
271   - gen[i].user = log[z].user
  272 + gen[i].login = log[z].login
272 273 self.dlist[#self.dlist+1] = gen[i]
273 274 h = h + self.fh
274 275 if h > self.h - self.fh - ls_h then stop=true break end
... ...
... ... @@ -325,7 +325,7 @@ function _M:checkFirstTime()
325 325 end
326 326
327 327 function _M:createProfile(loginItem)
328   - if loginItem.justlogin then
  328 + if not loginItem.create then
329 329 self.auth_tried = nil
330 330 profile:performlogin(loginItem.login, loginItem.pass)
331 331 profile:waitFirstAuth()
... ...
... ... @@ -104,7 +104,7 @@ function _M:okclick()
104 104 end
105 105
106 106 game:unregisterDialog(self)
107   - game:createProfile({justlogin=self.c_email and false or true, login=self.c_login.text, pass=self.c_pass.text, email=self.c_email and self.c_email.text})
  107 + game:createProfile({create=self.c_email and true or false, login=self.c_login.text, pass=self.c_pass.text, email=self.c_email and self.c_email.text})
108 108 end
109 109
110 110 function _M:cancelclick()
... ...
... ... @@ -865,7 +865,8 @@ function _M:setupCommands()
865 865 end end,
866 866 [{"_g","ctrl"}] = function() if config.settings.cheat then
867 867 -- self.nicer_tiles:postProcessLevelTiles(self.level)
868   - game:registerDialog(require("mod.dialogs.Donation").new())
  868 +-- game:registerDialog(require("mod.dialogs.Donation").new())
  869 + error("plop")
869 870 end end,
870 871 }
871 872
... ...
... ... @@ -29,7 +29,7 @@ end
29 29
30 30 function _M:connected()
31 31 if self.sock then return true end
32   - self.sock = socket.connect("te4.org", 2259)
  32 + self.sock = socket.connect("te4.org", 2257)
33 33 if not self.sock then return false end
34 34 -- self.sock:settimeout(10)
35 35 print("[PROFILE] Thread connected to te4.org")
... ... @@ -40,7 +40,7 @@ end
40 40 --- Connects the second tcp channel to receive data
41 41 function _M:connectedPull()
42 42 if self.psock then return true end
43   - self.psock = socket.connect("te4.org", 2260)
  43 + self.psock = socket.connect("te4.org", 2258)
44 44 if not self.psock then return false end
45 45 -- self.psock:settimeout(10)
46 46 print("[PROFILE] Pull socket connected to te4.org")
... ...
... ... @@ -29,17 +29,17 @@ end
29 29
30 30 function _M:event(e)
31 31 if e.e == "ChatTalk" then
32   - cprofile.pushEvent(string.format("e='Chat' se='Talk' channel=%q user=%q msg=%q", e.channel, e.user, e.msg))
  32 + cprofile.pushEvent(string.format("e='Chat' se='Talk' channel=%q login=%q name=%q msg=%q", e.channel, e.login, e.name, e.msg))
33 33 print("[USERCHAT] channel talk", e.user, e.channel, e.msg)
34 34 elseif e.e == "ChatJoin" then
35 35 self.channels[e.channel] = self.channels[e.channel] or {}
36 36 self.channels[e.channel][e.user] = true
37   - cprofile.pushEvent(string.format("e='Chat' se='Join' channel=%q user=%q", e.channel, e.user))
  37 + cprofile.pushEvent(string.format("e='Chat' se='Join' channel=%q login=%q name=%q ", e.channel, e.login, e.name))
38 38 print("[USERCHAT] channel join", e.user, e.channel)
39 39 elseif e.e == "ChatPart" then
40 40 self.channels[e.channel] = self.channels[e.channel] or {}
41 41 self.channels[e.channel][e.user] = nil
42   - cprofile.pushEvent(string.format("e='Chat' se='Part' channel=%q user=%q", e.channel, e.user))
  42 + cprofile.pushEvent(string.format("e='Chat' se='Part' channel=%q login=%q name=%q ", e.channel, e.login, e.name))
43 43 print("[USERCHAT] channel part", e.user, e.channel)
44 44 end
45 45 end
... ...