summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/xmlstream.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-06-05 16:54:26 -0700
committerLance Stout <lancestout@gmail.com>2012-06-18 22:00:33 -0700
commit181aea737d5bce9479795b58c29b5a92da3bd48b (patch)
tree75fed30d668542593e12a208bc88775c19d6d6b6 /sleekxmpp/xmlstream/xmlstream.py
parentee702f40710219290508f95ac01df50a96d04f3c (diff)
downloadslixmpp-181aea737d5bce9479795b58c29b5a92da3bd48b.tar.gz
slixmpp-181aea737d5bce9479795b58c29b5a92da3bd48b.tar.bz2
slixmpp-181aea737d5bce9479795b58c29b5a92da3bd48b.tar.xz
slixmpp-181aea737d5bce9479795b58c29b5a92da3bd48b.zip
Add initial support for xml:lang for streams and stanza plugins.
Remaining items are suitable default actions for language supporting interfaces.
Diffstat (limited to 'sleekxmpp/xmlstream/xmlstream.py')
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 40ae38c9..14c13e72 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -223,6 +223,9 @@ class XMLStream(object):
#: stream wrapper itself.
self.default_ns = ''
+ self.default_lang = None
+ self.peer_default_lang = None
+
#: The namespace of the enveloping stream element.
self.stream_ns = ''
@@ -1431,6 +1434,10 @@ class XMLStream(object):
if depth == 0:
# We have received the start of the root element.
root = xml
+ log.debug('RECV: %s', tostring(root, xmlns=self.default_ns,
+ stream=self,
+ top_level=True,
+ open_only=True))
# Perform any stream initialization actions, such
# as handshakes.
self.stream_end_event.clear()
@@ -1478,6 +1485,8 @@ class XMLStream(object):
stanza_type = stanza_class
break
stanza = stanza_type(self, xml)
+ if stanza['lang'] is None and self.peer_default_lang:
+ stanza['lang'] = self.peer_default_lang
return stanza
def __spawn_event(self, xml):