# HG changeset patch # User Goffi # Date 1384526095 -3600 # Node ID 533d68585866d588e867cf8ae7209bfbe105fcb1 # Parent a20815c75c156aa59a2fef3560f715c9e2cafe25 browser side: if 'xhtml' key is present in microblog data, rich content is displayed diff -r a20815c75c15 -r 533d68585866 browser_side/panels.py --- a/browser_side/panels.py Fri Nov 15 15:06:47 2013 +0100 +++ b/browser_side/panels.py Fri Nov 15 15:34:55 2013 +0100 @@ -234,9 +234,9 @@ if target_hook: parsed_txt, data = target_hook if _type == "PUBLIC": - self.host.bridge.call("sendMblog", None, "PUBLIC", None, parsed_txt) + self.host.bridge.call("sendMblog", None, "PUBLIC", None, parsed_txt, {}) elif _type == "GROUP": - self.host.bridge.call("sendMblog", None, "GROUP", data, parsed_txt) + self.host.bridge.call("sendMblog", None, "GROUP", data, parsed_txt, {}) elif _type == "STATUS": self.host.bridge.call('setStatus', None, parsed_txt) else: @@ -305,6 +305,7 @@ self.id = data['id'] self.type = data.get('type', 'main_item') self.content = data['content'] + self.xhtml = data.get('xhtml') self.author = data['author'] self.timestamp = float(data.get('timestamp', 0)) # XXX: int doesn't work here self.comments = data.get('comments', False) @@ -337,11 +338,11 @@
on
-

%(body)s

+
%(body)s
""" % {"author": html_sanitize(self.author), "timestamp": _datetime, - "body": addURLToText(html_sanitize(mblog_entry.content)) + "body": addURLToText(html_sanitize(mblog_entry.content)) if not mblog_entry.xhtml else mblog_entry.xhtml }) self.avatar = Image(blog_panel.host.getAvatar(self.author)) self.panel.add(self.avatar, "id_avatar") @@ -442,11 +443,11 @@ self.host.bridge.call("sendMblogComment", None, comments_node, text) elif not self._accepted_groups: # we are entering a public microblog - self.host.bridge.call("sendMblog", None, "PUBLIC", None, text) + self.host.bridge.call("sendMblog", None, "PUBLIC", None, text, {}) else: # we are entering a microblog restricted to a group # FIXME: manage several groups - self.host.bridge.call("sendMblog", None, "GROUP", self._accepted_groups[0], text) + self.host.bridge.call("sendMblog", None, "GROUP", self._accepted_groups[0], text, {}) def accept_all(self): return not self._accepted_groups # we accept every microblog only if we are not filtering by groups @@ -748,7 +749,7 @@ def onTextEntered(self, text): mess_type = "groupchat" if self.type == 'group' else "chat" - self.host.bridge.call('sendMessage', None, str(self.target), text, '', mess_type) + self.host.bridge.call('sendMessage', None, str(self.target), text, '', mess_type, {}) self.state_machine._onEvent("active") def onQuit(self):