comparison src/plugins/plugin_xep_0045.py @ 515:29b5ef129488

plugin XEP-0045, plugin text commands: added '/title' command
author Goffi <goffi@goffi.org>
date Sat, 20 Oct 2012 18:02:14 +0200
parents 64ff046dc201
children 75216d94a89d
comparison
equal deleted inserted replaced
514:fe79a724e6fa 515:29b5ef129488
188 raise exceptions.UnknownProfileError("Unknown or disconnected profile") 188 raise exceptions.UnknownProfileError("Unknown or disconnected profile")
189 if not self.clients[profile].joined_rooms.has_key(room_jid.userhost()): 189 if not self.clients[profile].joined_rooms.has_key(room_jid.userhost()):
190 raise UnknownRoom("This room has not been joined") 190 raise UnknownRoom("This room has not been joined")
191 return self.clients[profile].leave(room_jid) 191 return self.clients[profile].leave(room_jid)
192 192
193 def subject(self, room_jid, subject, profile_key):
194 profile = self.host.memory.getProfileName(profile_key)
195 if not self.__check_profile(profile):
196 raise exceptions.UnknownProfileError("Unknown or disconnected profile")
197 if not self.clients[profile].joined_rooms.has_key(room_jid.userhost()):
198 raise UnknownRoom("This room has not been joined")
199 return self.clients[profile].subject(room_jid, subject)
200
193 def mucNick(self, room_jid_s, nick, profile_key='@DEFAULT@'): 201 def mucNick(self, room_jid_s, nick, profile_key='@DEFAULT@'):
194 """Change nickname in a room""" 202 """Change nickname in a room"""
195 return self.nick(jid.JID(room_jid_s), nick, profile_key) 203 return self.nick(jid.JID(room_jid_s), nick, profile_key)
196 204
197 def mucLeave(self, room_jid_s, profile_key='@DEFAULT@'): 205 def mucLeave(self, room_jid_s, profile_key='@DEFAULT@'):
214 self.joined_rooms = {} 222 self.joined_rooms = {}
215 self.rec_subjects = {} 223 self.rec_subjects = {}
216 self.__changing_nicks = set() # used to keep trace of who is changing nick, 224 self.__changing_nicks = set() # used to keep trace of who is changing nick,
217 # and to discard userJoinedRoom signal in this case 225 # and to discard userJoinedRoom signal in this case
218 print "init SatMUCClient OK" 226 print "init SatMUCClient OK"
227
228 def subject(self, room, subject):
229 return muc.MUCClientProtocol.subject(self, room, subject)
219 230
220 def unavailableReceived(self, presence): 231 def unavailableReceived(self, presence):
221 #XXX: we override this method to manage nickname change 232 #XXX: we override this method to manage nickname change
222 #TODO: feed this back to Wokkel 233 #TODO: feed this back to Wokkel
223 """ 234 """
277 def receivedSubject(self, room, user, subject): 288 def receivedSubject(self, room, user, subject):
278 debug (_("New subject for room (%(room_id)s): %(subject)s") % {'room_id':room.roomJID.full(),'subject':subject}) 289 debug (_("New subject for room (%(room_id)s): %(subject)s") % {'room_id':room.roomJID.full(),'subject':subject})
279 self.rec_subjects[room.roomJID.userhost()] = (room.roomJID.userhost(), subject) 290 self.rec_subjects[room.roomJID.userhost()] = (room.roomJID.userhost(), subject)
280 self.host.bridge.roomNewSubject(room.roomJID.userhost(), subject, self.parent.profile) 291 self.host.bridge.roomNewSubject(room.roomJID.userhost(), subject, self.parent.profile)
281 292
282
283 #def connectionInitialized(self): 293 #def connectionInitialized(self):
284 #pass 294 #pass
285 295
286 #def getDiscoInfo(self, requestor, target, nodeIdentifier=''): 296 #def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
287 #return [disco.DiscoFeature(NS_VCARD)] 297 #return [disco.DiscoFeature(NS_VCARD)]