From a0fb3b451ff3452af6864c0f9a39c1aee1a372a5 Mon Sep 17 00:00:00 2001 From: Goffi Date: Wed, 29 Jun 2016 13:46:14 +0200 Subject: [PATCH] xep-0045: ignore non standard presence received between own presence and room subject --- src/plugins/plugin_xep_0045.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/plugins/plugin_xep_0045.py b/src/plugins/plugin_xep_0045.py index 9062e34c..ef10760c 100755 --- a/src/plugins/plugin_xep_0045.py +++ b/src/plugins/plugin_xep_0045.py @@ -754,7 +754,12 @@ class SatMUCClient(muc.MUCClient): log.debug(u"room {room} joined with nick {nick}".format(room=room.occupantJID.userhost(), nick=user.nick)) # We set type so we don't have use a deferred with disco to check entity type self.host.memory.updateEntityData(room.roomJID, C.ENTITY_TYPE, ENTITY_TYPE_MUC, profile_key=self.parent.profile) - + elif not room._room_ok: + log.warning(u"Received user presence data in a room before its initialisation (and after our own presence)," + "this is not standard! Ignoring it: {} ({})".format( + room.roomJID.userhost(), + user.nick)) + return elif room._roster_ok: try: self._changing_nicks.remove(user.nick) @@ -795,6 +800,12 @@ class SatMUCClient(muc.MUCClient): room = room_jid_s, profile = self.parent.profile)) self.host.memory.delEntityCache(room.roomJID, profile_key=self.parent.profile) self.host.bridge.mucRoomLeft(room.roomJID.userhost(), self.parent.profile) + elif not room._room_ok: + log.warning(u"Received user presence data in a room before its initialisation (and after our own presence)," + "this is not standard! Ignoring it: {} ({})".format( + room.roomJID.userhost(), + user.nick)) + return else: log.debug(_(u"user {nick} left room {room_id}").format(nick=user.nick, room_id=room.occupantJID.userhost())) extra = {'info_type': ROOM_USER_LEFT,