Mercurial > libervia-backend
changeset 406:b03b38b20c18
plugin XEP-0045: send error on invalid room jid on _join
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 08 Oct 2011 19:04:28 +0200 |
parents | 10b4f577d0c0 |
children | b4edea06ae12 |
files | src/plugins/plugin_xep_0045.py |
diffstat | 1 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0045.py Sat Oct 08 18:43:17 2011 +0200 +++ b/src/plugins/plugin_xep_0045.py Sat Oct 08 19:04:28 2011 +0200 @@ -154,9 +154,19 @@ 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):