summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins
diff options
context:
space:
mode:
authorAleksandr Draga <a_draga@wargaming.net>2015-08-10 15:34:27 +0300
committerAleksandr Draga <a_draga@wargaming.net>2015-08-10 15:34:27 +0300
commita366482551f140e31d56c628eb830602fe049bb5 (patch)
treeee054cad560ab51d9c429597ffb7cf44d9589025 /sleekxmpp/plugins
parentabcec1e2d3348cabf6f9f6fc26d31be1e2c6c9ed (diff)
downloadslixmpp-a366482551f140e31d56c628eb830602fe049bb5.tar.gz
slixmpp-a366482551f140e31d56c628eb830602fe049bb5.tar.bz2
slixmpp-a366482551f140e31d56c628eb830602fe049bb5.tar.xz
slixmpp-a366482551f140e31d56c628eb830602fe049bb5.zip
Add get users by affiliation.
Diffstat (limited to 'sleekxmpp/plugins')
-rw-r--r--sleekxmpp/plugins/xep_0045.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/sleekxmpp/plugins/xep_0045.py b/sleekxmpp/plugins/xep_0045.py
index ca5ed1ef..cc96d66e 100644
--- a/sleekxmpp/plugins/xep_0045.py
+++ b/sleekxmpp/plugins/xep_0045.py
@@ -397,6 +397,16 @@ class XEP_0045(BasePlugin):
return None
return self.rooms[room].keys()
+ def getUsersByAffiliation(cls, room, affiliation='member', ifrom=None):
+ if affiliation not in ('outcast', 'member', 'admin', 'owner', 'none'):
+ raise TypeError
+ query = ET.Element('{http://jabber.org/protocol/muc#admin}query')
+ item = ET.Element('{http://jabber.org/protocol/muc#admin}item', {'affiliation': affiliation})
+ query.append(item)
+ iq = cls.xmpp.Iq(sto=room, sfrom=ifrom, stype='get')
+ iq.append(query)
+ return iq.send()
+
xep_0045 = XEP_0045
register_plugin(XEP_0045)