From c4f168940ce26f59475d78860baf4eee3ac47475 Mon Sep 17 00:00:00 2001 From: Goffi Date: Sat, 8 Oct 2011 19:04:28 +0200 Subject: [PATCH] plugin XEP-0045: send error on invalid room jid on _join --- src/plugins/plugin_xep_0045.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/plugins/plugin_xep_0045.py b/src/plugins/plugin_xep_0045.py index 9970a9cd..c67c9926 100755 --- a/src/plugins/plugin_xep_0045.py +++ b/src/plugins/plugin_xep_0045.py @@ -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):