summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0071
diff options
context:
space:
mode:
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."""