# Slixmpp: The Slick XMPP Library # Copyright (C) 2012 Nathanael C. Fritz # This file is part of Slixmpp. # See the file LICENSE for copying permission. from slixmpp.stanza import Message from slixmpp.util import unicode from slixmpp.xmlstream import ElementBase, ET, register_stanza_plugin, tostring XHTML_NS = 'http://www.w3.org/1999/xhtml' class XHTML_IM(ElementBase): namespace = 'http://jabber.org/protocol/xhtml-im' name = 'html' interfaces = {'body'} lang_interfaces = {'body'} plugin_attrib = name def set_body(self, content, lang=None): if lang is None: lang = self.get_lang() self.del_body(lang) if lang == '*': for sublang, subcontent in content.items(): self.set_body(subcontent, sublang) else: if isinstance(content, type(ET.Element('test'))): content = unicode(ET.tostring(content)) else: content = unicode(content) header = '