diff plugins/plugin_xep_0045.py @ 75:7322a41f8a8e

Basic user joined/left management - plugin XEP-0045: user joined./left signal is sended - wix: user are adder/removed when these signals are catched
author Goffi <goffi@goffi.org>
date Mon, 29 Mar 2010 16:54:53 +1100
parents 6e3a06b4dd36
children 8becde8a967c
line wrap: on
line diff
--- a/plugins/plugin_xep_0045.py	Wed Mar 24 16:50:53 2010 +1100
+++ b/plugins/plugin_xep_0045.py	Mon Mar 29 16:54:53 2010 +1100
@@ -74,6 +74,10 @@
         host.bridge.addSignal("roomUserLeft", ".communication", signature='sssa{ss}s') #args: room_id, room_service, user_nick, user_data, profile
 
     def __check_profile(self, profile):
+        """check if profile is used and connected
+        if profile known but disconnected, remove it from known profiles
+        @param profile: profile to check
+        @return: True if the profile is known and connected, else False"""
         if not profile or not self.clients.has_key(profile) or not self.host.isConnected(profile):
             error (_('Unknown or disconnected profile'))
             if self.clients.has_key(profile):
@@ -86,9 +90,9 @@
         print "room joined (profile = %s)" % profile
         room_jid = room.roomIdentifier+'@'+room.service
         self.clients[profile].joined_rooms[room_jid] = room
-        self.host.bridge.roomJoined(room.roomIdentifier, room.service, room.roster.keys(), room.nick, profile)
+        self.host.bridge.roomJoined(room.roomIdentifier, room.service, [user.nick for user in room.roster.values()], room.nick, profile)
 
-    def __err_joining_room(self, failure, profile): #, profile):
+    def __err_joining_room(self, failure, profile):
         """Called when something is going wrong when joining the room"""
         error ("Error when joining the room")
         pdb.set_trace()