comparison src/plugins/plugin_xep_0045.py @ 1250:1f0ae61536aa

plugin XEP-0045: set the entity data "type" asap (userJoinedRoom is triggered before the join callback)
author souliane <souliane@mailoo.org>
date Mon, 20 Oct 2014 15:09:37 +0200
parents b6dbac8ee485
children 4b27b9bf31b0
comparison
equal deleted inserted replaced
1249:3be9d8ab2e15 1250:1f0ae61536aa
126 126
127 def _sendBridgeSignal(ignore=None): 127 def _sendBridgeSignal(ignore=None):
128 self.host.bridge.roomJoined(room.roomJID.userhost(), [user.nick for user in room.roster.values()], room.nick, profile) 128 self.host.bridge.roomJoined(room.roomJID.userhost(), [user.nick for user in room.roster.values()], room.nick, profile)
129 129
130 room_jid_s = room.roomJID.userhost() 130 room_jid_s = room.roomJID.userhost()
131 self.host.memory.updateEntityData(room.roomJID, "type", "chatroom", profile)
132 self.clients[profile].joined_rooms[room_jid_s] = room 131 self.clients[profile].joined_rooms[room_jid_s] = room
133 if room.locked: 132 if room.locked:
134 #FIXME: the current behaviour is to create an instant room 133 #FIXME: the current behaviour is to create an instant room
135 #and send the signal only when the room is unlocked 134 #and send the signal only when the room is unlocked
136 #a proper configuration management should be done 135 #a proper configuration management should be done
693 692
694 def receivedGroupChat(self, room, user, body): 693 def receivedGroupChat(self, room, user, body):
695 log.debug('receivedGroupChat: room=%s user=%s body=%s' % (room, user, body)) 694 log.debug('receivedGroupChat: room=%s user=%s body=%s' % (room, user, body))
696 695
697 def userJoinedRoom(self, room, user): 696 def userJoinedRoom(self, room, user):
697 self.host.memory.updateEntityData(room.roomJID, "type", "chatroom", self.parent.profile)
698 if user.nick in self.__changing_nicks: 698 if user.nick in self.__changing_nicks:
699 self.__changing_nicks.remove(user.nick) 699 self.__changing_nicks.remove(user.nick)
700 else: 700 else:
701 log.debug(_("user %(nick)s has joined room (%(room_id)s)") % {'nick': user.nick, 'room_id': room.occupantJID.userhost()}) 701 log.debug(_("user %(nick)s has joined room (%(room_id)s)") % {'nick': user.nick, 'room_id': room.occupantJID.userhost()})
702 if not self.host.trigger.point("MUC user joined", room, user, self.parent.profile): 702 if not self.host.trigger.point("MUC user joined", room, user, self.parent.profile):