summaryrefslogtreecommitdiff
path: root/sleekxmpp/roster
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-06-16 16:09:15 -0700
committerLance Stout <lancestout@gmail.com>2011-06-16 16:09:15 -0700
commitce145b04ac21a90e77fccf3239142d8500713b80 (patch)
tree76b907ba8f308fd0d627d59e8ce8834f11ce6d41 /sleekxmpp/roster
parent29d775e6756e7d8028438942ca2d34d1c39c559f (diff)
downloadslixmpp-ce145b04ac21a90e77fccf3239142d8500713b80.tar.gz
slixmpp-ce145b04ac21a90e77fccf3239142d8500713b80.tar.bz2
slixmpp-ce145b04ac21a90e77fccf3239142d8500713b80.tar.xz
slixmpp-ce145b04ac21a90e77fccf3239142d8500713b80.zip
Integrate roster with ClientXMPP.
Roster updates are now passed through to the roster when using self.update_roster, etc.
Diffstat (limited to 'sleekxmpp/roster')
-rw-r--r--sleekxmpp/roster/single.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/sleekxmpp/roster/single.py b/sleekxmpp/roster/single.py
index 6833563f..a8bb8d3a 100644
--- a/sleekxmpp/roster/single.py
+++ b/sleekxmpp/roster/single.py
@@ -171,9 +171,10 @@ class RosterNode(object):
"""
self[jid].remove()
if not self.xmpp.is_component:
- self.update(jid, subscription='remove')
+ return self.update(jid, subscription='remove')
- def update(self, jid, name=None, subscription=None, groups=[]):
+ def update(self, jid, name=None, subscription=None, groups=[],
+ block=True, timeout=None, callback=None):
"""
Update a JID's subscription information.
@@ -183,6 +184,15 @@ 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'] = group
@@ -194,7 +204,9 @@ class RosterNode(object):
iq['roster']['items'] = {jid: {'name': name,
'subscription': subscription,
'groups': groups}}
- response = iq.send()
+ response = iq.send(block, timeout, callback)
+ if response in [False, None] or isinstance(response, Iq):
+ return response
return response and response['type'] == 'result'
def presence(self, jid, resource=None):