summaryrefslogtreecommitdiff
path: root/src/tabs.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-03-04 16:20:07 +0100
committermathieui <mathieui@mathieui.net>2013-03-04 16:20:07 +0100
commitd99c09ffc3fffe95ebb8a1e137df45506e467167 (patch)
tree8816a61d24898549347d4886b7d6df56e343b85e /src/tabs.py
parentf40cfe26699a60191ab7dfd719206ced739d3955 (diff)
downloadpoezio-d99c09ffc3fffe95ebb8a1e137df45506e467167.tar.gz
poezio-d99c09ffc3fffe95ebb8a1e137df45506e467167.tar.bz2
poezio-d99c09ffc3fffe95ebb8a1e137df45506e467167.tar.xz
poezio-d99c09ffc3fffe95ebb8a1e137df45506e467167.zip
Make /affiliation and /role non-blocking (fix #2235)
Diffstat (limited to 'src/tabs.py')
-rw-r--r--src/tabs.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/tabs.py b/src/tabs.py
index 0b2cfc2e..3e7dc5f3 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -1162,6 +1162,9 @@ class MucTab(ChatTab):
Changes the role of an user
roles can be: none, visitor, participant, moderator
"""
+ def callback(iq):
+ if iq['type'] == 'error':
+ self.core.room_error(iq, self.get_name())
args = common.shell_split(arg)
if len(args) < 2:
self.core.command_help('role')
@@ -1176,9 +1179,7 @@ class MucTab(ChatTab):
return
if not safeJID(self.get_name() + '/' + nick):
return self.core('Invalid nick', 'Info')
- res = muc.set_user_role(self.core.xmpp, self.get_name(), nick, reason, role)
- if res['type'] == 'error':
- self.core.room_error(res, self.get_name())
+ muc.set_user_role(self.core.xmpp, self.get_name(), nick, reason, role, callback=callback)
def command_affiliation(self, arg):
"""
@@ -1186,6 +1187,9 @@ class MucTab(ChatTab):
Changes the affiliation of an user
affiliations can be: outcast, none, member, admin, owner
"""
+ def callback(iq):
+ if iq['type'] == 'error':
+ self.core.room_error(iq, self.get_name())
args = common.shell_split(arg)
if len(args) < 2:
self.core.command_help('affiliation')
@@ -1197,9 +1201,9 @@ class MucTab(ChatTab):
self.core.command_help('affiliation')
return
if nick in [user.nick for user in self.users]:
- res = muc.set_user_affiliation(self.core.xmpp, self.get_name(), affiliation, nick=nick)
+ res = muc.set_user_affiliation(self.core.xmpp, self.get_name(), affiliation, nick=nick, callback=callback)
else:
- res = muc.set_user_affiliation(self.core.xmpp, self.get_name(), affiliation, jid=safeJID(nick))
+ res = muc.set_user_affiliation(self.core.xmpp, self.get_name(), affiliation, jid=safeJID(nick), callback=callback)
if not res:
self.core.information('Could not set affiliation', 'Error')