{% set message = result.data.messages.get(mid) %}{% set message_errors = (result.errors or {}).get(mid) %}{% set metadata = result.data.metadata[mid] %}{% set thread = result.data.threads[metadata.thread_mid] %}{% set conversation_count = thread|length %}{% set cleartext = show_text_part_encryption('none') %}{% set unsigned = show_text_part_signature('none') %}{% set to_cc = metadata.to_aids + metadata.cc_aids %}{% set from = result.data.addresses[metadata.from.aid] %}{% if not from %}{% set from = {'fn': 'Unknown sender', 'email': ''} %}{% endif %}{% set allow_html = (message and message.crypto and ((message.crypto.encryption.status == 'none') or not config.prefs.encrypted_block_html)) %}{% macro msg_url(msg_mid) %}{% set m_metadata = result.data.metadata.get(msg_mid) %}{% if m_metadata and m_metadata.urls.editing: %}{{ m_metadata.urls.editing }}{% elif True: %}{{ U(add_state_query_string(state.command_url, state, { 'url_args_remove': [['view','']], 'url_args_add': [['view', msg_mid]]})) }}{% else: %}{{ m_metadata.urls.thread }}{% endif %}{% endmacro %} {%- if not display_attachments or metadata.body.parts %} {% if message or message_errors %} {%- if previous_mid %}
{%- endif %}
{%- if next_mid %}
{%- endif %} {%- if message.editing_strings %} {%- else %}

{{_("From")}}: {# # FIXME: We are using the From data given to us in the metadata section, # which may differ from the message contents, especially in a # memory-hole substitution world. This needs reworking. #}
    {%- if 0 and is_dev_version() %} {%- if not metadata.from.flags.contact and not metadata.from.flags.profile %}
  • {%- endif %} {%- endif %}
{%- include "partials/pile_email_tags.html" %}

"{{metadata.from.fn}}" <{{metadata.from.address}}>
{%- for txt, which, rcpts in (('To', 'to', get_addresses(message.header_list, "to")), ('CC', 'cc', get_addresses(message.header_list, "cc")), ('BCC', 'bcc', get_addresses(message.header_list, "bcc"))) %} {%- if rcpts %}

{{_(txt)}}:

{%- for ai in rcpts %} "{{ai.fn or ai.address}}" <{{ai.address}}>, {%- endfor %}
{%- endif %} {%- endfor %} {%- if thread|length < 2 %} {%- include "partials/pile_email_hints.html" %} {%- endif %}
{%- endif %} {%- if thread|length > 1 %} {%- include "partials/pile_threading.html" %} {%- endif %} {% else %} {%- if to_cc and display_recipients %} {%- set to1 = result.data.addresses[to_cc[0]] %} 1 %} +{{ to_cc|length -1 }}{% endif %} {%- else %}({{_("unknown")}}){% endif %}"> {%- if conversation_count > 1 %} {%- if to_cc|length > 1 %} {%- else %}{% endif %} {%- else %} {%- endif %}   {%- if to1.fn %}{{ to1.fn|nice_name(28) }}{% else %}(<{{ to1.address }}>){% endif %} {% if to_cc|length > 1 %}+{{ to_cc|length -1 }}{% endif %} {%- else %} 1 %} +{{ to_cc|length -1 }}{% endif %} {%- else %}({{_("unknown")}}){% endif %}"> {%- if metadata.from.fn %}{{ metadata.from.fn|nice_name(28) }}{% else %}({{_("No Name")}}){% endif %} {%- if conversation_count > 1 %}{{conversation_count}}{% endif %} {%- if metadata.flags.replied %}{% else %} {%- if metadata.flags.forwarded %}{% endif %} {%- endif %} {%- endif %} {% endif %} {%- if not message and not message_errors %}
{%- include "partials/pile_email_tags.html" %} {% if metadata.crypto.encryption in ('decrypted', 'mixed-decrypted', 'lockedkey', 'mixed-lockedkey') %} {% elif metadata.crypto.encryption in ('error', 'mixed-error', 'missingkey', 'mixed-missingkey') %} {% endif %} {%- endif %}
{%- if message_errors %} {% include("partials/error_message_missing.html") %} {%- elif not message %} {%- set displayed_atts = [] %} {%- if display_attachments %} {%- for bp in (metadata.body.parts or []) %} {%- set bp = body_part_metadata(bp) %} {%- if bp.mimetype not in ('text/plain', 'text/html') or bp.filename not in ('T', 'H', '', None) %} {%- set fp = bp.filename.split('.') %} {# FIXME! #} {%- if fp|length > 1 %} {{ fp[-1]|upper }} {%- else %} BIN {%- endif %} {%- if fp|length > 1 %} {{ fp[:-1]|join('.') }} {%- else %} {{ bp.filename }} {%- endif %} {% do displayed_atts.append(bp.filename) %} {%- if not loop.last %}
{% endif %} {% endif %} {%- endfor %} {%- if not displayed_atts %} {{_('Oops, no attachments found!')}} {{_('A bug?')}} {{_('Click to view the message.')}} {%- endif %} {%- else %} {{ nice_subject(metadata.subject) }} {%- endif %} {%- else %}
{%- if message.editing_strings %} {% set editing_strings = message.editing_strings %} {% set editing_addresses = result.data.addresses %} {% set attachments = message.attachments %} {% include("partials/compose.html") %} {%- else %}

{{_("Subject")}}:

{%- if allow_html and message.html_parts|length > 0 %} {%- endif %}
{%- set subjects = get_all(message.header_list, "subject") %} {%- if subjects %} {%- for value in subjects %} {{ nice_subject(value) }} {%- endfor %} {%- else %} {{ nice_subject(None) }} {%- endif %}
{%- include('partials/pile_message.html') -%}
{%- endif %} {%- endif %} {{metadata.timestamp|elapsed_datetime}} {% endif %}