comparison plugins/plugin_xep_0045.py @ 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
comparison
equal deleted inserted replaced
73:9d113b5471e6 74:6e3a06b4dd36
68 info(_("Plugin XEP_0045 initialization")) 68 info(_("Plugin XEP_0045 initialization"))
69 self.host = host 69 self.host = host
70 self.clients={} 70 self.clients={}
71 host.bridge.addMethod("joinMUC", ".communication", in_sign='ssss', out_sign='', method=self.join) 71 host.bridge.addMethod("joinMUC", ".communication", in_sign='ssss', out_sign='', method=self.join)
72 host.bridge.addSignal("roomJoined", ".communication", signature='ssasss') #args: room_id, room_service, room_nicks, user_nick, profile 72 host.bridge.addSignal("roomJoined", ".communication", signature='ssasss') #args: room_id, room_service, room_nicks, user_nick, profile
73 host.bridge.addSignal("roomUserJoined", ".communication", signature='sssa{ss}s') #args: room_id, room_service, user_nick, user_data, profile
74 host.bridge.addSignal("roomUserLeft", ".communication", signature='sssa{ss}s') #args: room_id, room_service, user_nick, user_data, profile
73 75
74 def __check_profile(self, profile): 76 def __check_profile(self, profile):
75 if not profile or not self.clients.has_key(profile) or not self.host.isConnected(profile): 77 if not profile or not self.clients.has_key(profile) or not self.host.isConnected(profile):
76 error (_('Unknown or disconnected profile')) 78 error (_('Unknown or disconnected profile'))
77 if self.clients.has_key(profile): 79 if self.clients.has_key(profile):
120 print "init SatMUCClient OK" 122 print "init SatMUCClient OK"
121 123
122 def receivedGroupChat(self, room, user, body): 124 def receivedGroupChat(self, room, user, body):
123 debug('receivedGroupChat: room=%s user=%s body=%s', room, user, body) 125 debug('receivedGroupChat: room=%s user=%s body=%s', room, user, body)
124 126
127 def userJoinedRoom(self, room, user):
128 debug (_("user %(nick)s has joined room (%(room_id)s)") % {'nick':user.nick, 'room_id':room.occupantJID.userhost()})
129 user_data={'entity':user.entity or '', 'affiliation':user.affiliation, 'role':user.role}
130 self.host.bridge.roomUserJoined(room.roomIdentifier, room.service, user.nick, user_data, self.parent.profile)
131
132 def userLeftRoom(self, room, user):
133 debug (_("user %(nick)s left room (%(room_id)s)") % {'nick':user.nick, 'room_id':room.occupantJID.userhost()})
134 user_data={'entity':user.entity or '', 'affiliation':user.affiliation, 'role':user.role}
135 self.host.bridge.roomUserLeft(room.roomIdentifier, room.service, user.nick, user_data, self.parent.profile)
125 136
126 #def connectionInitialized(self): 137 #def connectionInitialized(self):
127 #pass 138 #pass
128 139
129 #def getDiscoInfo(self, requestor, target, nodeIdentifier=''): 140 #def getDiscoInfo(self, requestor, target, nodeIdentifier=''):