diff options
22 files changed, 66 insertions, 128 deletions
diff --git a/slixmpp/plugins/xep_0047/ibb.py b/slixmpp/plugins/xep_0047/ibb.py index 7c01c78a..87cd1f51 100644 --- a/slixmpp/plugins/xep_0047/ibb.py +++ b/slixmpp/plugins/xep_0047/ibb.py @@ -116,7 +116,7 @@ class XEP_0047(BasePlugin): self._preauthed_sids[(jid, sid, ifrom)] = True def open_stream(self, jid, block_size=None, sid=None, window=1, use_messages=False, - ifrom=None, block=True, timeout=None, callback=None): + ifrom=None, timeout=None, callback=None): if sid is None: sid = str(uuid.uuid4()) if block_size is None: @@ -139,20 +139,15 @@ class XEP_0047(BasePlugin): self._pending_streams[iq['id']] = stream - if block: - resp = iq.send(timeout=timeout) - self._handle_opened_stream(resp) - return stream + cb = None + if callback is not None: + def chained(resp): + self._handle_opened_stream(resp) + callback(resp) + cb = chained else: - cb = None - if callback is not None: - def chained(resp): - self._handle_opened_stream(resp) - callback(resp) - cb = chained - else: - cb = self._handle_opened_stream - return iq.send(block=block, timeout=timeout, callback=cb) + cb = self._handle_opened_stream + return iq.send(timeout=timeout, callback=cb) def _handle_opened_stream(self, iq): if iq['type'] == 'result': diff --git a/slixmpp/plugins/xep_0047/stream.py b/slixmpp/plugins/xep_0047/stream.py index ba0b2cec..817f96a1 100644 --- a/slixmpp/plugins/xep_0047/stream.py +++ b/slixmpp/plugins/xep_0047/stream.py @@ -70,7 +70,7 @@ class IBBytestream(object): iq['ibb_data']['data'] = data self.window_empty.clear() self.window_ids.add(iq['id']) - iq.send(block=False, callback=self._recv_ack) + iq.send(callback=self._recv_ack) return len(data) def sendall(self, data): diff --git a/slixmpp/plugins/xep_0050/adhoc.py b/slixmpp/plugins/xep_0050/adhoc.py index 17c4f7d0..1b32870e 100644 --- a/slixmpp/plugins/xep_0050/adhoc.py +++ b/slixmpp/plugins/xep_0050/adhoc.py @@ -37,10 +37,6 @@ class XEP_0050(BasePlugin): Also see <http://xmpp.org/extensions/xep-0050.html> - Configuration Values: - threaded -- Indicates if command events should be threaded. - Defaults to True. - Events: command_execute -- Received a command with action="execute" command_next -- Received a command with action="next" @@ -48,8 +44,6 @@ class XEP_0050(BasePlugin): command_cancel -- Received a command with action="cancel" Attributes: - threaded -- Indicates if command events should be threaded. - Defaults to True. commands -- A dictionary mapping JID/node pairs to command names and handlers. sessions -- A dictionary or equivalent backend mapping @@ -83,7 +77,6 @@ class XEP_0050(BasePlugin): dependencies = set(['xep_0030', 'xep_0004']) stanza = stanza default_config = { - 'threaded': True, 'session_db': None } diff --git a/slixmpp/plugins/xep_0054/vcard_temp.py b/slixmpp/plugins/xep_0054/vcard_temp.py index ae47a5f9..f7282e92 100644 --- a/slixmpp/plugins/xep_0054/vcard_temp.py +++ b/slixmpp/plugins/xep_0054/vcard_temp.py @@ -60,7 +60,7 @@ class XEP_0054(BasePlugin): return VCardTemp() def get_vcard(self, jid=None, ifrom=None, local=None, cached=False, - block=True, callback=None, timeout=None): + callback=None, timeout=None): if local is None: if jid is not None and not isinstance(jid, JID): jid = JID(jid) @@ -99,13 +99,9 @@ class XEP_0054(BasePlugin): iq['type'] = 'get' iq.enable('vcard_temp') - vcard = iq.send(block=block, callback=callback, timeout=timeout) + iq.send(callback=callback, timeout=timeout) - if block: - self.api['set_vcard'](vcard['from'], args=vcard['vcard_temp']) - return vcard - - def publish_vcard(self, vcard=None, jid=None, block=True, ifrom=None, + def publish_vcard(self, vcard=None, jid=None, ifrom=None, callback=None, timeout=None): self.api['set_vcard'](jid, None, ifrom, vcard) if self.xmpp.is_component: @@ -116,7 +112,7 @@ class XEP_0054(BasePlugin): iq['from'] = ifrom iq['type'] = 'set' iq.append(vcard) - return iq.send(block=block, callback=callback, timeout=timeout) + return iq.send(callback=callback, timeout=timeout) def _handle_get_vcard(self, iq): if iq['type'] == 'result': diff --git a/slixmpp/plugins/xep_0065/proxy.py b/slixmpp/plugins/xep_0065/proxy.py index a1c2bc60..766c46cf 100644 --- a/slixmpp/plugins/xep_0065/proxy.py +++ b/slixmpp/plugins/xep_0065/proxy.py @@ -92,7 +92,7 @@ class XEP_0065(BasePlugin): self.xmpp.event('stream:%s:%s' % (sid, to), socket) return socket - def request_stream(self, to, sid=None, ifrom=None, block=True, timeout=None, callback=None): + def request_stream(self, to, sid=None, ifrom=None, timeout=None, callback=None): if sid is None: sid = uuid4().hex @@ -107,7 +107,7 @@ class XEP_0065(BasePlugin): iq['socks']['sid'] = sid for proxy, (host, port) in self._proxies.items(): iq['socks'].add_streamhost(proxy, host, port) - return iq.send(block=block, timeout=timeout, callback=callback) + return iq.send(timeout=timeout, callback=callback) def discover_proxies(self, jid=None, ifrom=None, timeout=None): """Auto-discover the JIDs of SOCKS5 proxies on an XMPP server.""" @@ -143,11 +143,11 @@ class XEP_0065(BasePlugin): return self._proxies - def get_network_address(self, proxy, ifrom=None, block=True, timeout=None, callback=None): + def get_network_address(self, proxy, ifrom=None, timeout=None, callback=None): """Get the network information of a proxy.""" iq = self.xmpp.Iq(sto=proxy, stype='get', sfrom=ifrom) iq.enable('socks') - return iq.send(block=block, timeout=timeout, callback=callback) + return iq.send(timeout=timeout, callback=callback) def _handle_streamhost(self, iq): """Handle incoming SOCKS5 session request.""" @@ -187,12 +187,12 @@ class XEP_0065(BasePlugin): self.xmpp.event('socks5_stream', conn) self.xmpp.event('stream:%s:%s' % (sid, conn.peer_jid), conn) - def activate(self, proxy, sid, target, ifrom=None, block=True, timeout=None, callback=None): + def activate(self, proxy, sid, target, ifrom=None, timeout=None, callback=None): """Activate the socks5 session that has been negotiated.""" iq = self.xmpp.Iq(sto=proxy, stype='set', sfrom=ifrom) iq['socks']['sid'] = sid iq['socks']['activate'] = target - iq.send(block=block, timeout=timeout, callback=callback) + iq.send(timeout=timeout, callback=callback) def deactivate(self, sid): """Closes the proxy socket associated with this SID.""" diff --git a/slixmpp/plugins/xep_0077/register.py b/slixmpp/plugins/xep_0077/register.py index 133f025a..eb2e7443 100644 --- a/slixmpp/plugins/xep_0077/register.py +++ b/slixmpp/plugins/xep_0077/register.py @@ -81,26 +81,25 @@ class XEP_0077(BasePlugin): return True return False - def get_registration(self, jid=None, ifrom=None, block=True, + def get_registration(self, jid=None, ifrom=None, timeout=None, callback=None): iq = self.xmpp.Iq() iq['type'] = 'get' iq['to'] = jid iq['from'] = ifrom iq.enable('register') - return iq.send(block=block, timeout=timeout, - callback=callback) + return iq.send(timeout=timeout, callback=callback) - def cancel_registration(self, jid=None, ifrom=None, block=True, + def cancel_registration(self, jid=None, ifrom=None, timeout=None, callback=None): iq = self.xmpp.Iq() iq['type'] = 'set' iq['to'] = jid iq['from'] = ifrom iq['register']['remove'] = True - return iq.send(block=block, timeout=timeout, callback=callback) + return iq.send(timeout=timeout, callback=callback) - def change_password(self, password, jid=None, ifrom=None, block=True, + def change_password(self, password, jid=None, ifrom=None, timeout=None, callback=None): iq = self.xmpp.Iq() iq['type'] = 'set' @@ -112,4 +111,4 @@ class XEP_0077(BasePlugin): else: iq['register']['username'] = self.xmpp.boundjid.user iq['register']['password'] = password - return iq.send(block=block, timeout=timeout, callback=callback) + return iq.send(timeout=timeout, callback=callback) diff --git a/slixmpp/plugins/xep_0080/geoloc.py b/slixmpp/plugins/xep_0080/geoloc.py index 320bb958..3f0285bd 100644 --- a/slixmpp/plugins/xep_0080/geoloc.py +++ b/slixmpp/plugins/xep_0080/geoloc.py @@ -76,8 +76,6 @@ class XEP_0080(BasePlugin): options -- Optional form of publish options. ifrom -- Specify the sender's JID. - block -- Specify if the send call 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 exiting the send call if blocking is used. Defaults to slixmpp.xmlstream.RESPONSE_TIMEOUT @@ -86,7 +84,6 @@ class XEP_0080(BasePlugin): """ options = kwargs.get('options', None) ifrom = kwargs.get('ifrom', None) - block = kwargs.get('block', None) callback = kwargs.get('callback', None) timeout = kwargs.get('timeout', None) for param in ('ifrom', 'block', 'callback', 'timeout', 'options'): @@ -99,18 +96,15 @@ class XEP_0080(BasePlugin): return self.xmpp['xep_0163'].publish(geoloc, options=options, ifrom=ifrom, - block=block, callback=callback, timeout=timeout) - def stop(self, ifrom=None, block=True, callback=None, timeout=None): + def stop(self, ifrom=None, callback=None, timeout=None): """ Clear existing user location information to stop notifications. Arguments: ifrom -- Specify the sender's JID. - block -- Specify if the send call 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 exiting the send call if blocking is used. Defaults to slixmpp.xmlstream.RESPONSE_TIMEOUT @@ -120,6 +114,5 @@ class XEP_0080(BasePlugin): geoloc = Geoloc() return self.xmpp['xep_0163'].publish(geoloc, ifrom=ifrom, - block=block, callback=callback, timeout=timeout) diff --git a/slixmpp/plugins/xep_0084/avatar.py b/slixmpp/plugins/xep_0084/avatar.py index 7f8eba58..2bae765a 100644 --- a/slixmpp/plugins/xep_0084/avatar.py +++ b/slixmpp/plugins/xep_0084/avatar.py @@ -44,27 +44,25 @@ class XEP_0084(BasePlugin): def generate_id(self, data): return hashlib.sha1(data).hexdigest() - def retrieve_avatar(self, jid, id, url=None, ifrom=None, block=True, + def retrieve_avatar(self, jid, id, url=None, ifrom=None, callback=None, timeout=None): return self.xmpp['xep_0060'].get_item(jid, Data.namespace, id, ifrom=ifrom, - block=block, callback=callback, timeout=timeout) - def publish_avatar(self, data, ifrom=None, block=True, callback=None, + def publish_avatar(self, data, ifrom=None, callback=None, timeout=None): payload = Data() payload['value'] = data return self.xmpp['xep_0163'].publish(payload, id=self.generate_id(data), ifrom=ifrom, - block=block, callback=callback, timeout=timeout) def publish_avatar_metadata(self, items=None, pointers=None, - ifrom=None, block=True, + ifrom=None, callback=None, timeout=None): metadata = MetaData() if items is None: @@ -84,18 +82,15 @@ class XEP_0084(BasePlugin): return self.xmpp['xep_0163'].publish(metadata, id=info['id'], ifrom=ifrom, - block=block, callback=callback, timeout=timeout) - def stop(self, ifrom=None, block=True, callback=None, timeout=None): + def stop(self, ifrom=None, callback=None, timeout=None): """ Clear existing avatar metadata information to stop notifications. Arguments: ifrom -- Specify the sender's JID. - block -- Specify if the send call 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 exiting the send call if blocking is used. Defaults to slixmpp.xmlstream.RESPONSE_TIMEOUT @@ -106,6 +101,5 @@ class XEP_0084(BasePlugin): return self.xmpp['xep_0163'].publish(metadata, node=MetaData.namespace, ifrom=ifrom, - block=block, callback=callback, timeout=timeout) diff --git a/slixmpp/plugins/xep_0092/version.py b/slixmpp/plugins/xep_0092/version.py index 9decbabe..9dbdc4e6 100644 --- a/slixmpp/plugins/xep_0092/version.py +++ b/slixmpp/plugins/xep_0092/version.py @@ -70,7 +70,7 @@ class XEP_0092(BasePlugin): iq['software_version']['os'] = self.os iq.send() - def get_version(self, jid, ifrom=None, block=True, timeout=None, callback=None): + def get_version(self, jid, ifrom=None, timeout=None, callback=None): """ Retrieve the software version of a remote agent. @@ -82,4 +82,4 @@ class XEP_0092(BasePlugin): iq['from'] = ifrom iq['type'] = 'get' iq['query'] = Version.namespace - return iq.send(block=block, timeout=timeout, callback=callback) + return iq.send(timeout=timeout, callback=callback) diff --git a/slixmpp/plugins/xep_0095/stream_initiation.py b/slixmpp/plugins/xep_0095/stream_initiation.py index cbf3c3f4..3f909d93 100644 --- a/slixmpp/plugins/xep_0095/stream_initiation.py +++ b/slixmpp/plugins/xep_0095/stream_initiation.py @@ -182,7 +182,6 @@ class XEP_0095(BasePlugin): if stream_handler: self.xmpp.add_event_handler('stream:%s:%s' % (sid, jid), stream_handler, - threaded=True, disposable=True) return iq.send() diff --git a/slixmpp/plugins/xep_0118/user_tune.py b/slixmpp/plugins/xep_0118/user_tune.py index 53eb4582..bfb1762a 100644 --- a/slixmpp/plugins/xep_0118/user_tune.py +++ b/slixmpp/plugins/xep_0118/user_tune.py @@ -35,7 +35,7 @@ class XEP_0118(BasePlugin): def publish_tune(self, artist=None, length=None, rating=None, source=None, title=None, track=None, uri=None, options=None, - ifrom=None, block=True, callback=None, timeout=None): + ifrom=None, callback=None, timeout=None): """ Publish the user's current tune. @@ -49,8 +49,6 @@ class XEP_0118(BasePlugin): uri -- A URL to more information about the song. options -- Optional form of publish options. ifrom -- Specify the sender's JID. - block -- Specify if the send call 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 exiting the send call if blocking is used. Defaults to slixmpp.xmlstream.RESPONSE_TIMEOUT @@ -69,18 +67,15 @@ class XEP_0118(BasePlugin): node=UserTune.namespace, options=options, ifrom=ifrom, - block=block, callback=callback, timeout=timeout) - def stop(self, ifrom=None, block=True, callback=None, timeout=None): + def stop(self, ifrom=None, callback=None, timeout=None): """ Clear existing user tune information to stop notifications. Arguments: ifrom -- Specify the sender's JID. - block -- Specify if the send call 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 exiting the send call if blocking is used. Defaults to slixmpp.xmlstream.RESPONSE_TIMEOUT @@ -91,6 +86,5 @@ class XEP_0118(BasePlugin): return self.xmpp['xep_0163'].publish(tune, node=UserTune.namespace, ifrom=ifrom, - block=block, callback=callback, timeout=timeout) diff --git a/slixmpp/plugins/xep_0133.py b/slixmpp/plugins/xep_0133.py index a38a0fda..a1eb9e02 100644 --- a/slixmpp/plugins/xep_0133.py +++ b/slixmpp/plugins/xep_0133.py @@ -35,15 +35,14 @@ class XEP_0133(BasePlugin): def create_command(name): - def admin_command(self, jid=None, session=None, ifrom=None, block=False): + def admin_command(self, jid=None, session=None, ifrom=None): if jid is None: jid = self.xmpp.boundjid.server self.xmpp['xep_0050'].start_command( jid=jid, node='http://jabber.org/protocol/admin#%s' % name, session=session, - ifrom=ifrom, - block=block) + ifrom=ifrom) return admin_command diff --git a/slixmpp/plugins/xep_0152/reachability.py b/slixmpp/plugins/xep_0152/reachability.py index 07d02b2e..897269ee 100644 --- a/slixmpp/plugins/xep_0152/reachability.py +++ b/slixmpp/plugins/xep_0152/reachability.py @@ -34,7 +34,7 @@ class XEP_0152(BasePlugin): self.xmpp['xep_0163'].register_pep('reachability', Reachability) def publish_reachability(self, addresses, options=None, - ifrom=None, block=True, callback=None, timeout=None): + ifrom=None, callback=None, timeout=None): """ Publish alternative addresses where the user can be reached. @@ -43,8 +43,6 @@ class XEP_0152(BasePlugin): optional description for each address. options -- Optional form of publish options. ifrom -- Specify the sender's JID. - block -- Specify if the send call 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 exiting the send call if blocking is used. Defaults to slixmpp.xmlstream.RESPONSE_TIMEOUT @@ -66,18 +64,15 @@ class XEP_0152(BasePlugin): node=Reachability.namespace, options=options, ifrom=ifrom, - block=block, callback=callback, timeout=timeout) - def stop(self, ifrom=None, block=True, callback=None, timeout=None): + def stop(self, ifrom=None, callback=None, timeout=None): """ Clear existing user activity information to stop notifications. Arguments: ifrom -- Specify the sender's JID. - block -- Specify if the send call 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 exiting the send call if blocking is used. Defaults to slixmpp.xmlstream.RESPONSE_TIMEOUT @@ -88,6 +83,5 @@ class XEP_0152(BasePlugin): return self.xmpp['xep_0163'].publish(reach, node=Reachability.namespace, ifrom=ifrom, - block=block, callback=callback, timeout=timeout) diff --git a/slixmpp/plugins/xep_0153/vcard_avatar.py b/slixmpp/plugins/xep_0153/vcard_avatar.py index c46999e3..e56f84af 100644 --- a/slixmpp/plugins/xep_0153/vcard_avatar.py +++ b/slixmpp/plugins/xep_0153/vcard_avatar.py @@ -59,7 +59,7 @@ class XEP_0153(BasePlugin): self.xmpp.del_event_handler('presence_chat', self._recv_presence) self.xmpp.del_event_handler('presence_away', self._recv_presence) - def set_avatar(self, jid=None, avatar=None, mtype=None, block=True, + def set_avatar(self, jid=None, avatar=None, mtype=None, timeout=None, callback=None): if jid is None: jid = self.xmpp.boundjid.bare diff --git a/slixmpp/plugins/xep_0186/invisible_command.py b/slixmpp/plugins/xep_0186/invisible_command.py index 1a521e78..c20a3a06 100644 --- a/slixmpp/plugins/xep_0186/invisible_command.py +++ b/slixmpp/plugins/xep_0186/invisible_command.py @@ -27,18 +27,18 @@ class XEP_0186(BasePlugin): register_stanza_plugin(Iq, Visible) register_stanza_plugin(Iq, Invisible) - def set_invisible(self, ifrom=None, block=True, callback=None, + def set_invisible(self, ifrom=None, callback=None, timeout=None): iq = self.xmpp.Iq() iq['type'] = 'set' iq['from'] = ifrom iq.enable('invisible') - iq.send(block=block, callback=callback, timeout=timeout) + iq.send(callback=callback, timeout=timeout) - def set_visible(self, ifrom=None, block=True, callback=None, + def set_visible(self, ifrom=None, callback=None, timeout=None): iq = self.xmpp.Iq() iq['type'] = 'set' iq['from'] = ifrom iq.enable('visible') - iq.send(block=block, callback=callback, timeout=timeout) + iq.send(callback=callback, timeout=timeout) diff --git a/slixmpp/plugins/xep_0191/blocking.py b/slixmpp/plugins/xep_0191/blocking.py index 92a5781b..22610d78 100644 --- a/slixmpp/plugins/xep_0191/blocking.py +++ b/slixmpp/plugins/xep_0191/blocking.py @@ -45,14 +45,14 @@ class XEP_0191(BasePlugin): self.xmpp.remove_handler('Blocked Contact') self.xmpp.remove_handler('Unblocked Contact') - def get_blocked(self, ifrom=None, block=True, timeout=None, callback=None): + def get_blocked(self, ifrom=None, timeout=None, callback=None): iq = self.xmpp.Iq() iq['type'] = 'get' iq['from'] = ifrom iq.enable('blocklist') - return iq.send(block=block, timeout=timeout, callback=callback) + return iq.send(timeout=timeout, callback=callback) - def block(self, jids, ifrom=None, block=True, timeout=None, callback=None): + def block(self, jids, ifrom=None, timeout=None, callback=None): iq = self.xmpp.Iq() iq['type'] = 'set' iq['from'] = ifrom @@ -61,9 +61,9 @@ class XEP_0191(BasePlugin): jids = [jids] iq['block']['items'] = jids - return iq.send(block=block, timeout=timeout, callback=callback) + return iq.send(timeout=timeout, callback=callback) - def unblock(self, jids=None, ifrom=None, block=True, timeout=None, callback=None): + def unblock(self, jids=None, ifrom=None, timeout=None, callback=None): iq = self.xmpp.Iq() iq['type'] = 'set' iq['from'] = ifrom @@ -74,7 +74,7 @@ class XEP_0191(BasePlugin): jids = [jids] iq['unblock']['items'] = jids - return iq.send(block=block, timeout=timeout, callback=callback) + return iq.send(timeout=timeout, callback=callback) def _handle_blocked(self, iq): self.xmpp.event('blocked', iq) diff --git a/slixmpp/plugins/xep_0199/ping.py b/slixmpp/plugins/xep_0199/ping.py index a8171105..92962ebe 100644 --- a/slixmpp/plugins/xep_0199/ping.py +++ b/slixmpp/plugins/xep_0199/ping.py @@ -71,8 +71,7 @@ class XEP_0199(BasePlugin): if self.keepalive: self.xmpp.add_event_handler('session_start', - self.enable_keepalive, - threaded=True) + self.enable_keepalive) self.xmpp.add_event_handler('session_end', self.disable_keepalive) @@ -129,8 +128,7 @@ class XEP_0199(BasePlugin): timeout -- Time in seconds to wait for a response. Defaults to self.timeout. callback -- Optional handler to execute when a pong - is received. Useful in conjunction with - the option block=False. + is received. """ if not timeout: timeout = self.timeout diff --git a/slixmpp/plugins/xep_0222.py b/slixmpp/plugins/xep_0222.py index cadb1332..059f4c85 100644 --- a/slixmpp/plugins/xep_0222.py +++ b/slixmpp/plugins/xep_0222.py @@ -40,12 +40,11 @@ class XEP_0222(BasePlugin): return self.xmpp['xep_0060'].set_node_config(None, node, config, ifrom=ifrom, - block=block, callback=callback, timeout=timeout) def store(self, stanza, node=None, id=None, ifrom=None, options=None, - block=True, callback=None, timeout=None): + callback=None, timeout=None): """ Store public data via PEP. @@ -60,8 +59,6 @@ class XEP_0222(BasePlugin): options -- Publish options to use, which will be modified to fit the persistent storage option profile. ifrom -- Specify the sender's JID. - block -- Specify if the send call 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 exiting the send call if blocking is used. Defaults to slixmpp.xmlstream.RESPONSE_TIMEOUT @@ -85,12 +82,11 @@ class XEP_0222(BasePlugin): return self.xmpp['xep_0163'].publish(stanza, node, options=options, ifrom=ifrom, - block=block, callback=callback, timeout=timeout) def retrieve(self, node, id=None, item_ids=None, ifrom=None, - block=True, callback=None, timeout=None): + callback=None, timeout=None): """ Retrieve public data via PEP. @@ -103,8 +99,6 @@ class XEP_0222(BasePlugin): item_ids -- Specify a group of IDs. If id is also specified, it will be included in item_ids. ifrom -- Specify the sender's JID. - block -- Specify if the send call 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 exiting the send call if blocking is used. Defaults to slixmpp.xmlstream.RESPONSE_TIMEOUT @@ -119,7 +113,6 @@ class XEP_0222(BasePlugin): return self.xmpp['xep_0060'].get_items(None, node, item_ids=item_ids, ifrom=ifrom, - block=block, callback=callback, timeout=timeout) diff --git a/slixmpp/plugins/xep_0231/bob.py b/slixmpp/plugins/xep_0231/bob.py index 3c99ae6b..0fb01ca5 100644 --- a/slixmpp/plugins/xep_0231/bob.py +++ b/slixmpp/plugins/xep_0231/bob.py @@ -82,7 +82,7 @@ class XEP_0231(BasePlugin): return cid def get_bob(self, jid=None, cid=None, cached=True, ifrom=None, - block=True, timeout=None, callback=None): + timeout=None, callback=None): if cached: data = self.api['get_bob'](None, None, ifrom, args=cid) if data is not None: @@ -97,7 +97,7 @@ class XEP_0231(BasePlugin): iq['from'] = ifrom iq['type'] = 'get' iq['bob']['cid'] = cid - return iq.send(block=block, timeout=timeout, callback=callback) + return iq.send(timeout=timeout, callback=callback) def del_bob(self, cid): self.api['del_bob'](args=cid) diff --git a/slixmpp/plugins/xep_0258/security_labels.py b/slixmpp/plugins/xep_0258/security_labels.py index 07783b47..2fb048c7 100644 --- a/slixmpp/plugins/xep_0258/security_labels.py +++ b/slixmpp/plugins/xep_0258/security_labels.py @@ -34,11 +34,11 @@ class XEP_0258(BasePlugin): def session_bind(self, jid): self.xmpp['xep_0030'].add_feature(SecurityLabel.namespace) - def get_catalog(self, jid, ifrom=None, block=True, + def get_catalog(self, jid, ifrom=None, callback=None, timeout=None): iq = self.xmpp.Iq() iq['to'] = jid iq['from'] = ifrom iq['type'] = 'get' iq.enable('security_label_catalog') - return iq.send(block=block, callback=callback, timeout=timeout) + return iq.send(callback=callback, timeout=timeout) diff --git a/slixmpp/plugins/xep_0313/mam.py b/slixmpp/plugins/xep_0313/mam.py index eafbfcfd..d1c6b983 100644 --- a/slixmpp/plugins/xep_0313/mam.py +++ b/slixmpp/plugins/xep_0313/mam.py @@ -41,7 +41,7 @@ class XEP_0313(BasePlugin): register_stanza_plugin(stanza.MAM, self.xmpp['xep_0059'].stanza.Set) def retrieve(self, jid=None, start=None, end=None, with_jid=None, ifrom=None, - block=True, timeout=None, callback=None, iterator=False): + timeout=None, callback=None, iterator=False): iq = self.xmpp.Iq() query_id = iq['id'] @@ -60,21 +60,12 @@ class XEP_0313(BasePlugin): if iterator: return self.xmpp['xep_0059'].iterate(iq, 'mam', 'results') - elif not block and callback is not None: - def wrapped_cb(iq): - results = collector.stop() - if iq['type'] == 'result': - iq['mam']['results'] = results - callback(iq) - return iq.send(block=block, timeout=timeout, callback=wrapped_cb) - else: - try: - resp = iq.send(block=block, timeout=timeout, callback=callback) - resp['mam']['results'] = collector.stop() - return resp - except XMPPError as e: - collector.stop() - raise e + def wrapped_cb(iq): + results = collector.stop() + if iq['type'] == 'result': + iq['mam']['results'] = results + callback(iq) + return iq.send(timeout=timeout, callback=wrapped_cb) def set_preferences(self, jid=None, default=None, always=None, never=None, ifrom=None, block=True, timeout=None, callback=None): diff --git a/slixmpp/plugins/xep_0325/control.py b/slixmpp/plugins/xep_0325/control.py index 74e067d1..b4cb8a20 100644 --- a/slixmpp/plugins/xep_0325/control.py +++ b/slixmpp/plugins/xep_0325/control.py @@ -145,7 +145,7 @@ class XEP_0325(BasePlugin): self.test_authenticated_from = "" def post_init(self): - """ Init complete. Register our features in Serivce discovery. """ + """ Init complete. Register our features in Service discovery. """ BasePlugin.post_init(self) self.xmpp['xep_0030'].add_feature(Control.namespace) self.xmpp['xep_0030'].set_items(node=Control.namespace, items=tuple()) |