No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0084.xml 32KB

  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>User Avatar</title>
  10. <abstract>This document defines an XMPP protocol extension for exchanging user avatars, which are small images or icons associated with human users. The protocol specifies payload formats for both avatar metadata and the image data itself. The payload formats are typically transported using the personal eventing profile of XMPP publish-subscribe as specified in XEP-0163.</abstract>
  12. <number>0084</number>
  13. <status>Draft</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <dependencies>
  17. <spec>XMPP Core</spec>
  18. <spec>XEP-0030</spec>
  19. <spec>XEP-0060</spec>
  20. <spec>XEP-0163</spec>
  21. </dependencies>
  22. <supersedes>
  23. <spec>XEP-0008</spec>
  24. <spec>XEP-0153</spec>
  25. </supersedes>
  26. <supersededby/>
  27. <shortname>avatar</shortname>
  28. <schemaloc>
  29. <ns>data</ns>
  30. <url></url>
  31. </schemaloc>
  32. <schemaloc>
  33. <ns>metadata</ns>
  34. <url></url>
  35. </schemaloc>
  36. &stpeter;
  37. &pgmillard;
  38. &temas;
  39. &xvirge;
  40. <revision>
  41. <version>1.1.1</version>
  42. <date>2016-07-09</date>
  43. <initials>XEP Editor: ssw</initials>
  44. <remark><p>Fix namespace in example (thanks to Huan Nguyen for pointing out the error).</p></remark>
  45. </revision>
  46. <revision>
  47. <version>1.1</version>
  48. <date>2008-11-05</date>
  49. <initials>psa</initials>
  50. <remark><p>For consistency with other PEP payload formats, changed stop semantics to use an empty &lt;metadata/&gt; element rather than a &lt;stop/&gt; child element.</p></remark>
  51. </revision>
  52. <revision>
  53. <version>1.0</version>
  54. <date>2007-11-07</date>
  55. <initials>psa</initials>
  56. <remark><p>Per a vote of the XMPP Council, advanced status to Draft; concurrently, the XMPP Registrar issued the urn:xmpp:avatar:data and urn:xmpp:avatar:metadata namespaces.</p></remark>
  57. </revision>
  58. <revision>
  59. <version>0.12</version>
  60. <date>2007-08-31</date>
  61. <initials>psa</initials>
  62. <remark><p>Clarified HTTP publishing; completed copy edit.</p></remark>
  63. </revision>
  64. <revision>
  65. <version>0.11</version>
  66. <date>2007-07-25</date>
  67. <initials>psa</initials>
  68. <remark><p>Removed image size requirements.</p></remark>
  69. </revision>
  70. <revision>
  71. <version>0.10</version>
  72. <date>2007-06-18</date>
  73. <initials>psa</initials>
  74. <remark><p>Changed height and width attributes from required to recommended; updated security considerations to reflect problems with SHA-1; further specified datatypes.</p></remark>
  75. </revision>
  76. <revision>
  77. <version>0.9</version>
  78. <date>2007-02-01</date>
  79. <initials>psa</initials>
  80. <remark><p>Updated to reflect pubsub and PEP changes; added implementation notes about multiple resources and avatar synchronization; modified experimental namespaces to conform to XEP-0053.</p></remark>
  81. </revision>
  82. <revision>
  83. <version>0.8</version>
  84. <date>2006-06-19</date>
  85. <initials>psa</initials>
  86. <remark><p>Updated to reflect pubsub and PEP changes; added implementation notes about multiple resources and avatar synchronization.</p></remark>
  87. </revision>
  88. <revision>
  89. <version>0.7</version>
  90. <date>2006-01-17</date>
  91. <initials>psa</initials>
  92. <remark><p>Updated to use PEP.</p></remark>
  93. </revision>
  94. <revision>
  95. <version>0.6</version>
  96. <date>2005-04-13</date>
  97. <initials>psa</initials>
  98. <remark><p>Major modification per list discussion: specified that metadata may include the same avatar in multiple alternate formats; allowed pointers to third-party avatars not available via pubsub or HTTP; changed pixel size restrictions; specified that bytes, content-type, height, id, and width are required metadata; changed type attribute to content-type; made explicit that URLs can be http: or https: URIs; more fully specified protocol, updated the examples, updated the schemas.</p></remark>
  99. </revision>
  100. <revision>
  101. <version>0.5</version>
  102. <date>2005-03-28</date>
  103. <initials>psa/pgm</initials>
  104. <remark><p>Friendly fork per Council discussion: allowed data to be stored in a pubsub data repository or at a URL accessible via HTTP; also split text into publisher and subscriber use cases, specified requirements, added more examples, etc.</p></remark>
  105. </revision>
  106. <revision>
  107. <version>0.4</version>
  108. <date>2003-05-20</date>
  109. <initials>tjm</initials>
  110. <remark><p>Lessen the image requirements. Include the content type in info.</p></remark>
  111. </revision>
  112. <revision>
  113. <version>0.3</version>
  114. <date>2003-05-08</date>
  115. <initials>tjm</initials>
  116. <remark><p>Drastic change to use two nodes on pubsub, allowing for hash updates independently of the data. This makes client caching much easier. Allow only PNG and MNG currently.</p></remark>
  117. </revision>
  118. <revision>
  119. <version>0.2</version>
  120. <date>2003-05-07</date>
  121. <initials>tjm</initials>
  122. <remark><p>Clarified the use of "current" as the item id. Fixed some example errors. Made the interaction with disco more clear. The reason to use pubsub is made more clear as well.</p></remark>
  123. </revision>
  124. <revision>
  125. <version>0.1</version>
  126. <date>2003-05-07</date>
  127. <initials>tjm</initials>
  128. <remark><p>Initial version.</p></remark>
  129. </revision>
  130. </header>
  131. <section1 topic='Introduction' anchor='intro'>
  132. <p>Many communication applications allow for the association of a small image or icon with a user of that application. Usually, such an "avatar" is not intended to be an accurate picture of the user's actual physical appearance, but rather a representation (often fanciful) of the user's desired self-image or a transient state of the user (such as a mood or activity). This document defines a way to incorporate avatars into current Jabber/XMPP systems by layering this functionality on top of the XMPP &xep0060; extension ("pubsub"), specifically the &xep0163; subset ("PEP"), which is designed for use in the context of XMPP instant messaging and presence systems that conform to &rfc3921;.</p>
  133. <p>The protocol defined herein uses two pubsub nodes: one node for "metadata" about the avatar state (called the "metadata node") and one for the avatar data itself (called the "data node"). This separation of metadata from data conserves bandwidth and enables both the publisher and the subscriber to cache the avatar data. (For example, a user might toggle between two or three avatars, in which case the user's contacts can display a locally cached version of the images without having to retrieve or receive the full image each time.)</p>
  134. <p>This protocol also allows storage of avatar data at a URL accessible via HTTP (see &rfc2616;). <note>By "accessible via HTTP" is meant that the data is available at an http: or https: URI.</note> This can be helpful as a fallback mechanism if a pubsub-aware data repository is not available. It also makes it possible for avatar images to be hosted on public websites (e.g., an end-user-oriented community site) and retrieved from that site rather than handled directly by the publishing client in any fashion.</p>
  135. <p>Finally, this protocol also enables XMPP applications to optionally integrate with third-party services that host user avatars (e.g., online gaming systems and virtual worlds).</p>
  136. <p>It is intended that this specification will supersede both &xep0008; and &xep0153; once the PEP subset of XMPP publish-subscribe is implemented and deployed widely enough.</p>
  137. </section1>
  138. <section1 topic='Requirements' anchor='reqs'>
  139. <p>This document addresses the following use cases for avatar publishers:</p>
  140. <ol>
  141. <li>Publishing avatar data</li>
  142. <li>Updating metadata about the current avatar</li>
  143. <li>Disabling avatars</li>
  144. </ol>
  145. <p>This document addresses the following use cases for avatar subscribers:</p>
  146. <ol>
  147. <li>Discovering avatar availability</li>
  148. <li>Receiving notification of avatar changes</li>
  149. <li>Retrieving avatar data via pubsub</li>
  150. <li>Retrieving avatar data via HTTP</li>
  151. </ol>
  152. </section1>
  153. <section1 topic='Basic Process Flow' anchor='process'>
  154. <p>The process for publishing and updating user avatars is as follows:</p>
  155. <ol>
  156. <li>User publishes avatar data for "image/png" content-type to data node and optionally publishes other content-types to HTTP URLs.</li>
  157. <li>User publishes notification of updated avatar to metadata node, with ItemID that matches SHA-1 hash of image data for "image/png" content-type (note: this is a hash of the image data itself, not the base64-encoded version).</li>
  158. <li>Subscribers receive notification.</li>
  159. <li>Optionally (and if necessary), subscribers retrieve avatar data identified by ItemID from data node using pubsub retrieve-items feature (or via HTTP).</li>
  160. <li>Optionally, user disables avatar display.</li>
  161. </ol>
  162. <p>This process flow is described more fully in the following sections.</p>
  163. <p>Note: Before publishing avatar data and metadata, the user MUST determine if his or her server supports the PEP subset of pubsub by following the procedures specified in <cite>XEP-0163</cite>, since such support simplifies avatar publication. The following examples assume the availability of a PEP service.</p>
  164. <section2 topic='User Publishes Data' anchor='process-pubdata'>
  165. <p>Before updating the avatar metadata node, the publisher MUST make sure that the avatar data is available at the data node or URL. When publishing the avatar data to the data node, the publisher MUST ensure that the value of the pubsub ItemID is a SHA-1 hash of the data for the "image/png" content-type (this is used by the subscriber to determine if a locally cached copy can be displayed).</p>
  166. <p>The following example illustrates the XML structure to be sent when publishing avatar data to the data node.</p>
  167. <example caption='Publishing avatar data to data node'><![CDATA[
  168. <iq type='set' from='juliet@capulet.lit/chamber' id='publish1'>
  169. <pubsub xmlns=''>
  170. <publish node='urn:xmpp:avatar:data'>
  171. <item id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'>
  172. <data xmlns='urn:xmpp:avatar:data'>
  173. qANQR1DBwU4DX7jmYZnncm...
  174. </data>
  175. </item>
  176. </publish>
  177. </pubsub>
  178. </iq>
  179. ]]></example>
  180. <example caption='Pubsub service replies with success'><![CDATA[
  181. <iq type='result' to='juliet@capulet.lit/chamber' id='publish1'/>
  182. ]]></example>
  183. <p>If the avatar will be made available via HTTP instead of a pubsub data node, the publisher MUST either verify that the avatar exists at the HTTP URL or publish it via standard HTTP methods (such methods are out of scope for this specification; refer to <cite>RFC 2616</cite>).</p>
  184. </section2>
  185. <section2 topic='User Publishes Metadata Notification' anchor='process-pubmeta'>
  186. <p>Whenever the publisher wishes to change its current avatar, it MUST update the metadata node. As with the data node, the publisher MUST ensure that the value of the pubsub ItemID is a SHA-1 hash of the data for the "image/png" content-type (the match between the ItemID of the data node and metadata node is used by the subscriber to determine if a locally cached copy can be displayed).</p>
  187. <p>The following example shows metadata specifying avatar data that is available in only one format ("image/png") and accessible only at the data node.</p>
  188. <example caption='Publishing avatar metadata'><![CDATA[
  189. <iq type='set' from='juliet@capulet.lit/chamber' id='publish2'>
  190. <pubsub xmlns=''>
  191. <publish node='urn:xmpp:avatar:metadata'>
  192. <item id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'>
  193. <metadata xmlns='urn:xmpp:avatar:metadata'>
  194. <info bytes='12345'
  195. id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'
  196. height='64'
  197. type='image/png'
  198. width='64'/>
  199. </metadata>
  200. </item>
  201. </publish>
  202. </pubsub>
  203. </iq>
  204. ]]></example>
  205. <p>The following example shows metadata specifying avatar data that is available at an HTTP URL.</p>
  206. <example caption='Publishing avatar metadata'><![CDATA[
  207. <iq type='set' from='juliet@capulet.lit/chamber' id='publish2'>
  208. <pubsub xmlns=''>
  209. <publish node='urn:xmpp:avatar:metadata'>
  210. <item id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'>
  211. <metadata xmlns='urn:xmpp:avatar:metadata'>
  212. <info bytes='23456'
  213. height='64'
  214. id='357a8123a30844a3aa99861b6349264ba67a5694'
  215. type='image/gif'
  216. url=''
  217. width='64'/>
  218. </metadata>
  219. </item>
  220. </publish>
  221. </pubsub>
  222. </iq>
  223. ]]></example>
  224. </section2>
  225. <section2 topic='Subscribers Receive Metadata Notification' anchor='process-subnotify'>
  226. <p>The user's virtual pubsub service would then send the metadata notification to entities that have subscribed to the user's metadata node or contacts who have advertised an interest in receiving avatar metadata by including a &xep0115; feature of "urn:xmpp:avatar:metadata+notify".</p>
  227. <example caption='Subscribers receive avatar metadata notification'><![CDATA[
  228. <message to='romeo@montague.lit/home' from='juliet@capulet.lit'>
  229. <event xmlns=''>
  230. <items node='urn:xmpp:avatar:metadata'>
  231. <item id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'>
  232. <metadata xmlns='urn:xmpp:avatar:metadata'>
  233. <info bytes='12345'
  234. height='64'
  235. id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'
  236. type='image/png'
  237. width='64'/>
  238. </metadata>
  239. </item>
  240. </items>
  241. </event>
  242. <addresses xmlns=''>
  243. <address type='replyto' jid='juliet@capulet.lit/chamber'/>
  244. </addresses>
  245. </message>
  246. ]]></example>
  247. <p>As shown, depending on node configuration, the item may include &xep0033; information about the publishing resource (see <cite>XEP-0060</cite> for details).</p>
  248. </section2>
  249. <section2 topic='Subscribers Retrieve Data' anchor='process-subretrieve'>
  250. <p>Upon receiving the notification, each subscriber SHOULD determine if it has a locally cached copy of that avatar (which it can do by searching for an image identified by the ItemID). If the subscriber already has a locally cached copy of the avatar image, it MUST NOT retrieve the image data.</p>
  251. <p>If the subscriber does not have a locally cached copy of the avatar image, it SHOULD retrieve the data. It can do this by sending a pubsub retrieve-items request to the data node, specifying the appropriate ItemID.</p>
  252. <example caption='Subscriber requests last item by ItemID'><![CDATA[
  253. <iq type='get'
  254. from='romeo@montague.lit/home'
  255. to='juliet@capulet.lit'
  256. id='retrieve1'>
  257. <pubsub xmlns=''>
  258. <items node='urn:xmpp:avatar:data'>
  259. <item id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'/>
  260. </items>
  261. </pubsub>
  262. </iq>
  263. ]]></example>
  264. <p>The PEP service running at the user's server then SHOULD return the avatar data.</p>
  265. <example caption='PEP service returns avatar data'><![CDATA[
  266. <iq type='result'
  267. from='juliet@capulet.lit'
  268. to='romeo@montague.lit/home'
  269. id='retrieve1'>
  270. <pubsub xmlns=''>
  271. <items node='urn:xmpp:avatar:data'>
  272. <item id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'>
  273. <data xmlns='urn:xmpp:avatar:data'>
  274. qANQR1DBwU4DX7jmYZnncm...
  275. </data>
  276. </item>
  277. </items>
  278. </pubsub>
  279. </iq>
  280. ]]></example>
  281. <p>If the &lt;info/&gt; element sent to the metadata node possesses a 'url' attribute, the avatar data is hosted at a URL. Therefore, in order to retrieve the avatar image data for that content-type, the requesting entity MUST send an HTTP request to the specified URL. Methods for doing so are out of scope for this specification (see <cite>RFC 2616</cite>).</p>
  282. </section2>
  283. <section2 topic='Publisher Disables Avatar Publishing' anchor='pub-disable'>
  284. <p>In order to temporarily disable avatar publishing, the user publishes an empty &lt;metadata/&gt; element to the metadata node.</p>
  285. <example caption='Temporarily disabling avatar publishing'><![CDATA[
  286. <iq type='set' from='juliet@capulet.lit/chamber' id='publish3'>
  287. <pubsub xmlns=''>
  288. <publish node='urn:xmpp:avatar:metadata'>
  289. <item>
  290. <metadata xmlns='urn:xmpp:avatar:metadata'/>
  291. </item>
  292. </publish>
  293. </pubsub>
  294. </iq>
  295. ]]></example>
  296. <p>As before, subscribers to the metadata node would then receive the notification.</p>
  297. <example caption='Subscribers receive avatar metadata notification'><![CDATA[
  298. <message to='romeo@montague.lit/home' from='juliet@capulet.lit'>
  299. <event xmlns=''>
  300. <items node='urn:xmpp:avatar:metadata'>
  301. <item>
  302. <metadata xmlns='urn:xmpp:avatar:metadata'/>
  303. </item>
  304. </items>
  305. </event>
  306. </message>
  307. ]]></example>
  308. <p>Note: In an earlier version of this specification, the user indicated that it wanted to disable publishing by sending a &lt;metadata/&gt; element containing a &lt;stop/&gt; child element. For consistency with other PEP payload formats, support for the &lt;stop/&gt; element is <em>deprecated</em>.</p>
  309. </section2>
  310. </section1>
  311. <section1 topic='Protocol Syntax' anchor='proto'>
  312. <p>The PEP subset of pubsub requires that there shall exist a one-to-one relationship between namespaces and nodes. Because the protocol defined herein stipulates the use of two nodes (one for avatar data and one for avatar metadata), we define two namespaces, each with a corresponding root element:</p>
  313. <ul>
  314. <li>&lt;data xmlns='urn:xmpp:avatar:data'/&gt;</li>
  315. <li>&lt;metadata xmlns='urn:xmpp:avatar:metadata'/&gt;</li>
  316. </ul>
  317. <p>These are further specified below.</p>
  318. <section2 topic='Data Element' anchor='proto-data'>
  319. <p>The &lt;data/&gt; element is used to communicate the avatar data itself, and only for the "image/png" content-type (support for which is REQUIRED).</p>
  320. <code><![CDATA[
  321. <data xmlns='urn:xmpp:avatar:data'>
  323. </data>
  324. ]]></code>
  325. <p>The XML character data MUST represent the image data for the avatar with a content-type of "image/png", Base64-encoded in accordance with Section 4 of &rfc4648;. (Note: Line feeds SHOULD NOT be added but MUST be accepted.)</p>
  326. <p>The &lt;data/&gt; element MUST NOT possess any attributes.</p>
  327. <p>Support for the &lt;data/&gt; element is REQUIRED.</p>
  328. </section2>
  329. <section2 topic='Metadata Element' anchor='proto-meta'>
  330. <p>The &lt;metadata/&gt; element is used to communicate information about the avatar. There are two allowable children of the &lt;metadata/&gt; element:</p>
  331. <ul>
  332. <li>&lt;info/&gt;</li>
  333. <li>&lt;pointer/&gt;</li>
  334. </ul>
  335. <p>These are further specified below.</p>
  336. <p>In addition, the &lt;metadata/&gt; element MAY be empty (i.e., contain no child elements); this form is used to disable avatar publishing.</p>
  337. <section3 topic='Info Element' anchor='proto-info'>
  338. <p>The &lt;info/&gt; child element is used to communicate avatar metadata. Support for the &lt;info/&gt; element is REQUIRED.</p>
  339. <code><![CDATA[
  340. <metadata xmlns='urn:xmpp:avatar:metadata'>
  341. <info bytes='size-of-image-data-in-bytes'
  342. height='image-height-in-pixels'
  343. id='SHA-1-hash-of-image-data'
  344. type='content-type-of-image-data'
  345. url='HTTP-URL-for-image-data'
  346. width='image-width-in-pixels'/>
  347. </metadata>
  348. ]]></code>
  349. <p>The &lt;info/&gt; child element MUST be empty.</p>
  350. <p>The defined attributes of the &lt;info/&gt; element are specified in the following table.</p>
  351. <table caption='Info Attributes'>
  352. <tr>
  353. <th>Name</th>
  354. <th>Definition</th>
  355. <th>Inclusion</th>
  356. </tr>
  357. <tr>
  358. <td>bytes</td>
  359. <td>The size of the image data in bytes.</td>
  360. <td>REQUIRED</td>
  361. </tr>
  362. <tr>
  363. <td>height</td>
  364. <td>The height of the image in pixels.</td>
  365. <td>RECOMMENDED</td>
  366. </tr>
  367. <tr>
  368. <td>id</td>
  369. <td>A hash of the image data for the specified content-type, where the hash is produced in accordance with the SHA-1 algorithm as specified in &rfc3174; (with binary output).</td>
  370. <td>REQUIRED</td>
  371. </tr>
  372. <tr>
  373. <td>type</td>
  374. <td>The IANA-registered content type of the image data.</td>
  375. <td>REQUIRED</td>
  376. </tr>
  377. <tr>
  378. <td>url</td>
  379. <td>The http: or https: URL at which the image data file is hosted; this attribute MUST NOT be included unless the image data file can be retrieved via HTTP.</td>
  380. <td>OPTIONAL</td>
  381. </tr>
  382. <tr>
  383. <td>width</td>
  384. <td>The width of the image in pixels</td>
  385. <td>RECOMMENDED</td>
  386. </tr>
  387. </table>
  388. <p>The &lt;metadata/&gt; root element MAY contain more than one &lt;info/&gt; element. Each &lt;info/&gt; element MUST specify metadata for the same avatar image but in alternate content-types (e.g., "image/png", "image/gif", and "image/jpeg"), and one of the formats MUST be "image/png" to ensure interoperability. The value of the 'type' attribute MUST be an IANA-registered content type of type "image" or "video". <note>The IANA registry of content types is located at &lt;<link url=''></link>&gt;.</note> Support for the "image/png" content type is REQUIRED. Support for the "image/gif" and "image/jpeg" content types is RECOMMENDED. Support for any other content type is OPTIONAL.</p>
  389. </section3>
  390. <section3 topic='Pointer Element' anchor='proto-pointer'>
  391. <p>The &lt;pointer/&gt; child element is used to point to an avatar that is not published via pubsub or HTTP, but rather is provided by a third-party service such as an online gaming system or virtual world.</p>
  392. <code><![CDATA[
  393. <metadata xmlns='urn:xmpp:avatar:metadata'>
  394. <pointer>
  396. </pointer>
  397. </metadata>
  398. ]]></code>
  399. <p>The &lt;pointer/&gt; element MAY possess the following attributes if the publishing application has the relevant information:</p>
  400. <ul>
  401. <li><em>bytes</em> -- The size of the image data in bytes.</li>
  402. <li><em>height</em> -- The height of the image in pixels.</li>
  403. <li><em>id</em> -- The SHA-1 hash of the image data for the specified content-type.</li>
  404. <li><em>type</em> -- The IANA-registered content type of the image data.</li>
  405. <li><em>width</em> -- The width of the image in pixels.</li>
  406. </ul>
  407. <p>The content of the &lt;pointer/&gt; element MUST be a properly-namespaced child element that specifies information about how to retrieve the avatar from the third-party service. The structure for any such child element is out of scope for this document.</p>
  408. <p>Even if the &lt;pointer&gt; element is included, it MUST be preceded by at least one instance of the &lt;info/&gt; element so that implementations that do not support the &lt;pointer/&gt; element can display a "fallback" format of the avatar (at a minimum, "image/png").</p>
  409. <p>Support for the &lt;pointer/&gt; element is OPTIONAL.</p>
  410. </section3>
  411. </section2>
  412. </section1>
  413. <section1 topic='Additional Examples' anchor='examples'>
  414. <section2 topic='Metadata With Multiple Content-Types' anchor='examples-multiple'>
  415. <p>The following example shows metadata specifying avatar data that is available in multiple formats ("image/png", "image/gif", and "image/mng"), where the "image/png" content-type is available only at the data node and the other content-types are available HTTP URLs.</p>
  416. <example caption='Publishing avatar metadata (multiple formats)'><![CDATA[
  417. <iq type='set' from='juliet@capulet.lit/chamber' id='publish3'>
  418. <pubsub xmlns=''>
  419. <publish node='urn:xmpp:avatar:metadata'>
  420. <item id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'>
  421. <metadata xmlns='urn:xmpp:avatar:metadata'>
  422. <info bytes='12345'
  423. height='64'
  424. id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'
  425. type='image/png'
  426. width='64'/>
  427. <info bytes='12345'
  428. height='64'
  429. id='e279f80c38f99c1e7e53e262b440993b2f7eea57'
  430. type='image/png'
  431. url=''
  432. width='64'/>
  433. <info bytes='23456'
  434. height='64'
  435. id='357a8123a30844a3aa99861b6349264ba67a5694'
  436. type='image/gif'
  437. url=''
  438. width='64'/>
  439. <info bytes='78912'
  440. height='64'
  441. id='03a179fe37bd5d6bf9c2e1e592a14ae7814e31da'
  442. type='image/mng'
  443. url=''
  444. width='64'/>
  445. </metadata>
  446. </item>
  447. </publish>
  448. </pubsub>
  449. </iq>
  450. ]]></example>
  451. <p>In the foregoing example, the image encapsulated in the "image/png" content type is available both at a pubsub data node and at an HTTP URL; therefore it is included twice (the second time with a 'url' attribute).</p>
  452. </section2>
  453. <section2 topic='Metadata With Pointer' anchor='examples-pointer'>
  454. <p>The following example shows metadata specifying avatar data that is available in "image/png" at the data node and also with a pointer to an external service.</p>
  455. <example caption='Publishing avatar metadata (with pointer)'><![CDATA[
  456. <iq type='set' from='juliet@capulet.lit/chamber' id='publish4'>
  457. <pubsub xmlns=''>
  458. <publish node='urn:xmpp:avatar:metadata'>
  459. <item id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'>
  460. <metadata xmlns='urn:xmpp:avatar:metadata'>
  461. <info bytes='12345'
  462. height='64'
  463. id='111f4b3c50d7b0df729d299bc6f8e9ef9066971f'
  464. type='image/png'
  465. width='64'/>
  466. <pointer>
  467. <x xmlns=''>
  468. <game>Ancapistan</game>
  469. <character>Kropotkin</character>
  470. </x>
  471. </pointer>
  472. </metadata>
  473. </item>
  474. </publish>
  475. </pubsub>
  476. </iq>
  477. ]]></example>
  478. </section2>
  479. </section1>
  480. <section1 topic='Service Discovery' anchor='disco'>
  481. <section2 topic='Discovering Avatar Availability' anchor='disco-sub'>
  482. <p>The pubsub "auto-subscribe" and "filtered-notifications" features enable a contact to automatically subscribe to a user's avatar. However, a contact can also explicitly determine if another user publishes avatars using this protocol by sending a &xep0030; items ("disco#items") request to the user's bare JID &LOCALBARE;.</p>
  483. <example caption='Disco items request'><![CDATA[
  484. <iq type='get'
  485. from='romeo@montague.lit/orchard'
  486. to='juliet@capulet.lit'
  487. id='items1'>
  488. <query xmlns=''/>
  489. </iq>
  490. ]]></example>
  491. <p>If the user publishes avatar data to an PEP node, the result MUST contain the appropriate items.</p>
  492. <example caption='Disco items result'><![CDATA[
  493. <iq type='result'
  494. from='juliet@capulet.lit'
  495. to='romeo@montague.lit/orchard'
  496. id='items1'>
  497. <query xmlns=''>
  498. <item jid='juliet@capulet.lit' node='urn:xmpp:avatar:data'/>
  499. <item jid='juliet@capulet.lit' node='urn:xmpp:avatar:metadata'/>
  500. </query>
  501. </iq>
  502. ]]></example>
  503. <p>The contact then MAY subscribe to the metadata node following the protocol specified in <cite>XEP-0060</cite>. However, the contact SHOULD NOT subscribe to the data node (instead, it SHOULD simply retrieve items from that node when needed, as described above).</p>
  504. </section2>
  505. </section1>
  506. <section1 topic='Implementation Notes' anchor='impl'>
  507. <section2 topic='Multiple Resources' anchor='impl-resources'>
  508. <p>If a user has multiple online resources at the same time, each resource MAY publish a different avatar. The PEP service SHOULD include the "replyto" address of the publishing resource as shown above in order to facilitate differentiation between per-resource avatars.</p>
  509. </section2>
  510. <section2 topic='Avatar Synchronization' anchor='impl-sync'>
  511. <p>When a user logs in with a new resource and before publishing an avatar, its client SHOULD retrieve its last published avatar, either automatically by sending presence with the appropriate entity capabilities information (see <cite>XEP-0115</cite>) or using the "retrieve-items" method described in <cite>XEP-0060</cite>.</p>
  512. </section2>
  513. <section2 topic='Image Handling' anchor='impl-images'>
  514. <p>It is the responsibility of the receiving application to determine which avatar format to retrieve (e.g., "image/gif" rather than "image/png") and to determine the appropriate method for retrieval (e.g., HTTP rather than pubsub).</p>
  515. <p>The receiving application SHOULD NOT scale up an image when displaying it.</p>
  516. <p>If an avatar is not available for a contact, the receiving application MAY display the contact's photo, e.g., as provided in the contact's vCard (see &xep0054;) or other profile information.</p>
  517. </section2>
  518. </section1>
  519. <section1 topic='Security Considerations' anchor='security'>
  520. <p>See <cite>XEP-0060</cite> and <cite>XEP-0163</cite> regarding security considerations related to the underlying transport protocol.</p>
  521. <p>It is possible that output of the SHA-1 hashing algorithm can result in collisions; however, the use of SHA-1 in producing a hash of the avatar data is not security-critical.</p>
  522. </section1>
  523. <section1 topic='IANA Considerations' anchor='iana'>
  524. <p>This document makes use of IANA-registered content types, but requires no interaction with &IANA;.</p>
  525. </section1>
  526. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  527. <section2 topic='Protocol Namespaces' anchor='ns'>
  528. <p>The &REGISTRAR; includes "urn:xmpp:avatar:data" and "urn:xmpp:avatar:metadata" in its registry of protocol namespaces (see &NAMESPACES;).</p>
  529. </section2>
  530. </section1>
  531. <section1 topic='XML Schema' anchor='schema'>
  532. <section2 topic='Data Namespace' anchor='schema-data'>
  533. <code><![CDATA[
  534. <?xml version='1.0' encoding='UTF-8'?>
  535. <xs:schema
  536. xmlns:xs=''
  537. targetNamespace='urn:xmpp:avatar:data'
  538. xmlns='urn:xmpp:avatar:data'
  539. elementFormDefault='qualified'>
  540. <xs:annotation>
  541. <xs:documentation>
  542. The protocol documented by this schema is defined in
  543. XEP-0084:
  544. </xs:documentation>
  545. </xs:annotation>
  546. <xs:element name='data' type='xs:base64Binary'/>
  547. </xs:schema>
  548. ]]></code>
  549. </section2>
  550. <section2 topic='Metadata Namespace' anchor='schema-metadata'>
  551. <code><![CDATA[
  552. <?xml version='1.0' encoding='UTF-8'?>
  553. <xs:schema
  554. xmlns:xs=''
  555. targetNamespace='urn:xmpp:avatar:metadata'
  556. xmlns='urn:xmpp:avatar:metadata'
  557. elementFormDefault='qualified'>
  558. <xs:annotation>
  559. <xs:documentation>
  560. The protocol documented by this schema is defined in
  561. XEP-0084:
  562. </xs:documentation>
  563. </xs:annotation>
  564. <xs:element name='metadata'>
  565. <xs:complexType>
  566. <xs:choice>
  567. <xs:sequence minOccurs='0' maxOccurs='1'>
  568. <xs:element ref='info' minOccurs='1' maxOccurs='unbounded'/>
  569. <xs:element ref='pointer' minOccurs='0' maxOccurs='unbounded'/>
  570. </xs:sequence>
  571. </xs:choice>
  572. </xs:complexType>
  573. </xs:element>
  574. <xs:element name='info'>
  575. <xs:complexType>
  576. <xs:simpleContent>
  577. <xs:extension base='empty'>
  578. <xs:attribute name='bytes' type='xs:unsignedShort' use='required'/>
  579. <xs:attribute name='height' type='xs:unsignedByte' use='optional'/>
  580. <xs:attribute name='id' type='xs:string' use='required'/>
  581. <xs:attribute name='type' type='xs:string' use='required'/>
  582. <xs:attribute name='url' type='xs:anyURI' use='optional'/>
  583. <xs:attribute name='width' type='xs:unsignedByte' use='optional'/>
  584. </xs:extension>
  585. </xs:simpleContent>
  586. </xs:complexType>
  587. </xs:element>
  588. <xs:element name='pointer'>
  589. <xs:complexType>
  590. <xs:sequence>
  591. <xs:any namespace='##other'/>
  592. </xs:sequence>
  593. </xs:complexType>
  594. </xs:element>
  595. <xs:simpleType name='empty'>
  596. <xs:restriction base='xs:string'>
  597. <xs:enumeration value=''/>
  598. </xs:restriction>
  599. </xs:simpleType>
  600. </xs:schema>
  601. ]]></code>
  602. </section2>
  603. </section1>
  604. <section1 topic='Author Note' anchor='authornote'>
  605. <p>Peter Millard, a co-author of this specification from version 0.1 through version 0.7, died on April 26, 2006. The remaining authors are thankful for his work on user avatars.</p>
  606. </section1>
  607. </xep>