{% macro avatar(jid, class="is-48x48") %}
{%- if identities is defined -%}
{% set identity = identities.get(jid) %}
{%- if identity and identity.avatar.filename %}
{% else %}
{% set nick = identity.nicknames[0] if identity.nicknames else jid %}
{{nick|first|upper}}
{%- endif -%}
{%- endif -%}
{% endmacro %}