comparison src/plugins/plugin_xep_0045.py @ 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 bdc6a5b07922
children fbd313cfd40b
comparison
equal deleted inserted replaced
1983:8c4087fd034a 1984:de4fac507dc4
752 # we have received our own nick, this mean that the full room roster was received 752 # we have received our own nick, this mean that the full room roster was received
753 room._roster_ok = True 753 room._roster_ok = True
754 log.debug(u"room {room} joined with nick {nick}".format(room=room.occupantJID.userhost(), nick=user.nick)) 754 log.debug(u"room {room} joined with nick {nick}".format(room=room.occupantJID.userhost(), nick=user.nick))
755 # We set type so we don't have use a deferred with disco to check entity type 755 # We set type so we don't have use a deferred with disco to check entity type
756 self.host.memory.updateEntityData(room.roomJID, C.ENTITY_TYPE, ENTITY_TYPE_MUC, profile_key=self.parent.profile) 756 self.host.memory.updateEntityData(room.roomJID, C.ENTITY_TYPE, ENTITY_TYPE_MUC, profile_key=self.parent.profile)
757 757 elif not room._room_ok:
758 log.warning(u"Received user presence data in a room before its initialisation (and after our own presence),"
759 "this is not standard! Ignoring it: {} ({})".format(
760 room.roomJID.userhost(),
761 user.nick))
762 return
758 elif room._roster_ok: 763 elif room._roster_ok:
759 try: 764 try:
760 self._changing_nicks.remove(user.nick) 765 self._changing_nicks.remove(user.nick)
761 except KeyError: 766 except KeyError:
762 # this is a new user 767 # this is a new user
793 room_jid_s = room.roomJID.userhost() 798 room_jid_s = room.roomJID.userhost()
794 log.info(_(u"Room ({room}) left ({profile})").format( 799 log.info(_(u"Room ({room}) left ({profile})").format(
795 room = room_jid_s, profile = self.parent.profile)) 800 room = room_jid_s, profile = self.parent.profile))
796 self.host.memory.delEntityCache(room.roomJID, profile_key=self.parent.profile) 801 self.host.memory.delEntityCache(room.roomJID, profile_key=self.parent.profile)
797 self.host.bridge.mucRoomLeft(room.roomJID.userhost(), self.parent.profile) 802 self.host.bridge.mucRoomLeft(room.roomJID.userhost(), self.parent.profile)
803 elif not room._room_ok:
804 log.warning(u"Received user presence data in a room before its initialisation (and after our own presence),"
805 "this is not standard! Ignoring it: {} ({})".format(
806 room.roomJID.userhost(),
807 user.nick))
808 return
798 else: 809 else:
799 log.debug(_(u"user {nick} left room {room_id}").format(nick=user.nick, room_id=room.occupantJID.userhost())) 810 log.debug(_(u"user {nick} left room {room_id}").format(nick=user.nick, room_id=room.occupantJID.userhost()))
800 extra = {'info_type': ROOM_USER_LEFT, 811 extra = {'info_type': ROOM_USER_LEFT,
801 'user_affiliation': user.affiliation, 812 'user_affiliation': user.affiliation,
802 'user_role': user.role, 813 'user_role': user.role,