summaryrefslogtreecommitdiff
path: root/src/multiuserchat.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2012-02-15 20:10:00 +0100
committerFlorent Le Coz <louiz@louiz.org>2012-02-15 20:10:00 +0100
commit695a7ebebaf6a277420dcb42cd96d92d77df0379 (patch)
tree8c9da1e5bf988356ad110f42113949aab94a5866 /src/multiuserchat.py
parent0606c2b351ac87f110e1240d2f4ba1b94b275930 (diff)
parentb89cd8fd8322bf8aa23130398a0a70defcba708d (diff)
downloadpoezio-695a7ebebaf6a277420dcb42cd96d92d77df0379.tar.gz
poezio-695a7ebebaf6a277420dcb42cd96d92d77df0379.tar.bz2
poezio-695a7ebebaf6a277420dcb42cd96d92d77df0379.tar.xz
poezio-695a7ebebaf6a277420dcb42cd96d92d77df0379.zip
Merge branch 'master' of https://git.louiz.org/poezio
Diffstat (limited to 'src/multiuserchat.py')
-rw-r--r--src/multiuserchat.py18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/multiuserchat.py b/src/multiuserchat.py
index f537c2c1..3f0c80b8 100644
--- a/src/multiuserchat.py
+++ b/src/multiuserchat.py
@@ -88,21 +88,11 @@ def set_user_role(xmpp, jid, nick, reason, role):
except Exception as e:
return e.iq
-def set_user_affiliation(xmpp, jid, nick, reason, affiliation):
+def set_user_affiliation(xmpp, muc_jid, affiliation, nick=None, jid=None, reason=None):
"""
(try to) Set the affiliation of a MUC user
"""
- iq = xmpp.makeIqSet()
- query = ET.Element('{%s}query' % NS_MUC_ADMIN)
- item = ET.Element('{%s}item' % NS_MUC_ADMIN, {'nick':nick, 'affiliation':affiliation})
- if reason:
- reason_el = ET.Element('{%s}reason' % NS_MUC_ADMIN)
- reason_el.text = reason
- item.append(reason_el)
- query.append(item)
- iq.append(query)
- iq['to'] = jid
try:
- return iq.send()
- except Exception as e:
- return e.iq
+ return xmpp.plugin['xep_0045'].set_affiliation(muc_jid, jid, nick, affiliation)
+ except:
+ return False