summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins
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/plugins
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/plugins')
-rw-r--r--sleekxmpp/plugins/xep_0004/stanza/field.py2
-rw-r--r--sleekxmpp/plugins/xep_0030/disco.py4
-rw-r--r--sleekxmpp/plugins/xep_0115/caps.py24
3 files changed, 25 insertions, 5 deletions
diff --git a/sleekxmpp/plugins/xep_0004/stanza/field.py b/sleekxmpp/plugins/xep_0004/stanza/field.py
index 6814e157..8156997c 100644
--- a/sleekxmpp/plugins/xep_0004/stanza/field.py
+++ b/sleekxmpp/plugins/xep_0004/stanza/field.py
@@ -93,7 +93,7 @@ class FormField(ElementBase):
if valXML.text is None:
valXML.text = ''
values.append(valXML.text)
- if self._type == 'text-multi' and condense:
+ if self._type == 'text-multi' and convert:
values = "\n".join(values)
return values
else:
diff --git a/sleekxmpp/plugins/xep_0030/disco.py b/sleekxmpp/plugins/xep_0030/disco.py
index 10f9ef4e..58f4f20c 100644
--- a/sleekxmpp/plugins/xep_0030/disco.py
+++ b/sleekxmpp/plugins/xep_0030/disco.py
@@ -357,6 +357,7 @@ class xep_0030(base_plugin):
else:
if str(jid) == str(self.xmpp.boundjid):
local = True
+ jid = jid.full
if local or jid in (None, ''):
log.debug("Looking up local disco#info data " + \
@@ -626,6 +627,9 @@ class xep_0030(base_plugin):
node -- The node requested.
data -- Optional, custom data to pass to the handler.
"""
+ if isinstance(jid, JID):
+ jid = jid.full
+
if jid in (None, ''):
if self.xmpp.is_component:
jid = self.xmpp.boundjid.full
diff --git a/sleekxmpp/plugins/xep_0115/caps.py b/sleekxmpp/plugins/xep_0115/caps.py
index d3e62abb..289bb8d1 100644
--- a/sleekxmpp/plugins/xep_0115/caps.py
+++ b/sleekxmpp/plugins/xep_0115/caps.py
@@ -65,10 +65,11 @@ class xep_0115(base_plugin):
self.xmpp.add_event_handler('entity_caps', self._process_caps,
threaded=True)
- self.xmpp.register_feature('caps',
- self._handle_caps_feature,
- restart=False,
- order=10010)
+ if not self.xmpp.is_component:
+ self.xmpp.register_feature('caps',
+ self._handle_caps_feature,
+ restart=False,
+ order=10010)
def post_init(self):
base_plugin.post_init(self)
@@ -256,6 +257,21 @@ class xep_0115(base_plugin):
info=info)
self.cache_caps(ver, info)
self.assign_verstring(jid, ver)
+
+ if self.broadcast:
+ # Check if we've sent directed presence. If we haven't, we
+ # can just send a normal presence stanza. If we have, then
+ # we will send presence to each contact individually so
+ # that we don't clobber existing statuses.
+ directed = False
+ for contact in self.xmpp.roster[jid]:
+ if self.xmpp.roster[jid][contact].last_status is not None:
+ directed = True
+ if not directed:
+ self.xmpp.roster[jid].send_last_presence()
+ else:
+ for contact in self.xmpp.roster[jid]:
+ self.xmpp.roster[jid][contact].send_last_presence()
except XMPPError:
return