comparison src/plugins/plugin_xep_0045.py @ 2021:6c51e8f17c92

plugin XEP-0045: added bridge method to change subject
author Goffi <goffi@goffi.org>
date Sun, 24 Jul 2016 18:59:02 +0200
parents d5befe7253aa
children 70bd7b242a9e
comparison
equal deleted inserted replaced
2020:f67da1cab6d3 2021:6c51e8f17c92
71 self.host = host 71 self.host = host
72 self._sessions = memory.Sessions() 72 self._sessions = memory.Sessions()
73 host.bridge.addMethod("mucJoin", ".plugin", in_sign='ssa{ss}s', out_sign='s', method=self._join, async=True) 73 host.bridge.addMethod("mucJoin", ".plugin", in_sign='ssa{ss}s', out_sign='s', method=self._join, async=True)
74 host.bridge.addMethod("mucNick", ".plugin", in_sign='sss', out_sign='', method=self._nick) 74 host.bridge.addMethod("mucNick", ".plugin", in_sign='sss', out_sign='', method=self._nick)
75 host.bridge.addMethod("mucLeave", ".plugin", in_sign='ss', out_sign='', method=self._leave, async=True) 75 host.bridge.addMethod("mucLeave", ".plugin", in_sign='ss', out_sign='', method=self._leave, async=True)
76 host.bridge.addMethod("mucSubject", ".plugin", in_sign='sss', out_sign='', method=self._subject)
76 host.bridge.addMethod("mucGetRoomsJoined", ".plugin", in_sign='s', out_sign='a(sa{sa{ss}}ss)', method=self._getRoomsJoined) 77 host.bridge.addMethod("mucGetRoomsJoined", ".plugin", in_sign='s', out_sign='a(sa{sa{ss}}ss)', method=self._getRoomsJoined)
77 host.bridge.addMethod("mucGetUniqueRoomName", ".plugin", in_sign='ss', out_sign='s', method=self._getUniqueName) 78 host.bridge.addMethod("mucGetUniqueRoomName", ".plugin", in_sign='ss', out_sign='s', method=self._getUniqueName)
78 host.bridge.addMethod("mucConfigureRoom", ".plugin", in_sign='ss', out_sign='s', method=self._configureRoom, async=True) 79 host.bridge.addMethod("mucConfigureRoom", ".plugin", in_sign='ss', out_sign='s', method=self._configureRoom, async=True)
79 host.bridge.addMethod("mucGetDefaultService", ".plugin", in_sign='', out_sign='s', method=self.getDefaultMUC) 80 host.bridge.addMethod("mucGetDefaultService", ".plugin", in_sign='', out_sign='s', method=self.getDefaultMUC)
80 host.bridge.addSignal("mucRoomJoined", ".plugin", signature='sa{sa{ss}}sss') # args: room_jid, occupants, user_nick, subject, profile 81 host.bridge.addSignal("mucRoomJoined", ".plugin", signature='sa{sa{ss}}sss') # args: room_jid, occupants, user_nick, subject, profile
440 return self.leave(client, jid.JID(room_jid)) 441 return self.leave(client, jid.JID(room_jid))
441 442
442 def leave(self, client, room_jid): 443 def leave(self, client, room_jid):
443 self.checkRoomJoined(client, room_jid) 444 self.checkRoomJoined(client, room_jid)
444 return client._muc_client.leave(room_jid) 445 return client._muc_client.leave(room_jid)
446
447 def _subject(self, room_jid_s, new_subject, profile_key):
448 client = self.host.getClient(profile_key)
449 return self.subject(client, jid.JID(room_jid_s), new_subject)
445 450
446 def subject(self, client, room_jid, subject): 451 def subject(self, client, room_jid, subject):
447 self.checkRoomJoined(client, room_jid) 452 self.checkRoomJoined(client, room_jid)
448 return client._muc_client.subject(room_jid, subject) 453 return client._muc_client.subject(room_jid, subject)
449 454