Support file messages & fix plain text

This commit is contained in:
David Baker 2016-04-28 16:59:57 +01:00
parent 4845c7359d
commit 68f8fc2f14
2 changed files with 6 additions and 7 deletions

View File

@ -18,13 +18,11 @@
<div class="message_time">{{ message.ts|format_ts("%H:%M") }}</div> <div class="message_time">{{ message.ts|format_ts("%H:%M") }}</div>
<div class="message_body"> <div class="message_body">
{% if message.msgtype == "m.text" %} {% if message.msgtype == "m.text" %}
{% if message.format == "org.matrix.custom.html" %} {{ message.body_text_html }}
{{ message.body_text_html }}
{% else %}
{{ message.body_text_plain }}
{% endif %}
{% elif message.msgtype == "m.image" %} {% elif message.msgtype == "m.image" %}
<img src="{{ message.image_url|mxc_to_http(640, 480, scale) }}" /> <img src="{{ message.image_url|mxc_to_http(640, 480, scale) }}" />
{% elif message.msgtype == "m.file" %}
<span class="filename">{{ message.body_text_plain }}</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@ -222,8 +222,9 @@ class Mailer(object):
self.add_text_message_vars(ret, event) self.add_text_message_vars(ret, event)
elif event.content["msgtype"] == "m.image": elif event.content["msgtype"] == "m.image":
self.add_image_message_vars(ret, event) self.add_image_message_vars(ret, event)
else:
return None if "body" in event.content:
ret["body_text_plain"] = event.content["body"]
return ret return ret