comparison 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
comparison
equal deleted inserted replaced
668:cbb3662818c8 669:a8fddccf5b84
130 130
131 def join(room_jid, contacts): 131 def join(room_jid, contacts):
132 if self.host.whoami: 132 if self.host.whoami:
133 nick = self.host.whoami.node 133 nick = self.host.whoami.node
134 contact_list = self.host.contact_list 134 contact_list = self.host.contact_list
135 if room_jid not in contact_list.getSpecials(C.CONTACT_SPECIAL_GROUP): 135 if room_jid is None or room_jid not in contact_list.getSpecials(C.CONTACT_SPECIAL_GROUP):
136 self.host.bridge.call('joinMUC', lambda room_jid: invite(room_jid, contacts), unicode(room_jid), nick) 136 room_jid_s = unicode(room_jid) if room_jid else ''
137 self.host.bridge.call('joinMUC', lambda room_jid: invite(room_jid, contacts), room_jid_s, nick)
137 else: 138 else:
138 self.host.displayWidget(chat.Chat, room_jid, type_="group", new_tab=room_jid) 139 self.host.displayWidget(chat.Chat, room_jid, type_="group", new_tab=room_jid)
139 invite(room_jid, contacts) 140 invite(room_jid, contacts)
140 141
141 dialog.RoomAndContactsChooser(self.host, join, ok_button="Join", visible=(True, False)) 142 dialog.RoomAndContactsChooser(self.host, join, ok_button="Join", visible=(True, False))
142 143
143 def onCollectiveRadio(self): 144 def onCollectiveRadio(self):
144 def callback(room_jid, contacts): 145 def callback(room_jid, contacts):
145 contacts = [unicode(contact) for contact in contacts] 146 contacts = [unicode(contact) for contact in contacts]
146 self.host.bridge.call('launchRadioCollective', None, contacts, unicode(room_jid)) 147 room_jid_s = unicode(room_jid) if room_jid else ''
148 self.host.bridge.call('launchRadioCollective', None, contacts, room_jid_s)
147 dialog.RoomAndContactsChooser(self.host, callback, ok_button="Choose", title="Collective Radio", visible=(False, True)) 149 dialog.RoomAndContactsChooser(self.host, callback, ok_button="Choose", title="Collective Radio", visible=(False, True))
148 150
149 #Game menu 151 #Game menu
150 def onTarotGame(self): 152 def onTarotGame(self):
151 def onPlayersSelected(room_jid, other_players): 153 def onPlayersSelected(room_jid, other_players):
152 other_players = [unicode(contact) for contact in other_players] 154 other_players = [unicode(contact) for contact in other_players]
153 self.host.bridge.call('launchTarotGame', None, other_players, unicode(room_jid)) 155 room_jid_s = unicode(room_jid) if room_jid else ''
156 self.host.bridge.call('launchTarotGame', None, other_players, room_jid_s)
154 dialog.RoomAndContactsChooser(self.host, onPlayersSelected, 3, title="Tarot", title_invite="Please select 3 other players", visible=(False, True)) 157 dialog.RoomAndContactsChooser(self.host, onPlayersSelected, 3, title="Tarot", title_invite="Please select 3 other players", visible=(False, True))
155 158
156 def onXiangqiGame(self): 159 def onXiangqiGame(self):
157 Window.alert("A Xiangqi game is planed, but not available yet") 160 Window.alert("A Xiangqi game is planed, but not available yet")
158 161