changeset 80:9681f18d06bd

wix: basic dialog to join MUC room, jid node is now displayed in conversations instead of full jid
author Goffi <goffi@goffi.org>
date Thu, 01 Apr 2010 18:57:57 +1100
parents db0a0f000e37
children 104a815bb23f
files frontends/wix/chat.py frontends/wix/main_window.py
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/wix/chat.py	Wed Mar 31 19:56:43 2010 +1100
+++ b/frontends/wix/chat.py	Thu Apr 01 18:57:57 2010 +1100
@@ -178,7 +178,7 @@
         """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)
+        nick = jid.resource if self.type == "group" else (self.host.CM.getAttr(jid,'nick') or self.host.CM.getAttr(jid,'name') or jid.node)
         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))
--- a/frontends/wix/main_window.py	Wed Mar 31 19:56:43 2010 +1100
+++ b/frontends/wix/main_window.py	Thu Apr 01 18:57:57 2010 +1100
@@ -400,7 +400,17 @@
         
     def onJoinRoom(self, e):
         warning('FIXME: temporary menu, must be improved')
-        self.bridge.joinMUC("conference.necton2.int", "test", "Goffi \o/", self.profile)
+        #TODO: a proper MUC room joining dialog with nickname etc
+        dlg = wx.TextEntryDialog(
+                self, _("Please enter MUC's JID"),
+                _('Entering a MUC room'), _('test@conference.necton2.int'))
+                #_('Entering a MUC room'), _('room@muc_service.server.tld'))
+        if dlg.ShowModal() == wx.ID_OK:
+            room_jid=JID(dlg.GetValue())
+            if room_jid.is_valid():
+                self.bridge.joinMUC(room_jid.domain, room_jid.node, self.profiles[self.profile]['whoami'].node, self.profile)
+            else:
+                error (_("'%s' is an invalid JID !"), room_jid)
 
     def onFindGateways(self, e):
         debug(_("Find Gateways request"))