changeset 1984:de4fac507dc4

xep-0045: ignore non standard presence received between own presence and room subject
author Goffi <goffi@goffi.org>
date Wed, 29 Jun 2016 13:46:14 +0200
parents 8c4087fd034a
children 9ad1a06ed0f8
files src/plugins/plugin_xep_0045.py
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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,