%ents; ]>
XMPP Resources Avatars This specification describes how to publish and retrieve avatars from XMPP resources. &LEGALNOTICE; xxxx ProtoXEP Standard Track Standards Council XMPP Core XEP-0030 XEP-0045 XEP-0054 XEP-0068 XEP-0153 NOT_YET_ASSIGNED Emmanuel Gil Peyrot linkmauve@linkmauve.fr linkmauve@linkmauve.fr Timothée Jaussoin edhelas@movim.eu edhelas@movim.eu 0.0.2 2018-11-03 tj

Generalise to non-MUC resources.

0.0.1 2018-08-21 egp

First draft.

Avatars are small images people often use to identify each other very quickly in chat applications. They are well defined for users, in &xep0084; and &xep0153;, but until now chat rooms and Pubsub nodes all shared a default icon. This extension provides a way for owners to associates an avatar to the XMPP their resources and users to discover that an avatar is associated and display it accordingly.

XMPP services have traditionally allowed owners to set a vCard-temp on a MUC using &xep0054;, this extension tries to keep as much of it as possible so existing applications don’t have to be modified too much.

Some implementations recently chose to advertise those avatars using the existing &xep0153; extension in <presence/>, but it exposed issues in other implementations, and was only available when the user is already present in the room, not before joining it (for example when listing all available rooms).

A future extension superseding this one could define a method based on &xep0084;, with a PubSub service on the room’s bare JID containing the metadata and data nodes. Such a specification should also define a compatibility profile similar to &xep0398; for user avatars, enabling the coexistence of both versions until the present one is deemed obsolete.

This specification SHOULD:

Before trying to use avatars, a client must check that the related service that is hosting the rooms or Pubsub nodes does support them.

]]> ... ]]> ]]> ... ]]>

Before anyone can see an avatar attached to the resource, an owner or some other priviledged entity must publish a vCard-temp containing the avatar’s data, using the protocol defined in &xep0054;.

image/svg+xml PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiI+CiA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9InJlZCIvPgo8L3N2Zz4K ]]> ]]> image/svg+xml PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiI+CiA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9InJlZCIvPgo8L3N2Zz4K ]]> ]]>

There is no other action required on the owner’s end.

If the service doesn’t support support avatars, it must return a service-unavailable error.

]]>

If the user trying to publish an avatar isn’t allowed to do so, the resource must return a forbidden error, see the Security Considerations.

Only owners are allowed to set avatars. ]]>

The resource should then broadcast a notification that the configuration changed to all users present or subscribed.

]]>

For Pubsub nodes, the service broadcast a configuration change to all the subscribed users as described in the section 8.2.5.3 of &xep0060;.

]]>

Setting an empty vCard unpublishes the avatar.

]]>

At any point, whether it is during a join in order to display it in its UI, after having discovered the list of the rooms or Pubsub nodes and to list them with additional information, or when receiving a configuration change notification, a user’s client can discover information about a resource.

]]>

If the resource has had an avatar published, it should advertise it in its 'muc#roominfo' or 'pubsub#meta-data' (see the section 5.4 of &xep0060;) extension form, using the &xep0153; hash computation method.

... http://jabber.org/protocol/muc#roominfo ... a31c4bd04de69663cfd7f424a8453f4674da37ff ... ]]> http://jabber.org/protocol/pubsub#meta-data ... a31c4bd04de69663cfd7f424a8453f4674da37ff ... ]]>

This 'muc#roominfo_avatarhash' or 'pubsubmuc#meta-data_avatarhash' are not present when the resource doesn’t have an avatar set.

At this point the client knows the hash and can retrieve the resource's vCard-temp.

]]> image/svg+xml PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiI+CiA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9InJlZCIvPgo8L3N2Zz4K ]]>

To retrieve the vCard-temp of a Pubsub node the client is then doing a specific request on the Node metadata (see the section 5.4 of &xep0060;).

]]> image/svg+xml PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiI+CiA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9InJlZCIvPgo8L3N2Zz4K ]]>

The client then has to decode the <BINVAL/> content from base64, hash it with sha1 and compare it with the advertised hash, and if it matches uses it as the resource avatar under the <TYPE/> media type.

An application MUST support the image/png media type, SHOULD support image/jpeg, image/gif and image/svg+xml, and MAY support additional formats.

A room or a Pubsub node SHOULD NOT include a 'muc#roominfo_avatarhash' or 'pubsubmuc#meta-data_avatarhash' field if it doesn’t have an avatar set.

Multiple <PHOTO/> elements may be present in a vCard, in which case they should all represent the same image and the hash field must contain a hash of all of them.

image/svg+xml PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiI+CiA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9InJlZCIvPgo8L3N2Zz4K image/png iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAAB3RJTUUH4ggVERoVAPsrMgAAAAlwSFlzAAALEgAACxIB0t1+/AAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAAEZ0FNQQAAsY8L/GEFAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAGUExURf8AAP///0EdNBEAAAABYktHRAH/Ai3eAAAADElEQVQI12NgGNwAAACgAAFhJX1HAAAAAElFTkSuQmCC ]]> ... http://jabber.org/protocol/muc#roominfo ... a31c4bd04de69663cfd7f424a8453f4674da37ff b9b256f999ded52c2fa14fb007c2e5b979450cbb ... ]]>

Some existing implementations send or expect a presence from the room’s bare JID in order to detect an avatar being published. This had several issues, with existing clients handling that as a presence from a user with an empty nick or downright triggering an error, and was only available if the client was already present in the room, preventing any usecase where it would get displayed before entering the room.

For those reasons, this XEP doesn’t encourage this way of advertising the presence of an avatar, but for reference it would look like a &xep0153; presence payload:

a31c4bd04de69663cfd7f424a8453f4674da37ff ]]>

A server should take care that only allowed entities can publish a vCard-temp on a MUC, for instance room owners or service administrators.

This document requires no interaction with &IANA;.

The registrar shall add the following field to the 'muc#roominfo' data form:

http://jabber.org/protocol/muc#roominfo XEP-XXXX Form extension for avatar support in a Multi-User Chat (MUC) room. ]]> http://jabber.org/protocol/pubsub#meta-data XEP-XXXX Form extension for avatar support in a Pubsub node. ]]>

Thanks to the Ejabberd developers for their MUC vCard tutorial, and to Sam Whited and Matthew Wild for their feedback.