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-0008.xml 8.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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>IQ-Based Avatars</title>
  10. <abstract>This specification provides historical documentation of an IQ-based protocol for exchanging user avatars.</abstract>
  11. &LEGALNOTICE;
  12. <number>0008</number>
  13. <status>Deferred</status>
  14. <type>Historical</type>
  15. <sig>Standards</sig>
  16. <approver>Council</approver>
  17. <dependencies>
  18. <spec>XMPP Core</spec>
  19. <spec>XMPP IM</spec>
  20. </dependencies>
  21. <supersedes/>
  22. <supersededby/>
  23. <shortname>None</shortname>
  24. &temas;
  25. &xvirge;
  26. <author>
  27. <firstname>Jens</firstname>
  28. <surname>Alfke</surname>
  29. <email>jens@mac.com</email>
  30. </author>
  31. &pgmillard;
  32. <revision>
  33. <version>0.3</version>
  34. <date>2005-06-16</date>
  35. <initials>psa</initials>
  36. <remark>Coincident with publication of XEP-0153, changed type to Historical.</remark>
  37. </revision>
  38. <revision>
  39. <version>0.2</version>
  40. <date>2003-05-06</date>
  41. <initials>psa</initials>
  42. <remark>At the request of the authors, the status of this document has been changed to Retracted.</remark>
  43. </revision>
  44. <revision>
  45. <version>0.1</version>
  46. <date>2001-09-14</date>
  47. <initials>tm</initials>
  48. <remark>Initial release</remark>
  49. </revision>
  50. </header>
  51. <section1 topic='Introduction'>
  52. <p>Many communication applications now allow for the association of a small image or buddy icon (avatar) with a user of that application. The avatar is not intended to be a defining portrait of the user, but rather a simple expression of the user's appearance, mood, status, and the like. This proposal outlines a way to incorporate avatars into the current Jabber platform.</p>
  53. </section1>
  54. <section1 topic='Image Requirements'>
  55. <p>Certain restrictions are placed upon the image. First, the image height and width must be between thirty-two (32) and sixty-four (64) pixels. The suggested size is sixty-four (64) pixels high and sixty-four (64) pixels wide <note>It is highly recommended that clients never scale up images when displaying them.</note>. Images should be square, but this is not required. Images should be in GIF, JPEG, or PNG format, although it is possible that in future revisions of this spec more formats will be allowed. Finally, images must use less than eight (8) kilobytes of data.</p>
  56. </section1>
  57. <section1 topic='Avatar Availability'>
  58. <p>There are two methods of showing that a client has an avatar available:</p>
  59. <ol>
  60. <li>Embedding the jabber:x:avatar namespace within &#60;presence/&#62; packets using Jabber's &#60;x/&#62; element</li>
  61. <li>Displaying the jabber:iq:avatar namespace in browse requests</li>
  62. </ol>
  63. <p>Partly because Jabber browsing is relatively undeveloped, this proposal focuses on the first option.</p>
  64. <p>The &#60;x/&#62; element in the jabber:x:avatar namespace contains a SHA1 hash (hexadecimal, not base64) of the image data itself (not the base64-encoded version) in a &#60;hash/&#62; element. (Because the odds of creating an identical hash are small, the hash is considered unique to the image and can be used to cache images between client sessions, resulting in fewer requests for the image.) The initial announcement of the availability of an avatar is done by sending a presence packet with the jabber:x:avatar information, as follows:</p>
  65. <example>
  66. &#60;presence&#62;
  67. &#60;x xmlns='jabber:x:avatar'&#62;
  68. &#60;hash&#62;SHA1 of image data&#60;/hash&#62;
  69. &#60;/x&#62;
  70. &#60;/presence&#62;
  71. </example>
  72. <p>If the avatar-generating user changes the avatar, a new presence packet is sent out with the updated information:</p>
  73. <example>
  74. &#60;presence&#62;
  75. &#60;x xmlns='jabber:x:avatar'&#62;
  76. &#60;hash&#62;SHA1 of new image data&#60;/hash&#62;
  77. &#60;/x&#62;
  78. &#60;/presence&#62;
  79. </example>
  80. <p>To disable the avatar, the avatar-generating user's client will send a presence packet with the jabber:x:avatar namespace but with no hash information:</p>
  81. <example>
  82. &#60;presence&#62;
  83. &#60;x xmlns='jabber:x:avatar'/&#62;
  84. &#60;/presence&#62;
  85. </example>
  86. <p>Clients should send the current avatar hash in every &#60;presence/&#62; packet even if the avatar has not changed. Remember that other clients logging in will receive a copy of the most recent &#60;presence/&#62; element, which should therefore always contain the most recent avatar hash. However, if the client's connection is lost unexpectedly or the client disconnects without sending an unavailable presence, the server will send other clients a &#60;presence/&#62; element containing no jabber:x:avatar extension. Therefore if, after receiving one or more presence packets containing jabber:x:avatar information, an avatar-receiving client receives a presence packet that does not include the jabber:x:avatar namespace, it is recommended that the client save the avatar image until the next set of information is received. In this case the avatar-generating client might send something as simple as the following:</p>
  87. <example>
  88. &#60;presence/&#62;
  89. </example>
  90. </section1>
  91. <section1 topic='Avatar Retrieval'>
  92. <p>There are two methods for retrieving the actual avatar data:</p>
  93. <ol>
  94. <li>An exchange between clients of &#60;iq/&#62; elements in the jabber:iq:avatar namespace</li>
  95. <li>Public XML storage from the avatar-generating client to the server and public XML retrieval from the server to the avatar-requesting client (see &xep0049;).</li>
  96. </ol>
  97. <p>The first of these methods is preferred. On this model, a query is sent directly to the avatar-generating client using an &#60;iq/&#62; element of type "get" in the jabber:iq:avatar namespace <note>Whenever possible, the avatar-requesting client should attempt to determine if the avatar-generating client has an avatar available before requesting it.</note> <note>It is suggested that no request be made if it is known (such as through a browse reply) that a client does not support the jabber:iq:avatar namespace.</note>:</p>
  98. <example>
  99. &#60;iq id='2' type='get' to='user@server/resource'&#62;
  100. &#60;query xmlns='jabber:iq:avatar'/&#62;
  101. &#60;/iq&#62;
  102. </example>
  103. <p>The avatar-generating client will reply with an &#60;iq/&#62; element of type "result" in the jabber:iq:avatar namespace; this reply will contain a query element that in turn contains a &#60;data/&#62; element with the MIME type in the 'mimetype' attribute and the data base64-encoded in the body of the &#60;data/&#62; element:</p>
  104. <example>
  105. &#60;iq id='2' type='result' to='user@server/resource'&#62;
  106. &#60;query xmlns='jabber:iq:avatar'&#62;
  107. &#60;data mimetype='image/jpeg'&#62;
  108. Base64-Encoded Data
  109. &#60;/data&#62;
  110. &#60;/query&#62;
  111. &#60;/iq&#62;
  112. </example>
  113. <p>If the first method fails, the second method that should be attempted by sending a request to the server for the avatar-generating user's public XML containing the avatar data. This data is to be stored in the storage:client:avatar namespace. This method presumes that the avatar-generating client has already stored its avatar data on the server:</p>
  114. <example>
  115. &#60;iq id='0' type='set' to='user@server'&#62;
  116. &#60;query xmlns='storage:client:avatar'&#62;
  117. &#60;data mimetype='image/jpeg'&#62;
  118. Base64 Encoded Data
  119. &#60;/data&#62;
  120. &#60;/query&#62;
  121. &#60;/iq&#62;
  122. </example>
  123. <p>Once such data has been set, the avatar can be retrieved by any requesting client from the avatar-generating client's public XML storage:</p>
  124. <example>
  125. &#60;iq id='1' type='get' to='user@server'&#62;
  126. &#60;query xmlns='storage:client:avatar'/&#62;
  127. &#60;/iq&#62;
  128. </example>
  129. </section1>
  130. <section1 topic='Future Considerations'>
  131. <p>It is acknowledged that sending avatar information within presence packets is less than desirable in many respects (e.g., in network traffic generated); however, there currently exists in Jabber no generic framework for addressing these shortcomings. Possible solutions on the horizon include live browsing and a pub/sub model, but these are still embryonic and experimental. Once something of that nature is accepted by the Council, the avatar spec will be modified to work within that framework rather than by attaching to presence.</p>
  132. </section1>
  133. <section1 topic='Author Note' anchor='authornote'>
  134. <p>Peter Millard, a co-author of this specification from version 0.1 through version 0.3, died on April 26, 2006.</p>
  135. </section1>
  136. </xep>