plugin XEP-0045: remove redondant errback from _join

This commit is contained in:
souliane 2013-11-28 21:27:18 +01:00
commit 89c2519ae7

View file

@ -105,7 +105,7 @@ class XEP_0045(object):
# 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 @@ class XEP_0045(object):
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 @@ class XEP_0045(object):
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 @@ class SatMUCClient (muc.MUCClient):
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 []