changeset 74:6e3a06b4dd36

plugin xep-0045: added roomUserJoined and roomUserLeft signals
author Goffi <goffi@goffi.org>
date Wed, 24 Mar 2010 16:50:53 +1100
parents 9d113b5471e6
children 7322a41f8a8e
files plugins/plugin_xep_0045.py sat_bridge/DBus.py
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/plugin_xep_0045.py	Mon Mar 22 14:21:57 2010 +1100
+++ b/plugins/plugin_xep_0045.py	Wed Mar 24 16:50:53 2010 +1100
@@ -70,6 +70,8 @@
         self.clients={}
         host.bridge.addMethod("joinMUC", ".communication", in_sign='ssss', out_sign='', method=self.join)
         host.bridge.addSignal("roomJoined", ".communication", signature='ssasss') #args: room_id, room_service, room_nicks, user_nick, profile
+        host.bridge.addSignal("roomUserJoined", ".communication", signature='sssa{ss}s') #args: room_id, room_service, user_nick, user_data, profile
+        host.bridge.addSignal("roomUserLeft", ".communication", signature='sssa{ss}s') #args: room_id, room_service, user_nick, user_data, profile
 
     def __check_profile(self, profile):
         if not profile or not self.clients.has_key(profile) or not self.host.isConnected(profile):
@@ -122,6 +124,15 @@
     def receivedGroupChat(self, room, user, body):
         debug('receivedGroupChat: room=%s user=%s body=%s', room, user, body)
 
+    def userJoinedRoom(self, room, user):
+        debug (_("user %(nick)s has joined room (%(room_id)s)") % {'nick':user.nick, 'room_id':room.occupantJID.userhost()})
+        user_data={'entity':user.entity or '', 'affiliation':user.affiliation, 'role':user.role} 
+        self.host.bridge.roomUserJoined(room.roomIdentifier, room.service, user.nick, user_data, self.parent.profile)
+    
+    def userLeftRoom(self, room, user):
+        debug (_("user %(nick)s left room (%(room_id)s)") % {'nick':user.nick, 'room_id':room.occupantJID.userhost()})
+        user_data={'entity':user.entity or '', 'affiliation':user.affiliation, 'role':user.role} 
+        self.host.bridge.roomUserLeft(room.roomIdentifier, room.service, user.nick, user_data, self.parent.profile)
 
     #def connectionInitialized(self):
         #pass
--- a/sat_bridge/DBus.py	Mon Mar 22 14:21:57 2010 +1100
+++ b/sat_bridge/DBus.py	Wed Mar 24 16:50:53 2010 +1100
@@ -362,4 +362,5 @@
 
     def addSignal(self, name, int_suffix, signature):
         self.dbus_bridge.addSignal(name, int_suffix, signature)
+        setattr(DBusBridge, name, getattr(self.dbus_bridge, name))