summaryrefslogtreecommitdiff
path: root/src/tabs.py
diff options
context:
space:
mode:
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')