changeset 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 f67da1cab6d3
children 88c41a195728
files src/plugins/plugin_xep_0045.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0045.py	Sun Jul 24 18:07:45 2016 +0200
+++ b/src/plugins/plugin_xep_0045.py	Sun Jul 24 18:59:02 2016 +0200
@@ -73,6 +73,7 @@
         host.bridge.addMethod("mucJoin", ".plugin", in_sign='ssa{ss}s', out_sign='s', method=self._join, async=True)
         host.bridge.addMethod("mucNick", ".plugin", in_sign='sss', out_sign='', method=self._nick)
         host.bridge.addMethod("mucLeave", ".plugin", in_sign='ss', out_sign='', method=self._leave, async=True)
+        host.bridge.addMethod("mucSubject", ".plugin", in_sign='sss', out_sign='', method=self._subject)
         host.bridge.addMethod("mucGetRoomsJoined", ".plugin", in_sign='s', out_sign='a(sa{sa{ss}}ss)', method=self._getRoomsJoined)
         host.bridge.addMethod("mucGetUniqueRoomName", ".plugin", in_sign='ss', out_sign='s', method=self._getUniqueName)
         host.bridge.addMethod("mucConfigureRoom", ".plugin", in_sign='ss', out_sign='s', method=self._configureRoom, async=True)
@@ -443,6 +444,10 @@
         self.checkRoomJoined(client, room_jid)
         return client._muc_client.leave(room_jid)
 
+    def _subject(self, room_jid_s, new_subject, profile_key):
+        client = self.host.getClient(profile_key)
+        return self.subject(client, jid.JID(room_jid_s), new_subject)
+
     def subject(self, client, room_jid, subject):
         self.checkRoomJoined(client, room_jid)
         return client._muc_client.subject(room_jid, subject)