Mercurial > libervia-web
changeset 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 | cbb3662818c8 |
children | a80c13249f5d |
files | src/browser/sat_browser/dialog.py src/browser/sat_browser/menu.py src/server/server.py |
diffstat | 3 files changed, 11 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/browser/sat_browser/dialog.py Sat Mar 07 13:28:11 2015 +0100 +++ b/src/browser/sat_browser/dialog.py Sat Mar 07 15:08:56 2015 +0100 @@ -86,13 +86,13 @@ def room(self): """Get the room that has been selected or entered by the user - @return: jid.JID or None + @return: jid.JID or None to let the backend generate a new name """ if self.exist_radio.getChecked(): values = self.rooms_list.getSelectedValues() return jid.JID(values[0]) if values else None value = self.box.getText() - return None if value == self.GENERATE_MUC else jid.JID(value) + return None if value in ('', self.GENERATE_MUC) else jid.JID(value) def onFocus(self, sender): if sender == self.rooms_list: @@ -138,9 +138,9 @@ elif nb_contact is not None: nb_contact = (nb_contact, nb_contact) if nb_contact is None: - log.warning("Need to select as many contacts as you want") + log.debug("Need to select as many contacts as you want") else: - log.warning("Need to select between %d and %d contacts" % nb_contact) + log.debug("Need to select between %d and %d contacts" % nb_contact) self.nb_contact = nb_contact self.ok_button = ok_button VerticalPanel.__init__(self, Width='100%')
--- 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):
--- a/src/server/server.py Sat Mar 07 13:28:11 2015 +0100 +++ b/src/server/server.py Sat Mar 07 15:08:56 2015 +0100 @@ -383,12 +383,6 @@ @room_jid: leave empty string to generate a unique name """ profile = ISATSession(self.session).profile - try: - if room_jid != "": - room_jid = JID(room_jid).userhost() - except: - log.warning('Invalid room jid') - return d = self.asyncBridgeCall("joinMUC", room_jid, nick, {}, profile) return d