plugin XEP-0045: send error on invalid room jid on _join

This commit is contained in:
Goffi 2011-10-08 19:04:28 +02:00
commit c4f168940c

View file

@ -154,9 +154,19 @@ class XEP_0045():
return self.clients[profile].join(room_jid, nick, history_options, password).addCallbacks(self.__room_joined, self.__err_joining_room, callbackKeywords={'profile':profile}, errbackKeywords={'profile':profile})
def _join(self, room_jid, nick, options={}, profile_key='@DEFAULT@'):
def _join(self, room_jid_s, nick, options={}, profile_key='@DEFAULT@'):
"""join method used by bridge: use the _join method, but doesn't return any deferred"""
d = self.join(jid.JID(room_jid), nick, options, profile_key)
profile = self.host.memory.getProfileName(profile_key)
if not self.__check_profile(profile):
return
try:
room_jid = jid.JID(room_jid_s)
except:
mess = _("Invalid room jid: %s") % room_jid_s
warning(mess)
self.host.bridge.newAlert(mess, _("Group chat error"), "ERROR", profile)
return
d = self.join(jid.JID(room_jid), nick, options, profile)
d.addErrback(lambda x: warning(_('Error while joining room'))) #TODO: error management + signal in bridge
def getHandler(self, profile):