summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2014-08-17 17:20:45 -0700
committerLance Stout <lancestout@gmail.com>2014-08-17 17:20:45 -0700
commit09cdbf1b76c6bf30e585a910f0f59d533c8dec21 (patch)
treed32011f02f648de9ba2d5ea99d5af1daefecbaf9
parentca306e7cecee4bf7afd9ce44f5f067b305928682 (diff)
parent7265682a4d57d88956cb54f98f7a470465bbf417 (diff)
downloadslixmpp-09cdbf1b76c6bf30e585a910f0f59d533c8dec21.tar.gz
slixmpp-09cdbf1b76c6bf30e585a910f0f59d533c8dec21.tar.bz2
slixmpp-09cdbf1b76c6bf30e585a910f0f59d533c8dec21.tar.xz
slixmpp-09cdbf1b76c6bf30e585a910f0f59d533c8dec21.zip
Merge pull request #308 from Mayflower/develop
Serialize JID to allow json serializing
-rw-r--r--sleekxmpp/xmlstream/stanzabase.py5
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py13
2 files changed, 11 insertions, 7 deletions
diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py
index 97107098..c6ed4163 100644
--- a/sleekxmpp/xmlstream/stanzabase.py
+++ b/sleekxmpp/xmlstream/stanzabase.py
@@ -565,7 +565,10 @@ class ElementBase(object):
values = {}
values['lang'] = self['lang']
for interface in self.interfaces:
- values[interface] = self[interface]
+ if isinstance(self[interface], JID):
+ values[interface] = self[interface].jid
+ else:
+ values[interface] = self[interface]
if interface in self.lang_interfaces:
values['%s|*' % interface] = self['%s|*' % interface]
for plugin, stanza in self.plugins.items():
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index a871238a..01787b5e 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -938,12 +938,13 @@ class XMLStream(object):
self.whitespace_keepalive_interval = 300
"""
- self.schedule('Whitespace Keepalive',
- self.whitespace_keepalive_interval,
- self.send_raw,
- args=(' ',),
- kwargs={'now': True},
- repeat=True)
+ if self.whitespace_keepalive:
+ self.schedule('Whitespace Keepalive',
+ self.whitespace_keepalive_interval,
+ self.send_raw,
+ args=(' ',),
+ kwargs={'now': True},
+ repeat=True)
def _remove_schedules(self, event):
"""Remove whitespace keepalive and certificate expiration schedules."""