diff --git a/frontends/quick_frontend/quick_app.py b/frontends/quick_frontend/quick_app.py index 207d746d..24a9e69c 100644 --- a/frontends/quick_frontend/quick_app.py +++ b/frontends/quick_frontend/quick_app.py @@ -213,6 +213,7 @@ class QuickApp(): return debug (_("Room [%(room_name)s] joined by %(profile)s, users presents:%(users)s") % {'room_name':room_id+'@'+room_service, 'profile': profile, 'users':room_nicks}) room_jid=room_id+'@'+room_service + self.chat_wins[room_jid].setUserNick(user_nick) self.chat_wins[room_jid].setType("group") self.chat_wins[room_jid].setPresents([user_nick]+room_nicks) diff --git a/frontends/quick_frontend/quick_chat.py b/frontends/quick_frontend/quick_chat.py index b7e24f17..88763d5e 100644 --- a/frontends/quick_frontend/quick_chat.py +++ b/frontends/quick_frontend/quick_chat.py @@ -30,6 +30,7 @@ class QuickChat(): self.target = target self.host = host self.type = type + self.nick = None def setType(self, type): """Set the type of the chat @@ -37,6 +38,10 @@ class QuickChat(): """ self.type = type + def setUserNick(self, nick): + """Set the nick of the user, usefull for e.g. change the color of the user""" + self.nick = nick + def historyPrint(self, size=20, keep_last=False, profile='@NONE@'): """Print the initial history""" debug (_("now we print history")) diff --git a/frontends/wix/chat.py b/frontends/wix/chat.py index 9cd0c5d5..9cb0a722 100644 --- a/frontends/wix/chat.py +++ b/frontends/wix/chat.py @@ -52,7 +52,6 @@ class Chat(wx.Frame, QuickChat): self.conv_panel.SetSizer(self.conv_panel.sizer) self.splitter.Initialize(self.conv_panel) self.SetMenuBar(wx.MenuBar()) - self.setType(self.type) #events self.Bind(wx.EVT_CLOSE, self.onClose, self) @@ -63,8 +62,8 @@ class Chat(wx.Frame, QuickChat): self.font["points"] = self.chatWindow.GetFont().GetPointSize() self.font["family"] = self.chatWindow.GetFont().GetFamily() - self.historyPrint(profile=self.host.profile) - + self.setType(self.type) + #misc self.textBox.SetFocus() self.Hide() #We hide because of the show toggle @@ -86,17 +85,19 @@ class Chat(wx.Frame, QuickChat): self.__createPresents() self.subjectBox.Show() self.__eraseMenus() - + self.historyPrint(profile=self.host.profile) elif type is 'one2one' and self.splitter.IsSplit(): self.splitter.Unsplit(self.present_panel) del self.present_panel self.GetMenuBar().Show() self.subjectBox.Hide() self.__createMenus_O2O() + self.nick = None else: self.subjectBox.Hide() self.__createMenus_O2O() - + self.historyPrint(profile=self.host.profile) + def setPresents(self, nicks): """Set the users presents in the contact list for a group chat @param nicks: list of nicknames @@ -176,8 +177,9 @@ class Chat(wx.Frame, QuickChat): def printMessage(self, from_jid, msg, profile, timestamp=""): """Print the message with differents colors depending on where it comes from.""" jid=JID(from_jid) + print "printMessage, jid=",jid,"type=",self.type nick = jid.resource if self.type == "group" else (self.host.CM.getAttr(jid,'nick') or self.host.CM.getAttr(jid,'name') or jid) - mymess = (jid.short == self.host.profiles[profile]['whoami'].short) #mymess = True if message comes from local user + mymess = (jid.resource == self.nick) if self.type == "group" else (jid.short == self.host.profiles[profile]['whoami'].short) #mymess = True if message comes from local user _font = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.BOLD) self.chatWindow.SetDefaultStyle(wx.TextAttr( "BLACK" if mymess else "BLUE", font=_font)) self.chatWindow.AppendText("[%s] " % nick) diff --git a/sat.tac b/sat.tac index 8c8aef25..c0b06a34 100644 --- a/sat.tac +++ b/sat.tac @@ -593,7 +593,8 @@ class SAT(service.Service): message.addElement("body", "jabber:client", msg) self.profiles[profile].xmlstream.send(message) self.memory.addToHistory(current_jid, current_jid, jid.JID(to), message["type"], unicode(msg)) - self.bridge.newMessage(message['from'], unicode(msg), to=message['to'], type=type, profile=profile) #We send back the message, so all clients are aware of it + if type!="groupchat": + self.bridge.newMessage(message['from'], unicode(msg), to=message['to'], type=type, profile=profile) #We send back the message, so all clients are aware of it def setPresence(self, to="", show="", priority = 0, statuses={}, profile_key='@DEFAULT@'): diff --git a/tools/memory.py b/tools/memory.py index 3436b70f..65498299 100644 --- a/tools/memory.py +++ b/tools/memory.py @@ -489,7 +489,7 @@ class Memory: if not self.history[me_short].has_key(key): self.history[me_short][key]={} - self.history[me_short][key][int(time.time())] = (from_short, message) + self.history[me_short][key][int(time.time())] = (from_jid.full(), message) def getHistory(self, from_jid, to_jid, size): ret={}