changeset 77:1ae680f9682e

wix: MUC groupchat management + short nick shown in chat window instead of full jid when possible
author Goffi <goffi@goffi.org>
date Tue, 30 Mar 2010 16:08:44 +1100
parents 8becde8a967c
children ace2af8abc5a
files frontends/wix/chat.py plugins/plugin_xep_0045.py
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/wix/chat.py	Tue Mar 30 13:15:05 2010 +1100
+++ b/frontends/wix/chat.py	Tue Mar 30 16:08:44 2010 +1100
@@ -153,7 +153,10 @@
 
     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 @@
     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)
--- a/plugins/plugin_xep_0045.py	Tue Mar 30 13:15:05 2010 +1100
+++ b/plugins/plugin_xep_0045.py	Tue Mar 30 16:08:44 2010 +1100
@@ -139,6 +139,10 @@
         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)