summaryrefslogtreecommitdiff
path: root/sleekxmpp/roster
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-01-11 16:39:55 -0800
committerLance Stout <lancestout@gmail.com>2012-01-11 16:39:55 -0800
commitc0074f95b160f4766168ed2cae955709bf38d124 (patch)
treea81d265d3aedb235d65be59f1fdea173c42818cd /sleekxmpp/roster
parenta79ce1c35e041c168af72f051829c5576713a186 (diff)
downloadslixmpp-c0074f95b160f4766168ed2cae955709bf38d124.tar.gz
slixmpp-c0074f95b160f4766168ed2cae955709bf38d124.tar.bz2
slixmpp-c0074f95b160f4766168ed2cae955709bf38d124.tar.xz
slixmpp-c0074f95b160f4766168ed2cae955709bf38d124.zip
update_caps() can now do presence broadcasting.
As part of adding this feature: - fixed bug in update_caps() not assigning verstrings - fixed xep_0004 typo - can now use None as a roster key which will map to boundjid.bare - fixed using JID objects in disco node handlers - fixed failing test related to get_roster Several of these bugs I've fixed before, so I either didn't push them earlier, or I clobbered something when merging. *shrug*
Diffstat (limited to 'sleekxmpp/roster')
-rw-r--r--sleekxmpp/roster/multi.py2
-rw-r--r--sleekxmpp/roster/single.py11
2 files changed, 13 insertions, 0 deletions
diff --git a/sleekxmpp/roster/multi.py b/sleekxmpp/roster/multi.py
index 36c7e2ad..28876814 100644
--- a/sleekxmpp/roster/multi.py
+++ b/sleekxmpp/roster/multi.py
@@ -68,6 +68,8 @@ class Roster(object):
"""
if isinstance(key, JID):
key = key.bare
+ if key is None:
+ key = self.xmpp.boundjid.bare
if key not in self._rosters:
self.add(key)
self._rosters[key].auto_authorize = self.auto_authorize
diff --git a/sleekxmpp/roster/single.py b/sleekxmpp/roster/single.py
index 903333a3..c2f8e763 100644
--- a/sleekxmpp/roster/single.py
+++ b/sleekxmpp/roster/single.py
@@ -286,5 +286,16 @@ class RosterNode(object):
self.xmpp.event('sent_presence')
self.xmpp.sentpresence = True
+ def send_last_presence(self):
+ if self.last_status is None:
+ self.send_presence()
+ else:
+ pres = self.last_status
+ if self.xmpp.is_component:
+ pres['from'] = self.jid
+ else:
+ del pres['from']
+ pres.send()
+
def __repr__(self):
return repr(self._jids)