plugins XEP-0045, XEP-0198: rejoin MUC rooms while a hot reconnection is done:
when resuming is not possible with stream management, a hot reconnection is done (reconnecting without restarting every plugin). This was causing trouble for joined MUC rooms, which were not accessible anymore (because they were not re-joined). This patch fixes it by clearing rooms first (to avoid considering the room joined and broadcasting the initial presence to them), then re-joining them. fix 322
This commit is contained in:
parent
cb85f61fe4
commit
9e2a35f6e5
1 changed files with 31 additions and 8 deletions
|
|
@ -496,6 +496,19 @@ class XEP_0045(object):
|
|||
errbackArgs=(client, room_jid, nick, password))
|
||||
return d
|
||||
|
||||
def popRooms(self, client):
|
||||
"""Remove rooms and return data needed to re-join them
|
||||
|
||||
This methods is to be called before a hot reconnection
|
||||
@return (list[(jid.JID, unicode)]): arguments needed to re-join the rooms
|
||||
This list can be used directly (unpacked) with self.join
|
||||
"""
|
||||
args_list = []
|
||||
for room in client._muc_client.joined_rooms.values():
|
||||
client._muc_client._removeRoom(room.roomJID)
|
||||
args_list.append((client, room.roomJID, room.nick))
|
||||
return args_list
|
||||
|
||||
def _nick(self, room_jid_s, nick, profile_key=C.PROF_KEY_NONE):
|
||||
client = self.host.getClient(profile_key)
|
||||
return self.nick(client, jid.JID(room_jid_s), nick)
|
||||
|
|
@ -785,7 +798,8 @@ class XEP_0045(object):
|
|||
whois_msg.append(_("Show: %s") % user.show)
|
||||
|
||||
def presenceTrigger(self, presence_elt, client):
|
||||
# XXX: shouldn't it be done by the server ?!!
|
||||
# FIXME: should we add a privacy parameters in settings to activate before
|
||||
# broadcasting the presence to all MUC rooms ?
|
||||
muc_client = client._muc_client
|
||||
for room_jid, room in muc_client.joined_rooms.iteritems():
|
||||
elt = xml_tools.elementCopy(presence_elt)
|
||||
|
|
|
|||
Loading…
Reference in a new issue