diff src/browser/sat_browser/menu.py @ 669:a8fddccf5b84 frontends_multi_profiles

server and browser sides: fixes joining room with auto-generated name + leave JID error handling to the backend
author souliane <souliane@mailoo.org>
date Sat, 07 Mar 2015 15:08:56 +0100
parents 6a8a1103ad10
children 849ffb24d5bf
line wrap: on
line diff
--- a/src/browser/sat_browser/menu.py	Sat Mar 07 13:28:11 2015 +0100
+++ b/src/browser/sat_browser/menu.py	Sat Mar 07 15:08:56 2015 +0100
@@ -132,8 +132,9 @@
             if self.host.whoami:
                 nick = self.host.whoami.node
                 contact_list = self.host.contact_list
-                if room_jid not in contact_list.getSpecials(C.CONTACT_SPECIAL_GROUP):
-                    self.host.bridge.call('joinMUC', lambda room_jid: invite(room_jid, contacts), unicode(room_jid), nick)
+                if room_jid is None or room_jid not in contact_list.getSpecials(C.CONTACT_SPECIAL_GROUP):
+                    room_jid_s = unicode(room_jid) if room_jid else ''
+                    self.host.bridge.call('joinMUC', lambda room_jid: invite(room_jid, contacts), room_jid_s, nick)
                 else:
                     self.host.displayWidget(chat.Chat, room_jid, type_="group", new_tab=room_jid)
                     invite(room_jid, contacts)
@@ -143,14 +144,16 @@
     def onCollectiveRadio(self):
         def callback(room_jid, contacts):
             contacts = [unicode(contact) for contact in contacts]
-            self.host.bridge.call('launchRadioCollective', None, contacts, unicode(room_jid))
+            room_jid_s = unicode(room_jid) if room_jid else ''
+            self.host.bridge.call('launchRadioCollective', None, contacts, room_jid_s)
         dialog.RoomAndContactsChooser(self.host, callback, ok_button="Choose", title="Collective Radio", visible=(False, True))
 
     #Game menu
     def onTarotGame(self):
         def onPlayersSelected(room_jid, other_players):
             other_players = [unicode(contact) for contact in other_players]
-            self.host.bridge.call('launchTarotGame', None, other_players, unicode(room_jid))
+            room_jid_s = unicode(room_jid) if room_jid else ''
+            self.host.bridge.call('launchTarotGame', None, other_players, room_jid_s)
         dialog.RoomAndContactsChooser(self.host, onPlayersSelected, 3, title="Tarot", title_invite="Please select 3 other players", visible=(False, True))
 
     def onXiangqiGame(self):