summaryrefslogtreecommitdiff
path: root/sleekxmpp/clientxmpp.py
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/clientxmpp.py')
-rw-r--r--sleekxmpp/clientxmpp.py29
1 files changed, 11 insertions, 18 deletions
diff --git a/sleekxmpp/clientxmpp.py b/sleekxmpp/clientxmpp.py
index 2019b239..0328e393 100644
--- a/sleekxmpp/clientxmpp.py
+++ b/sleekxmpp/clientxmpp.py
@@ -66,7 +66,7 @@ class ClientXMPP(BaseXMPP):
when calling register_plugins.
escape_quotes -- Deprecated.
"""
- BaseXMPP.__init__(self, 'jabber:client')
+ BaseXMPP.__init__(self, jid, 'jabber:client')
self.set_jid(jid)
self.password = password
@@ -230,15 +230,8 @@ class ClientXMPP(BaseXMPP):
Will be executed when the roster is received.
Implies block=False.
"""
- iq = self.Iq()
- iq['type'] = 'set'
- iq['roster']['items'] = {jid: {'name': name,
- 'subscription': subscription,
- 'groups': groups}}
- response = iq.send(block, timeout, callback)
- if response in [False, None] or not isinstance(response, Iq):
- return response
- return response['type'] == 'result'
+ return self.client_roster.updtae(jid, name, subscription, groups,
+ block, timeout, callback)
def del_roster_item(self, jid):
"""
@@ -248,7 +241,7 @@ class ClientXMPP(BaseXMPP):
Arguments:
jid -- The JID of the item to remove.
"""
- return self.update_roster(jid, subscription='remove')
+ return self.client_roster.remove(jid)
def get_roster(self, block=True, timeout=None, callback=None):
"""
@@ -463,13 +456,13 @@ class ClientXMPP(BaseXMPP):
"""
if iq['type'] == 'set' or (iq['type'] == 'result' and request):
for jid in iq['roster']['items']:
- if not jid in self.roster:
- self.roster[jid] = {'groups': [],
- 'name': '',
- 'subscription': 'none',
- 'presence': {},
- 'in_roster': True}
- self.roster[jid].update(iq['roster']['items'][jid])
+ item = iq['roster']['items'][jid]
+ roster = self.roster[iq['to'].bare]
+ roster[jid]['name'] = item['name']
+ roster[jid]['groups'] = item['groups']
+ roster[jid]['from'] = item['subscription'] in ['from', 'both']
+ roster[jid]['to'] = item['subscription'] in ['to', 'both']
+ roster[jid]['pending_out'] = (item['ask'] == 'subscribe')
self.event('roster_received', iq)
self.event("roster_update", iq)