Mercurial > libervia-backend
comparison plugins/plugin_xep_0045.py @ 76:8becde8a967c
MUC: added subject management
- plugin xep-0045: added roomNewSubject signal
- wix: added subject bar for group windows
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 30 Mar 2010 13:15:05 +1100 |
parents | 7322a41f8a8e |
children | 1ae680f9682e |
comparison
equal
deleted
inserted
replaced
75:7322a41f8a8e | 76:8becde8a967c |
---|---|
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 | 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 | 74 host.bridge.addSignal("roomUserLeft", ".communication", signature='sssa{ss}s') #args: room_id, room_service, user_nick, user_data, profile |
75 host.bridge.addSignal("roomNewSubject", ".communication", signature='ssss') #args: room_id, room_service, subject, profile | |
75 | 76 |
76 def __check_profile(self, profile): | 77 def __check_profile(self, profile): |
77 """check if profile is used and connected | 78 """check if profile is used and connected |
78 if profile known but disconnected, remove it from known profiles | 79 if profile known but disconnected, remove it from known profiles |
79 @param profile: profile to check | 80 @param profile: profile to check |
93 self.host.bridge.roomJoined(room.roomIdentifier, room.service, [user.nick for user in room.roster.values()], room.nick, profile) | 94 self.host.bridge.roomJoined(room.roomIdentifier, room.service, [user.nick for user in room.roster.values()], room.nick, profile) |
94 | 95 |
95 def __err_joining_room(self, failure, profile): | 96 def __err_joining_room(self, failure, profile): |
96 """Called when something is going wrong when joining the room""" | 97 """Called when something is going wrong when joining the room""" |
97 error ("Error when joining the room") | 98 error ("Error when joining the room") |
98 pdb.set_trace() | 99 #TODO: gof: send an error message throught the bridge |
99 | 100 |
100 def join(self, service, roomId, nick, profile_key='@DEFAULT@'): | 101 def join(self, service, roomId, nick, profile_key='@DEFAULT@'): |
101 profile = self.host.memory.getProfileName(profile_key) | 102 profile = self.host.memory.getProfileName(profile_key) |
102 if not self.__check_profile(profile): | 103 if not self.__check_profile(profile): |
103 return | 104 return |
136 def userLeftRoom(self, room, user): | 137 def userLeftRoom(self, room, user): |
137 debug (_("user %(nick)s left room (%(room_id)s)") % {'nick':user.nick, 'room_id':room.occupantJID.userhost()}) | 138 debug (_("user %(nick)s left room (%(room_id)s)") % {'nick':user.nick, 'room_id':room.occupantJID.userhost()}) |
138 user_data={'entity':user.entity or '', 'affiliation':user.affiliation, 'role':user.role} | 139 user_data={'entity':user.entity or '', 'affiliation':user.affiliation, 'role':user.role} |
139 self.host.bridge.roomUserLeft(room.roomIdentifier, room.service, user.nick, user_data, self.parent.profile) | 140 self.host.bridge.roomUserLeft(room.roomIdentifier, room.service, user.nick, user_data, self.parent.profile) |
140 | 141 |
142 def receivedSubject(self, room, subject): | |
143 debug (_("New subject for room (%(room_id)s): %(subject)s") % {'room_id':room.occupantJID.userhost(),'subject':subject}) | |
144 self.host.bridge.roomNewSubject(room.roomIdentifier, room.service, subject, self.parent.profile) | |
145 | |
141 #def connectionInitialized(self): | 146 #def connectionInitialized(self): |
142 #pass | 147 #pass |
143 | 148 |
144 #def getDiscoInfo(self, requestor, target, nodeIdentifier=''): | 149 #def getDiscoInfo(self, requestor, target, nodeIdentifier=''): |
145 #return [disco.DiscoFeature(NS_VCARD)] | 150 #return [disco.DiscoFeature(NS_VCARD)] |