diff options
author | Florent Le Coz <louiz@louiz.org> | 2014-08-01 15:01:25 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-08-01 15:01:25 +0200 |
commit | 992fe72554de694750519f3f12886023314a8278 (patch) | |
tree | 5ac5f4774cbc81c8505ac8d2f2295cf968ce23d2 /src/tabs | |
parent | 3ec9e80de48225c7f27c19cdc0546762c042d0d1 (diff) | |
download | poezio-992fe72554de694750519f3f12886023314a8278.tar.gz poezio-992fe72554de694750519f3f12886023314a8278.tar.bz2 poezio-992fe72554de694750519f3f12886023314a8278.tar.xz poezio-992fe72554de694750519f3f12886023314a8278.zip |
Fix a few blocking iq, and remove all block=False function arguments
Diffstat (limited to 'src/tabs')
-rw-r--r-- | src/tabs/basetabs.py | 2 | ||||
-rw-r--r-- | src/tabs/conversationtab.py | 2 | ||||
-rw-r--r-- | src/tabs/rostertab.py | 39 |
3 files changed, 21 insertions, 22 deletions
diff --git a/src/tabs/basetabs.py b/src/tabs/basetabs.py index 5be8a9d1..4089f0da 100644 --- a/src/tabs/basetabs.py +++ b/src/tabs/basetabs.py @@ -726,7 +726,7 @@ class OneToOneTab(ChatTab): "check the features supported by the other party" if safeJID(self.get_dest_jid()).resource: self.core.xmpp.plugin['xep_0030'].get_info( - jid=self.get_dest_jid(), block=False, timeout=5, + jid=self.get_dest_jid(), timeout=5, callback=self.features_checked) def command_attention(self, message=''): diff --git a/src/tabs/conversationtab.py b/src/tabs/conversationtab.py index e6324182..a6cb0d59 100644 --- a/src/tabs/conversationtab.py +++ b/src/tabs/conversationtab.py @@ -187,7 +187,7 @@ class ConversationTab(OneToOneTab): self.add_message(msg) self.core.refresh_window() - self.core.xmpp.plugin['xep_0012'].get_last_activity(self.general_jid, block=False, callback=callback) + self.core.xmpp.plugin['xep_0012'].get_last_activity(self.general_jid, callback=callback) @refresh_wrapper.conditional def command_info(self, arg): diff --git a/src/tabs/rostertab.py b/src/tabs/rostertab.py index cb80007a..1ee98dd8 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,7 +234,7 @@ 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): """ @@ -422,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): """ @@ -462,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): """ @@ -517,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): """ @@ -557,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): """ |