Mercurial > libervia-web
diff src/browser/sat_browser/menu.py @ 627:30180021f203 frontends_multi_profiles
browser_side: fixes MUC menus
author | souliane <souliane@mailoo.org> |
---|---|
date | Sun, 22 Feb 2015 21:56:40 +0100 |
parents | 1c0d5a87c554 |
children | 6d3142b782c3 |
line wrap: on
line diff
--- 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):