{% set from = metadata.from %} {% set url_danger = metadata.flags.spam %} {% include("partials/thread_metadata.html") %} {% set encryption_status = [message.crypto.encryption.status] %} {% set signature_status = [message.crypto.signature.status] %}
{#### If no text_part, show html_part } {% if not message.text_parts %} {% for part in message.html_parts %} {% if part.data %} Yay, I am some part.data: {{part.data}} {% else %}
{{_("Message content is empty")}}
{% endif %} {% endfor %} {% endif #####} {% if message.text_parts %} {% set special_text_parts = [] %} {% set last_part = message.text_parts|length - 1 %} {% for part in message.text_parts %} {# Parts that do not have own crypto attribute inherit from message itself # Watch for changes to the "status" which is present in each encryption and # signature section - if either has changed, then we have moved from # one security context to the next, and need to let the user know. #} {% if part.data %} {% set part_encryption = (part.crypto and part.crypto.encryption or message.crypto.encryption) %} {% set part_signature = (part.crypto and part.crypto.signature or message.crypto.signature) %} {% if part_encryption or part_signature %}
{% if part_encryption %} {% if encryption_status and part_encryption.status != encryption_status[-1] %} {% set encryption = show_text_part_encryption(part_encryption.status) %} {{ encryption.text }} {% endif %} {% do encryption_status.append(part_encryption.status) %} {% endif %} {% if part_signature %} {% if signature_status and part_signature.status != signature_status[-1] %} {% set signature = show_text_part_signature(part_signature.status) %} {{ signature.text }} {% endif %} {% do signature_status.append(part_signature.status) %} {% endif %}
{% endif %} {% autoescape false %} {% set part_text = part.data|nice_text|e|urlize|fix_urls(40, url_danger) %} {% if part.type in ("text", "pgpsignedtext") %}
{{ part_text }}
{% elif part.type in ("pgptext",) %} {% if part.crypto.encryption.status in ("lockedkey", "missingkey", "error") %} {%- set failed_crypto = part.crypto.encryption %} {%- include("partials/thread_message_cryptofail.html") %} {% else %}
{{ part_text }}
{% endif %} {% elif part.type in ("pgpbegin", "pgpend") %}
{{part.data}}
{% elif part.type == "quote" %} {# If this is the 2nd-to-last part, and the LAST part is a quote or signature, we shall also hide. #} {%- if loop.index == (loop.length - 1) and message.text_parts[last_part].type in ("signature", "quote") -%} {% do special_text_parts.append("quote") %}
{{ part_text }}
{# If this part is a quote at end of message, hide #} {% elif loop.last %} {% do special_text_parts.append("quote") %}
{{ part_text }}
{% else %}
{{ part_text }}
{%- endif -%} {% elif part.type == "signature" %} {% do special_text_parts.append("signature") %}
{{ part_text }}
{% else %}
{{_("Unknown Text Part")}}
{% endif %} {% endautoescape %} {% endif %} {% endfor %} {% else %} {% if message.crypto.encryption.status in ("lockedkey", "missingkey", "error") %} {%- set failed_crypto = message.crypto.encryption %} {%- include("partials/thread_message_cryptofail.html") %} {% elif not message.attachments %}
{{_("Message content is empty")}}
{% endif %} {% endif %} {% if message.attachments %}
{% endif %}