# HG changeset patch # User Goffi # Date 1467200774 -7200 # Node ID de4fac507dc4b2a1a46d3b359be5a883e30f34f4 # Parent 8c4087fd034ae7d773929e0780fd9e567715625f xep-0045: ignore non standard presence received between own presence and room subject diff -r 8c4087fd034a -r de4fac507dc4 src/plugins/plugin_xep_0045.py --- a/src/plugins/plugin_xep_0045.py Wed Jun 29 13:42:35 2016 +0200 +++ b/src/plugins/plugin_xep_0045.py Wed Jun 29 13:46:14 2016 +0200 @@ -754,7 +754,12 @@ 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 @@ 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,