summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Taylor <bear42@gmail.com>2015-09-18 15:13:54 -0400
committerMike Taylor <bear42@gmail.com>2015-09-18 15:13:54 -0400
commitc6740a49086bf6e3d0703653aa93566aa80a874b (patch)
treed52567effcdd8117d06e16f0820f5e7005df61d4
parent55114bcffef0d28f1c03c9f879833805d6276756 (diff)
parenta366482551f140e31d56c628eb830602fe049bb5 (diff)
downloadslixmpp-c6740a49086bf6e3d0703653aa93566aa80a874b.tar.gz
slixmpp-c6740a49086bf6e3d0703653aa93566aa80a874b.tar.bz2
slixmpp-c6740a49086bf6e3d0703653aa93566aa80a874b.tar.xz
slixmpp-c6740a49086bf6e3d0703653aa93566aa80a874b.zip
Merge pull request #389 from alexdraga/develop
Add get users by affiliation.
-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)