summaryrefslogtreecommitdiff
path: root/src/tabs/rostertab.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/tabs/rostertab.py')
-rw-r--r--src/tabs/rostertab.py44
1 files changed, 23 insertions, 21 deletions
diff --git a/src/tabs/rostertab.py b/src/tabs/rostertab.py
index 26f429d0..878e89ed 100644
--- a/src/tabs/rostertab.py
+++ b/src/tabs/rostertab.py
@@ -175,7 +175,7 @@ class RosterInfoTab(Tab):
jid = item.bare_jid
elif isinstance(item, Resource):
jid = item.jid.bare
- self.core.xmpp.plugin['xep_0191'].block(jid, block=False, callback=callback)
+ self.core.xmpp.plugin['xep_0191'].block(jid, callback=callback)
def completion_block(self, the_input):
"""
@@ -202,22 +202,21 @@ class RosterInfoTab(Tab):
jid = item.bare_jid
elif isinstance(item, Resource):
jid = item.jid.bare
- self.core.xmpp.plugin['xep_0191'].unblock(jid, block=False, callback=callback)
+ self.core.xmpp.plugin['xep_0191'].unblock(jid, callback=callback)
def completion_unblock(self, the_input):
"""
Completion for /unblock
"""
+ def on_result(iq):
+ if iq['type'] == 'error':
+ return
+ l = sorted(str(item) for item in iq['blocklist']['items'])
+ return the_input.new_completion(l, 1, quotify=False)
+
if the_input.get_argument_position():
- try:
- iq = self.core.xmpp.plugin['xep_0191'].get_blocked(block=True)
- except Exception as e:
- iq = e.iq
- finally:
- if iq['type'] == 'error':
- return
- l = sorted(str(item) for item in iq['blocklist']['items'])
- return the_input.new_completion(l, 1, quotify=False)
+ self.core.xmpp.plugin['xep_0191'].get_blocked(callback=on_result)
+ return True
def command_list_blocks(self, arg=None):
"""
@@ -235,13 +234,16 @@ class RosterInfoTab(Tab):
s = 'No blocked JIDs.'
self.core.information(s, 'Info')
- self.core.xmpp.plugin['xep_0191'].get_blocked(block=False, callback=callback)
+ self.core.xmpp.plugin['xep_0191'].get_blocked(callback=callback)
def command_reconnect(self, args=None):
"""
/reconnect
"""
- self.core.disconnect(reconnect=True)
+ if self.core.xmpp.is_connected():
+ self.core.disconnect(reconnect=True)
+ else:
+ self.core.xmpp.connect()
def command_disconnect(self, args=None):
"""
@@ -419,8 +421,8 @@ class RosterInfoTab(Tab):
if 'none' in groups:
groups.remove('none')
subscription = contact.subscription
- self.core.xmpp.update_roster(jid, name=name, groups=groups, subscription=subscription,
- callback=callback, block=False)
+ self.core.xmpp.update_roster(jid, name=name, groups=groups,
+ subscription=subscription, callback=callback)
def command_groupadd(self, args):
"""
@@ -459,8 +461,8 @@ class RosterInfoTab(Tab):
self.core.information('The group could not be set.', 'Error')
log.debug('Error in groupadd:\n%s', iq)
- self.core.xmpp.update_roster(jid, name=name, groups=new_groups, subscription=subscription,
- callback=callback, block=False)
+ self.core.xmpp.update_roster(jid, name=name, groups=new_groups,
+ subscription=subscription, callback=callback)
def command_groupmove(self, arg):
"""
@@ -514,8 +516,8 @@ class RosterInfoTab(Tab):
self.core.information('The group could not be set')
log.debug('Error in groupmove:\n%s', iq)
- self.core.xmpp.update_roster(jid, name=name, groups=new_groups, subscription=subscription,
- callback=callback, block=False)
+ self.core.xmpp.update_roster(jid, name=name, groups=new_groups,
+ subscription=subscription, callback=callback)
def command_groupremove(self, args):
"""
@@ -554,8 +556,8 @@ class RosterInfoTab(Tab):
self.core.information('The group could not be set')
log.debug('Error in groupremove:\n%s', iq)
- self.core.xmpp.update_roster(jid, name=name, groups=new_groups, subscription=subscription,
- callback=callback, block=False)
+ self.core.xmpp.update_roster(jid, name=name, groups=new_groups,
+ subscription=subscription, callback=callback)
def command_remove(self, args):
"""