From ff49d8752060eb99ce0a3b023e491c63c9c58133 Mon Sep 17 00:00:00 2001 From: Goffi Date: Tue, 30 Mar 2010 16:08:44 +1100 Subject: [PATCH] wix: MUC groupchat management + short nick shown in chat window instead of full jid when possible --- frontends/wix/chat.py | 8 ++++++-- plugins/plugin_xep_0045.py | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/frontends/wix/chat.py b/frontends/wix/chat.py index 539e3217..d201c2a5 100644 --- a/frontends/wix/chat.py +++ b/frontends/wix/chat.py @@ -153,7 +153,10 @@ class Chat(wx.Frame, QuickChat): def onEnterPressed(self, event): """Behaviour when enter pressed in send line.""" - self.host.bridge.sendMessage(self.target, event.GetString(), profile_key=self.host.profile) + self.host.bridge.sendMessage(self.target.short if self.type=='group' else self.target, + event.GetString(), + type = "groupchat" if self.type=='group' else "chat", + profile_key=self.host.profile) self.textBox.Clear() @@ -161,10 +164,11 @@ 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) + 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 _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] " % jid) + self.chatWindow.AppendText("[%s] " % nick) _font = wx.Font(self.font["points"], self.font["family"], wx.ITALIC if mymess else wx.NORMAL, wx.NORMAL) self.chatWindow.SetDefaultStyle(wx.TextAttr("BLACK", font=_font)) self.chatWindow.AppendText("%s\n" % msg) diff --git a/plugins/plugin_xep_0045.py b/plugins/plugin_xep_0045.py index 128af3f2..41474210 100755 --- a/plugins/plugin_xep_0045.py +++ b/plugins/plugin_xep_0045.py @@ -139,6 +139,10 @@ class SatMUCClient (muc.MUCClient): user_data={'entity':user.entity or '', 'affiliation':user.affiliation, 'role':user.role} self.host.bridge.roomUserLeft(room.roomIdentifier, room.service, user.nick, user_data, self.parent.profile) + def userUpdatedStatus(self, room, user, show, status): + print("FIXME: MUC status not managed yet") + #FIXME: gof + def receivedSubject(self, room, subject): debug (_("New subject for room (%(room_id)s): %(subject)s") % {'room_id':room.occupantJID.userhost(),'subject':subject}) self.host.bridge.roomNewSubject(room.roomIdentifier, room.service, subject, self.parent.profile)