Fix some more blocking iq

This commit is contained in:
Florent Le Coz 2014-08-01 15:02:54 +02:00
parent fa21e262c7
commit 07e46837d9
3 changed files with 12 additions and 15 deletions

View file

@ -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.

View file

@ -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)

View file

@ -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):
"""