summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0071
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2013-01-26 15:10:06 -0800
committerLance Stout <lancestout@gmail.com>2013-01-26 15:15:01 -0800
commit23f112602c35440ca7a43cfd1efb0d3e15220a02 (patch)
treedb37cbc19a3a2d56b85ca9ee3ce17e5b78e6e111 /sleekxmpp/plugins/xep_0071
parent639a3aa8327068bdfce3ffb72fd6ac2f058fea69 (diff)
downloadslixmpp-23f112602c35440ca7a43cfd1efb0d3e15220a02.tar.gz
slixmpp-23f112602c35440ca7a43cfd1efb0d3e15220a02.tar.bz2
slixmpp-23f112602c35440ca7a43cfd1efb0d3e15220a02.tar.xz
slixmpp-23f112602c35440ca7a43cfd1efb0d3e15220a02.zip
Get tests to pass again.
Re-add old gmail_notify plugin for now.
Diffstat (limited to 'sleekxmpp/plugins/xep_0071')
-rw-r--r--sleekxmpp/plugins/xep_0071/stanza.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/sleekxmpp/plugins/xep_0071/stanza.py b/sleekxmpp/plugins/xep_0071/stanza.py
index 77957541..a5cedda3 100644
--- a/sleekxmpp/plugins/xep_0071/stanza.py
+++ b/sleekxmpp/plugins/xep_0071/stanza.py
@@ -26,13 +26,20 @@ class XHTML_IM(ElementBase):
if lang is None:
lang = self.get_lang()
self.del_body(lang)
- content = str(content)
- header = '<body xmlns="%s"' % XHTML_NS
- if lang:
- header = '%s xml:lang="%s"' % (header, lang)
- content = '%s>%s</body>' % (header, content)
- xhtml = ET.fromstring(content)
- self.xml.append(xhtml)
+ if lang == '*':
+ for sublang, subcontent in content.items():
+ self.set_body(subcontent, sublang)
+ else:
+ if isinstance(content, type(ET.Element('test'))):
+ content = ET.tostring(content)
+ else:
+ content = str(content)
+ header = '<body xmlns="%s"' % XHTML_NS
+ if lang:
+ header = '%s xml:lang="%s"' % (header, lang)
+ content = '%s>%s</body>' % (header, content)
+ xhtml = ET.fromstring(content)
+ self.xml.append(xhtml)
def get_body(self, lang=None):
"""Return the contents of the HTML body."""