diff options
author | Lance Stout <lancestout@gmail.com> | 2012-07-27 15:51:35 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-07-27 15:51:35 -0700 |
commit | 54656b331a48b6bac140fcd90b88ab21e3bd67a4 (patch) | |
tree | 4009e1f11bb61eee86255630d51c2e4be368edd3 | |
parent | 9047b627a4f165986af5d0f42f3379b198833802 (diff) | |
download | slixmpp-54656b331a48b6bac140fcd90b88ab21e3bd67a4.tar.gz slixmpp-54656b331a48b6bac140fcd90b88ab21e3bd67a4.tar.bz2 slixmpp-54656b331a48b6bac140fcd90b88ab21e3bd67a4.tar.xz slixmpp-54656b331a48b6bac140fcd90b88ab21e3bd67a4.zip |
Restrict caps updates to available presences (not subscriptions, etc).
-rw-r--r-- | sleekxmpp/plugins/xep_0115/caps.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sleekxmpp/plugins/xep_0115/caps.py b/sleekxmpp/plugins/xep_0115/caps.py index 15ddb283..5130cc98 100644 --- a/sleekxmpp/plugins/xep_0115/caps.py +++ b/sleekxmpp/plugins/xep_0115/caps.py @@ -104,12 +104,17 @@ class XEP_0115(BasePlugin): self.xmpp['xep_0030'].add_feature(stanza.Capabilities.namespace) def _filter_add_caps(self, stanza): - if isinstance(stanza, Presence) and self.broadcast: - ver = self.get_verstring(stanza['from']) - if ver: - stanza['caps']['node'] = self.caps_node - stanza['caps']['hash'] = self.hash - stanza['caps']['ver'] = ver + if not isinstance(stanza, Presence) or not self.broadcast: + return stanza + + if stanza['type'] not in ('available', 'chat', 'away', 'dnd', 'xa'): + return stanza + + ver = self.get_verstring(stanza['from']) + if ver: + stanza['caps']['node'] = self.caps_node + stanza['caps']['hash'] = self.hash + stanza['caps']['ver'] = ver return stanza def _handle_caps(self, presence): |