plugin xep-0045: added roomUserJoined and roomUserLeft signals
This commit is contained in:
parent
af23265ee0
commit
ad94be8064
2 changed files with 12 additions and 0 deletions
|
|
@ -70,6 +70,8 @@ class XEP_0045():
|
|||
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 @@ class SatMUCClient (muc.MUCClient):
|
|||
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
|
||||
|
|
|
|||
|
|
@ -362,4 +362,5 @@ class DBusBridge(Bridge):
|
|||
|
||||
def addSignal(self, name, int_suffix, signature):
|
||||
self.dbus_bridge.addSignal(name, int_suffix, signature)
|
||||
setattr(DBusBridge, name, getattr(self.dbus_bridge, name))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue