# HG changeset patch # User souliane # Date 1424638600 -3600 # Node ID 30180021f203c5e014573b4cb403985d653c9789 # Parent ba2555c29c84504de8b837b1dd197457f603a36e browser_side: fixes MUC menus diff -r ba2555c29c84 -r 30180021f203 src/browser/sat_browser/menu.py --- a/src/browser/sat_browser/menu.py Sun Feb 22 21:56:18 2015 +0100 +++ b/src/browser/sat_browser/menu.py Sun Feb 22 21:56:40 2015 +0100 @@ -23,8 +23,6 @@ from sat.core.i18n import _ -from sat_frontends.tools import jid - from pyjamas.ui.SimplePanel import SimplePanel from pyjamas.ui.HTML import HTML from pyjamas.ui.Frame import Frame @@ -41,6 +39,9 @@ from base_menu import MenuCmd +unicode = str # FIXME: pyjamas workaround + + class MainMenuBar(base_menu.GenericMenuBar): """The main menu bar which is displayed on top of the document""" @@ -149,28 +150,31 @@ def invite(room_jid, contacts): for contact in contacts: - self.host.bridge.call('inviteMUC', None, contact, room_jid) + self.host.bridge.call('inviteMUC', None, unicode(contact), unicode(room_jid)) def join(room_jid, contacts): if self.host.whoami: nick = self.host.whoami.node - if room_jid not in [room.bare for room in self.host.room_list]: - self.host.bridge.call('joinMUC', lambda room_jid: invite(room_jid, contacts), room_jid, nick) + 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) else: - self.host.displayWidget(chat.Chat, room_jid, type_="group", new_tab=jid.JID(room_jid).bare) + self.host.displayWidget(chat.Chat, room_jid, type_="group", new_tab=room_jid) invite(room_jid, contacts) dialog.RoomAndContactsChooser(self.host, join, ok_button="Join", visible=(True, False)) def onCollectiveRadio(self): def callback(room_jid, contacts): - self.host.bridge.call('launchRadioCollective', None, contacts, room_jid) + contacts = [unicode(contact) for contact in contacts] + self.host.bridge.call('launchRadioCollective', None, contacts, unicode(room_jid)) 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): - self.host.bridge.call('launchTarotGame', None, other_players, room_jid) + other_players = [unicode(contact) for contact in other_players] + self.host.bridge.call('launchTarotGame', None, other_players, unicode(room_jid)) dialog.RoomAndContactsChooser(self.host, onPlayersSelected, 3, title="Tarot", title_invite="Please select 3 other players", visible=(False, True)) def onXiangqiGame(self):