# HG changeset patch # User Goffi # Date 1325719323 -3600 # Node ID f9d63624699f021ca5f8c7171f298a4dc1c1678f # Parent 6d1f4a3da29beea00a5ea3e07cfd9aac0b24771b radio collective integration, first draft diff -r 6d1f4a3da29b -r f9d63624699f browser_side/dialog.py --- a/browser_side/dialog.py Mon Dec 12 22:26:55 2011 +0100 +++ b/browser_side/dialog.py Thu Jan 05 00:22:03 2012 +0100 @@ -59,7 +59,8 @@ content.add(self.contacts_list) button_panel = HorizontalPanel() self.choose_button = Button("Choose", self.onChoose) - self.choose_button.setEnabled(False) + if (nb_contact): + self.choose_button.setEnabled(False) button_panel.add(self.choose_button) button_panel.add(Button("Cancel", self.onCancel)) content.add(button_panel) diff -r 6d1f4a3da29b -r f9d63624699f browser_side/menu.py --- a/browser_side/menu.py Mon Dec 12 22:26:55 2011 +0100 +++ b/browser_side/menu.py Thu Jan 05 00:22:03 2012 +0100 @@ -82,6 +82,7 @@ menu_group = MenuBar(vertical=True) menu_group.addItem("join room", MenuCmd(self, "onJoinRoom")) + menu_group.addItem("Collective radio", MenuCmd(self, "onCollectiveRadio")) menu_games = MenuBar(vertical=True) menu_games.addItem("Tarot", MenuCmd(self, "onTarotGame")) @@ -229,7 +230,12 @@ _dialog.setHTML('Group discussions') _dialog.setWidget(_main_panel) _dialog.show() - + + def onCollectiveRadio(self): + def onContactsSelected(contacts): + print("let's go :)") + self.host.bridge.call('launchRadioCollective', None, contacts) + dialog.ContactsChooser(self.host, onContactsSelected, None, text="Please select contacts to invite").getContacts() #Game menu diff -r 6d1f4a3da29b -r f9d63624699f libervia.py --- a/libervia.py Mon Dec 12 22:26:55 2011 +0100 +++ b/libervia.py Thu Jan 05 00:22:03 2012 +0100 @@ -78,7 +78,7 @@ LiberviaJsonProxy.__init__(self, "/json_api", ["getContacts", "addContact", "sendMessage", "sendMblog", "getMblogNodes", "getProfileJid", "getHistory", "getPresenceStatus", "joinMUC", "getRoomsJoined", "launchTarotGame", "getTarotCardsPaths", "tarotGameReady", "tarotGameContratChoosed", - "tarotGamePlayCards", "getWaitingSub", "subscription", "delContact", "updateContact", "getCardCache"]) + "tarotGamePlayCards", "launchRadioCollective", "getWaitingSub", "subscription", "delContact", "updateContact", "getCardCache"]) class BridgeSignals(LiberviaJsonProxy): def __init__(self, host): @@ -320,26 +320,26 @@ if (not self.whoami or self.whoami.bare != _entity.bare): self.contact_panel.setConnected(_entity.bare, _entity.resource, show, priority, statuses) - def _roomJoinedCb(self, room_id, room_service, room_nicks, user_nick): - _target = JID("%s@%s" % (room_id,room_service)) + def _roomJoinedCb(self, room_jid, room_nicks, user_nick): + _target = JID(room_jid) self.room_list.add(_target) chat_panel = panels.ChatPanel(self, _target, type='group') chat_panel.setUserNick(user_nick) - if room_id.startswith('sat_tarot_'): #XXX: it's not really beautiful, but it works :) + if room_jid.node.startswith('sat_tarot_'): #XXX: it's not really beautiful, but it works :) self.addTab(chat_panel, "Tarot") else: self.addTab(chat_panel, _target.node) chat_panel.setPresents(room_nicks) chat_panel.historyPrint() - def _roomUserJoinedCb(self, room_id, room_service, user_nick, user_data): + def _roomUserJoinedCb(self, room_jid, user_nick, user_data): for lib_wid in self.libervia_widgets: - if isinstance(lib_wid,panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == "%s@%s" % (room_id, room_service): + if isinstance(lib_wid,panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == room_jid.bare: lib_wid.userJoined(user_nick, user_data) - def _roomUserLeftCb(self, room_id, room_service, user_nick, user_data): + def _roomUserLeftCb(self, room_jid, user_nick, user_data): for lib_wid in self.libervia_widgets: - if isinstance(lib_wid,panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == "%s@%s" % (room_id, room_service): + if isinstance(lib_wid,panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == room_jid.bare: lib_wid.userLeft(user_nick, user_data) def _tarotGameStartedCb(self, room_jid, referee, players): diff -r 6d1f4a3da29b -r f9d63624699f libervia.tac --- a/libervia.tac Mon Dec 12 22:26:55 2011 +0100 +++ b/libervia.tac Thu Jan 05 00:22:03 2012 +0100 @@ -240,7 +240,7 @@ except: warning('Invalid room jid') return - self.sat_host.bridge.joinMUC(room_jid.host, room_jid.user, nick, profile) + self.sat_host.bridge.joinMUC(room_jid.userhost(), nick, {}, profile) def jsonrpc_getRoomsJoined(self): """Return list of room already joined by user""" @@ -273,6 +273,11 @@ profile = ISATSession(self.session).profile self.sat_host.bridge.tarotGamePlayCards(player_nick, referee, cards, profile) + def jsonrpc_launchRadioCollective(self, invited): + """Create a room, invite people, and start a radio collective""" + profile = ISATSession(self.session).profile + self.sat_host.bridge.radiocolLaunch(invited, profile) + def jsonrpc_getCardCache(self, jid): """Get the avatar of a contact @param jid: jid of contact from who we want the avatar