From 07e46837d9da11ce41ea18a5276bfe740aa8dfbc Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Fri, 1 Aug 2014 15:02:54 +0200 Subject: Fix some more blocking iq --- slixmpp/clientxmpp.py | 6 +----- slixmpp/plugins/xep_0280/carbons.py | 12 ++++++++---- slixmpp/roster/single.py | 9 +++------ 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/slixmpp/clientxmpp.py b/slixmpp/clientxmpp.py index add7f437..66a846d3 100644 --- a/slixmpp/clientxmpp.py +++ b/slixmpp/clientxmpp.py @@ -188,9 +188,6 @@ class ClientXMPP(BaseXMPP): ``'none'``. If set to ``'remove'``, the entry will be deleted. :param groups: The roster groups that contain this item. - :param block: Specify if the roster request will block - until a response is received, or a timeout - occurs. Defaults to ``True``. :param timeout: The length of time (in seconds) to wait for a response before continuing if blocking is used. Defaults to @@ -205,12 +202,11 @@ class ClientXMPP(BaseXMPP): subscription = kwargs.get('subscription', current['subscription']) groups = kwargs.get('groups', current['groups']) - block = kwargs.get('block', True) timeout = kwargs.get('timeout', None) callback = kwargs.get('callback', None) return self.client_roster.update(jid, name, subscription, groups, - block, timeout, callback) + timeout, callback) def del_roster_item(self, jid): """Remove an item from the roster. diff --git a/slixmpp/plugins/xep_0280/carbons.py b/slixmpp/plugins/xep_0280/carbons.py index 15b07229..a64ccbfd 100644 --- a/slixmpp/plugins/xep_0280/carbons.py +++ b/slixmpp/plugins/xep_0280/carbons.py @@ -66,16 +66,20 @@ class XEP_0280(BasePlugin): def _handle_carbon_sent(self, msg): self.xmpp.event('carbon_sent', msg) - def enable(self, ifrom=None, block=True, timeout=None, callback=None): + def enable(self, ifrom=None, timeout=None, callback=None, + timeout_callback=None): iq = self.xmpp.Iq() iq['type'] = 'set' iq['from'] = ifrom iq.enable('carbon_enable') - return iq.send(block=block, timeout=timeout, callback=callback) + return iq.send(timeout_callback=timeout_callback, timeout=timeout, + callback=callback) - def disable(self, ifrom=None, block=True, timeout=None, callback=None): + def disable(self, ifrom=None, timeout=None, callback=None, + timeout_callback=None): iq = self.xmpp.Iq() iq['type'] = 'set' iq['from'] = ifrom iq.enable('carbon_disable') - return iq.send(block=block, timeout=timeout, callback=callback) + return iq.send(timeout_callback=timeout_callback, timeout=timeout, + callback=callback) diff --git a/slixmpp/roster/single.py b/slixmpp/roster/single.py index 07a1f188..a37e3eb7 100644 --- a/slixmpp/roster/single.py +++ b/slixmpp/roster/single.py @@ -238,7 +238,7 @@ class RosterNode(object): return self.update(jid, subscription='remove') def update(self, jid, name=None, subscription=None, groups=[], - block=True, timeout=None, callback=None): + timeout=None, callback=None, timeout_callback=None): """ Update a JID's subscription information. @@ -248,15 +248,11 @@ class RosterNode(object): subscription -- The subscription state. May be one of: 'to', 'from', 'both', 'none', or 'remove'. groups -- A list of group names. - block -- Specify if the roster request will block - until a response is received, or a timeout - occurs. Defaults to True. timeout -- The length of time (in seconds) to wait for a response before continuing if blocking is used. Defaults to self.response_timeout. callback -- Optional reference to a stream handler function. Will be executed when the roster is received. - Implies block=False. """ self[jid]['name'] = name self[jid]['groups'] = groups @@ -269,7 +265,8 @@ class RosterNode(object): 'subscription': subscription, 'groups': groups}} - return iq.send(block, timeout, callback) + return iq.send(timeout=timeout, callback=callback, + timeout_callback=timeout_callback) def presence(self, jid, resource=None): """ -- cgit v1.2.3