1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-22 01:02:17 -05:00

Merge pull request #1269 from linkmauve/muc-avatar-historical

Historical ProtoXEP: MUC Avatars
This commit is contained in:
Kevin Smith 2023-02-28 22:34:53 +00:00 committed by GitHub
commit d0dba9ccb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,12 +6,12 @@
<?xml-stylesheet type='text/xsl' href='xep.xsl'?> <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep> <xep>
<header> <header>
<title>XMPP Resources Avatars</title> <title>MUC Avatars</title>
<abstract>This specification describes how to publish and retrieve avatars from XMPP resources.</abstract> <abstract>This specification describes how to publish and retrieve avatars in rooms.</abstract>
&LEGALNOTICE; &LEGALNOTICE;
<number>xxxx</number> <number>xxxx</number>
<status>ProtoXEP</status> <status>ProtoXEP</status>
<type>Standard Track</type> <type>Historical</type>
<sig>Standards</sig> <sig>Standards</sig>
<approver>Council</approver> <approver>Council</approver>
<dependencies> <dependencies>
@ -25,18 +25,13 @@
<supersedes/> <supersedes/>
<supersededby/> <supersededby/>
<shortname>NOT_YET_ASSIGNED</shortname> <shortname>NOT_YET_ASSIGNED</shortname>
<author> &linkmauve;
<firstname>Emmanuel Gil</firstname> <revision>
<surname>Peyrot</surname> <version>0.0.3</version>
<email>linkmauve@linkmauve.fr</email> <date>2023-02-15</date>
<jid>linkmauve@linkmauve.fr</jid> <initials>egp</initials>
</author> <remark><p>Restore to the first revision, and republish to the Historical track.</p></remark>
<author> </revision>
<firstname>Timothée</firstname>
<surname>Jaussoin</surname>
<email>edhelas@movim.eu</email>
<jid>edhelas@movim.eu</jid>
</author>
<revision> <revision>
<version>0.0.2</version> <version>0.0.2</version>
<date>2018-11-03</date> <date>2018-11-03</date>
@ -51,7 +46,7 @@
</revision> </revision>
</header> </header>
<section1 topic='Introduction' anchor='intro'> <section1 topic='Introduction' anchor='intro'>
<p>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.</p> <p>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 all shared a default icon. This extension provides a way for owners to associates an avatar to their chat room, and for users to discover that an avatar is associated and display it accordingly.</p>
<p>XMPP services have traditionally allowed owners to <link url='https://docs.ejabberd.im/tutorials/muc-vcard/'>set a vCard-temp on a MUC</link> using &xep0054;, this extension tries to keep as much of it as possible so existing applications dont have to be modified too much.</p> <p>XMPP services have traditionally allowed owners to <link url='https://docs.ejabberd.im/tutorials/muc-vcard/'>set a vCard-temp on a MUC</link> using &xep0054;, this extension tries to keep as much of it as possible so existing applications dont have to be modified too much.</p>
<p>Some implementations recently chose to advertise those avatars using the existing &xep0153; extension in &lt;presence/&gt;, 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).</p> <p>Some implementations recently chose to advertise those avatars using the existing &xep0153; extension in &lt;presence/&gt;, 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).</p>
<p>A future extension superseding this one could define a method based on &xep0084;, with a PubSub service on the rooms 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.</p> <p>A future extension superseding this one could define a method based on &xep0084;, with a PubSub service on the rooms 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.</p>
@ -59,20 +54,18 @@
<section1 topic='Requirements' anchor='reqs'> <section1 topic='Requirements' anchor='reqs'>
<p>This specification SHOULD:</p> <p>This specification SHOULD:</p>
<ul> <ul>
<li>Allow authorised entities to set an avatar on a MUC, user JID or Pubsub node.</li> <li>Allow authorised entities to set an avatar on a MUC.</li>
<li>Allow authorised entities to remove a previously-set avatar on a MUC, user JID or Pubsub node.</li> <li>Allow authorised entities to remove a previously-set avatar on a MUC.</li>
<li>Allow users to discover an avatar is set on a MUC, user JID or Pubsub node.</li> <li>Allow users to discover an avatar is set on a MUC.</li>
<li>Allow users to request the avatar of a MUC, user JID or Pubsub node.</li> <li>Allow users to request the avatar of a MUC.</li>
<li>Let users know that the avatar of a MUC changed while they are present in said MUC.</li> <li>Let users know that the avatar of a MUC changed while they are present in said MUC.</li>
<li>Let users know that the avatar of a Pubsub node changed while they are subscribed to this node.</li> <li>Let users discover the avatar even when not present in the MUC.</li>
<li>Let users know that the avatar of a user JID changed while they are subscribed to this user.</li> <li>Stay as compatible as possible with the current usage of avatars in MUC.</li>
<li>Let users discover the avatar even when not present in the MUC, user JID or Pubsub node.</li>
<li>Stay as compatible as possible with the current usage of avatars in MUC and user JID.</li>
</ul> </ul>
</section1> </section1>
<section1 topic='Use Cases' anchor='usecases'> <section1 topic='Use Cases' anchor='usecases'>
<section2 topic='Discover the features supported by a service' anchor='disco'> <section2 topic='Discover the features supported by a service' anchor='disco'>
<p>Before trying to use avatars, a client must check that the related service that is hosting the rooms or Pubsub nodes does support them.</p> <p>Before trying to use avatars, a client must check that the group chat service hosting a room does support them.</p>
<example caption='Users client discovers the features of a MUC service'><![CDATA[ <example caption='Users client discovers the features of a MUC service'><![CDATA[
<iq type='get' <iq type='get'
id='p87Ne' id='p87Ne'
@ -95,32 +88,9 @@
... ...
</query> </query>
</iq>]]></example> </iq>]]></example>
<example caption='Users client discovers the features of a Pubsub service'><![CDATA[
<iq type='get'
id='p88Ne'
from='romeo@montague.example.net/garden'
to='pubsub.shakespeare.example.org'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>]]></example>
<example caption='Pubsub service advertises support for vcard-temp'><![CDATA[
<iq type='result'
id='p88Ne'
to='romeo@montague.example.net/garden'
from='chat.shakespeare.example.org'>
<query xmlns='http://jabber.org/protocol/disco#info'>
<identity
category='pubsub'
type='service'
name='Shakespearean Pubsub Service'/>
<feature var='http://jabber.org/protocol/muc'/>
<feature var='vcard-temp'/>
...
</query>
</iq>]]></example>
</section2> </section2>
<section2 topic='Owner of the resource Publishes Avatar' anchor='owner-publish'> <section2 topic='Owner of the Room Publishes Avatar' anchor='owner-publish'>
<p>Before anyone can see an avatar attached to the resource, an owner or some other priviledged entity must publish a vCard-temp containing the avatars data, using the protocol defined in &xep0054;.</p> <p>Before anyone can see an avatar attached to the room, an owner or some other priviledged entity must publish a vCard-temp containing the avatars data, using the protocol defined in &xep0054;.</p>
<example caption='Owners client publishes avatar to the room'><![CDATA[ <example caption='Owners client publishes avatar to the room'><![CDATA[
<iq type='set' <iq type='set'
id='7fP13' id='7fP13'
@ -138,29 +108,8 @@
id='7fP13' id='7fP13'
to='romeo@montague.example.net/garden' to='romeo@montague.example.net/garden'
from='garden@chat.shakespeare.example.org'/>]]></example> from='garden@chat.shakespeare.example.org'/>]]></example>
<example caption='Owners client publishes avatar to the Pubsub node'><![CDATA[
<iq type='set'
id='7fP14'
from='romeo@montague.example.net/garden'
to='pubsub.shakespeare.example.org'>
<configure node='princely_musings'>
<vCard xmlns='vcard-temp'>
<PHOTO>
<TYPE>image/svg+xml</TYPE>
<BINVAL>PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiI+CiA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9InJlZCIvPgo8L3N2Zz4K</BINVAL>
</PHOTO>
</vCard>
</configure>
</iq>]]></example>
<example caption='Pubsub node acknowledges publish action'><![CDATA[
<iq type='result'
id='7fP14'
to='romeo@montague.example.net/garden'
from='pubsub.shakespeare.example.org'/>]]></example>
<p>There is no other action required on the owners end.</p> <p>There is no other action required on the owners end.</p>
<p>If the service doesnt support support avatars, it must return a service-unavailable error.</p> <p>If the room doesnt support support avatars, it must return a service-unavailable error.</p>
<example caption='Room doesnt support vCard-temp'><![CDATA[ <example caption='Room doesnt support vCard-temp'><![CDATA[
<iq type='error' <iq type='error'
id='7fP13' id='7fP13'
@ -170,7 +119,7 @@
<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> <service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error> </error>
</iq>]]></example> </iq>]]></example>
<p>If the user trying to publish an avatar isnt allowed to do so, the resource must return a forbidden error, see the <link url='#security'>Security Considerations</link>.</p> <p>If the user trying to publish an avatar isnt allowed to do so, the room must return a forbidden error, see the <link url='#security'>Security Considerations</link>.</p>
<example caption='User is not allowed to set vCard-temp'><![CDATA[ <example caption='User is not allowed to set vCard-temp'><![CDATA[
<iq type='error' <iq type='error'
id='7fP13' id='7fP13'
@ -181,7 +130,7 @@
<text>Only owners are allowed to set avatars.</text> <text>Only owners are allowed to set avatars.</text>
</error> </error>
</iq>]]></example> </iq>]]></example>
<p>The resource should then broadcast a notification that the configuration changed to all users present or subscribed.</p> <p>The room should then broadcast a notification that the configuration changed to all users present.</p>
<example caption='Room broadcasts a configuration change'><![CDATA[ <example caption='Room broadcasts a configuration change'><![CDATA[
<message type='groupchat' <message type='groupchat'
to='romeo@montague.example.net/garden' to='romeo@montague.example.net/garden'
@ -198,16 +147,6 @@
<status code='104'/> <status code='104'/>
</x> </x>
</message>]]></example> </message>]]></example>
<p>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;.</p>
<example caption='User is not allowed to set vCard-temp'><![CDATA[
<message from='pubsub.shakespeare.lit' to='francisco@denmark.lit' id='foo'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<configuration node='princely_musings'/>
</event>
</message>]]></example>
<p>Setting an empty vCard unpublishes the avatar.</p> <p>Setting an empty vCard unpublishes the avatar.</p>
<example caption='Owners client removes a rooms avatar'><![CDATA[ <example caption='Owners client removes a rooms avatar'><![CDATA[
<iq type='set' <iq type='set'
@ -218,7 +157,7 @@
</iq>]]></example> </iq>]]></example>
</section2> </section2>
<section2 topic='User Discovers the Avatar' anchor='disco-avatar-hash'> <section2 topic='User Discovers the Avatar' anchor='disco-avatar-hash'>
<p>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 users client can discover information about a resource.</p> <p>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 and to list them with additional information, or when receiving a &lt;status code='104'/&gt; configuration change notification, a users client can discover information about a room.</p>
<example caption='Users client discovers information about a room'><![CDATA[ <example caption='Users client discovers information about a room'><![CDATA[
<iq type='get' <iq type='get'
id='K92am' id='K92am'
@ -226,7 +165,7 @@
to='garden@chat.shakespeare.example.org'> to='garden@chat.shakespeare.example.org'>
<query xmlns='http://jabber.org/protocol/disco#info'/> <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>]]></example> </iq>]]></example>
<p>If the resource has had <link url='#owner-publish'>an avatar published</link>, 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.</p> <p>If the room has had <link url='#owner-publish'>an avatar published</link>, it should advertise it in its 'muc#roominfo' extension form, using the &xep0153; hash computation method.</p>
<example caption='Room advertises its avatar hash'><![CDATA[ <example caption='Room advertises its avatar hash'><![CDATA[
<iq type='result' <iq type='result'
id='K92am' id='K92am'
@ -254,35 +193,11 @@
</x> </x>
</query> </query>
</iq>]]></example> </iq>]]></example>
<p>This 'muc#roominfo_avatarhash' will not be present when the room doesnt have an avatar set.</p>
<example caption='Pubsub node advertises its avatar hash'><![CDATA[
<iq type='result'
from='pubsub.shakespeare.lit'
to='francisco@denmark.lit/barracks'
id='meta1'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='princely_musings'>
<identity category='pubsub' type='leaf'/>
<feature var='http://jabber.org/protocol/pubsub'/>
<x xmlns='jabber:x:data' type='result'>
<field var='FORM_TYPE' type='hidden'>
<value>http://jabber.org/protocol/pubsub#meta-data</value>
</field>
...
<field var='pubsub#meta-data_avatarhash'
type='text-multi'
label='Avatar hash'>
<value>a31c4bd04de69663cfd7f424a8453f4674da37ff</value>
</field>
...
</x>
</query>
</iq>]]></example>
<p>This 'muc#roominfo_avatarhash' or 'pubsubmuc#meta-data_avatarhash' are not present when the resource doesnt have an avatar set.</p>
</section2> </section2>
<section2 topic='User Retrieves the vCard' anchor='retrieve-vcard'> <section2 topic='User Retrieves the vCard' anchor='retrieve-vcard'>
<p>At this point the client knows the hash and can retrieve the resource's vCard-temp.</p> <p>At this point the client knows the hash and can retrieve the rooms vCard-temp.</p>
<example caption='Users client retrieves the vCard-temp from a room'><![CDATA[ <example caption='Users client retrieves the vCard-temp'><![CDATA[
<iq type='get' <iq type='get'
id='uD10h' id='uD10h'
from='juliet@capulet.example.com/balcony' from='juliet@capulet.example.com/balcony'
@ -301,44 +216,16 @@
</PHOTO> </PHOTO>
</vCard> </vCard>
</iq>]]></example> </iq>]]></example>
<p>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;).</p> <p>The client then has to decode the &lt;BINVAL/&gt; content from base64, hash it with sha1 and compare it with the advertised hash, and if it matches uses it as the room avatar under the &lt;TYPE/&gt; media type.</p>
<example caption='Users client retrieves the vCard-temp from a Pubsub node'><![CDATA[
<iq type='get'
from='francisco@denmark.lit/barracks'
to='pubsub.shakespeare.lit'
id='meta1'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='princely_musings'>
<vCard xmlns='vcard-temp'/>
</query>
</iq>]]></example>
<example caption='Pubsub node returns the vCard-temp containing the avatar'><![CDATA[
<iq type='result'
from='pubsub.shakespeare.lit'
to='francisco@denmark.lit/barracks'
id='meta1'>
<query xmlns='http://jabber.org/protocol/disco#info'
node='princely_musings'>
<vCard xmlns='vcard-temp'>
<PHOTO>
<TYPE>image/svg+xml</TYPE>
<BINVAL>PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiI+CiA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9InJlZCIvPgo8L3N2Zz4K</BINVAL>
</PHOTO>
</vCard>
</query>
</iq>]]></example>
<p>The client then has to decode the &lt;BINVAL/&gt; 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 &lt;TYPE/&gt; media type.</p>
</section2> </section2>
</section1> </section1>
<section1 topic='Business Rules' anchor='rules'> <section1 topic='Business Rules' anchor='rules'>
<p>An application MUST support the image/png media type, SHOULD support image/jpeg, image/gif and image/svg+xml, and MAY support additional formats.</p> <p>An application MUST support the image/png media type, SHOULD support image/jpeg, image/gif and image/svg+xml, and MAY support additional formats.</p>
<p>A room or a Pubsub node SHOULD NOT include a 'muc#roominfo_avatarhash' or 'pubsubmuc#meta-data_avatarhash' field if it doesnt have an avatar set.</p> <p>A room SHOULD NOT include a 'muc#roominfo_avatarhash' field if it doesnt have an avatar set.</p>
</section1> </section1>
<section1 topic='Implementation Notes' anchor='impl'> <section1 topic='Implementation Notes' anchor='impl'>
<section2 topic='Multiple Stored Version of an Avatar' anchor='multiple'> <section2 topic='Multiple Stored Version of an Avatar' anchor='multiple'>
<p>Multiple &lt;PHOTO/&gt; 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.</p> <p>Multiple &lt;PHOTO/&gt; elements may be present in a vCard, in which case they should all represent the same image and the 'muc#roominfo_avatarhash' field must contain a hash of all of them.</p>
<example caption='Owners client publishes avatar in two different formats'><![CDATA[ <example caption='Owners client publishes avatar in two different formats'><![CDATA[
<iq type='set' <iq type='set'
id='7fP13' id='7fP13'
@ -416,19 +303,6 @@
type='text-multi' type='text-multi'
label='Hash of the vCard-temp avatar of this room'/> label='Hash of the vCard-temp avatar of this room'/>
</form_type> </form_type>
]]></code>
</section3>
<section3 topic='pubsub#meta-data FORM_TYPE' anchor='registrar-formtype-roominfo'>
<code caption='Registry Submission'><![CDATA[
<form_type>
<name>http://jabber.org/protocol/pubsub#meta-data</name>
<doc>XEP-XXXX</doc>
<desc>Form extension for avatar support in a Pubsub node.</desc>
<field
var='pubsub#meta-data_avatarhash'
type='text-multi'
label='Hash of the vCard-temp avatar of this node'/>
</form_type>
]]></code> ]]></code>
</section3> </section3>
</section2> </section2>