changeset 743:5a131930348d

plugin XEP-0045: remove redondant errback from _join
author souliane <souliane@mailoo.org>
date Thu, 28 Nov 2013 21:27:18 +0100
parents 03744d9ebc13
children 312a2842b2b8
files src/plugins/plugin_xep_0045.py
diffstat 1 files changed, 7 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0045.py	Wed Dec 11 17:16:53 2013 +0100
+++ b/src/plugins/plugin_xep_0045.py	Thu Nov 28 21:27:18 2013 +0100
@@ -105,7 +105,7 @@
             # we have a nickname conflict, we try again with "_" suffixed to current nickname
             nick += '_'
             return self.clients[profile].join(room_jid, nick, history_options, password).addCallbacks(self.__room_joined, self.__err_joining_room, callbackKeywords={'profile': profile}, errbackArgs=[room_jid, nick, history_options, password, profile])
-        mess = _("Error when joining the room %s" % room_jid.userhost())
+        mess = _("Error while joining the room %s" % room_jid.userhost())
         error(mess)
         self.host.bridge.newAlert(mess, _("Group chat error"), "ERROR", profile)
         raise failure
@@ -235,9 +235,13 @@
         password = options["password"] if "password" in options else None
 
         return self.clients[profile].join(room_jid, nick, history_options, password).addCallbacks(self.__room_joined, self.__err_joining_room, callbackKeywords={'profile': profile}, errbackArgs=[room_jid, nick, history_options, password, profile])
+        # FIXME: how to set the cancel method on the Deferred created by wokkel?
+        # This happens when the room is not reachable, e.g. no internet connection:
+        # > /usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py(480)_startRunCallbacks()
+        # -> raise AlreadyCalledError(extra)
 
     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
+        """join method used by bridge: use the join method, but doesn't return any deferred
         @return the room userhost (given value or unique generated name)
         """
         profile = self.host.memory.getProfileName(profile_key)
@@ -253,7 +257,7 @@
             self.host.bridge.newAlert(mess, _("Group chat error"), "ERROR", profile)
             return
         d = self.join(room_jid, nick, options, profile)
-        d.addErrback(lambda x: warning(_('Error while joining room')))  # TODO: error management + signal in bridge
+        # TODO: error management + signal in bridge
         return room_jid_s
 
     def nick(self, room_jid, nick, profile_key):
@@ -372,12 +376,3 @@
         debug(_("New subject for room (%(room_id)s): %(subject)s") % {'room_id': room.roomJID.full(), 'subject': subject})
         self.rec_subjects[room.roomJID.userhost()] = (room.roomJID.userhost(), subject)
         self.host.bridge.roomNewSubject(room.roomJID.userhost(), subject, self.parent.profile)
-
-    #def connectionInitialized(self):
-        #pass
-
-    #def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
-        #return [disco.DiscoFeature(NS_VCARD)]
-
-    #def getDiscoItems(self, requestor, target, nodeIdentifier=''):
-        #return []