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-0227.xml 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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>Portable Import/Export Format for XMPP-IM Servers</title>
  10. <abstract>This document specifies a file format for importing and exporting user data to and from XMPP-IM servers.</abstract>
  11. &LEGALNOTICE;
  12. <number>0227</number>
  13. <status>Draft</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <approver>Council</approver>
  17. <dependencies>
  18. <spec>XMPP IM</spec>
  19. <spec>XEP-0049</spec>
  20. <spec>XEP-0054</spec>
  21. </dependencies>
  22. <supersedes/>
  23. <supersededby/>
  24. <shortname>pie</shortname>
  25. <schemaloc>
  26. <url>http://xmpp.org/schemas/pie.xsd</url>
  27. </schemaloc>
  28. <author>
  29. <firstname>Magnus</firstname>
  30. <surname>Henoch</surname>
  31. <email>henoch@dtek.chalmers.se</email>
  32. <jid>legoscia@jabber.cd.chalmers.se</jid>
  33. </author>
  34. <author>
  35. <firstname>Waqas</firstname>
  36. <surname>Hussain</surname>
  37. <email>waqas20@gmail.com</email>
  38. <jid>waqas@jaim.at</jid>
  39. </author>
  40. <revision>
  41. <version>1.0</version>
  42. <date>2010-03-12</date>
  43. <initials>psa</initials>
  44. <remark><p>Per a vote of the XMPP Council, advanced specification from Experimental to Draft; simultaneously the XMPP Registrar issued a namespace of "urn:xmpp:pie:0".</p></remark>
  45. </revision>
  46. <revision>
  47. <version>0.3</version>
  48. <date>2009-10-16</date>
  49. <initials>wh</initials>
  50. <remark><p>Modified to include feedback received during the initial Last Call. Added sections for privacy lists and incoming subscriptions, as well as text on XInclude security.</p></remark>
  51. </revision>
  52. <revision>
  53. <version>0.2</version>
  54. <date>2007-12-13</date>
  55. <initials>mh</initials>
  56. <remark><p>Use XInclude.</p></remark>
  57. </revision>
  58. <revision>
  59. <version>0.1</version>
  60. <date>2007-08-08</date>
  61. <initials>psa</initials>
  62. <remark><p>Initial published version.</p></remark>
  63. </revision>
  64. <revision>
  65. <version>0.0.1</version>
  66. <date>2007-07-27</date>
  67. <initials>mh</initials>
  68. <remark><p>Initial version.</p></remark>
  69. </revision>
  70. </header>
  71. <section1 topic='Introduction' anchor='intro'>
  72. <p>Different implementations of XMPP-IM servers store user data in various ways, and many implementations have more than one storage format. This leads to problems when a server administrator wants to switch to another implementation or storage format -- the implementation is as likely as not to have an import mechanism that can read the user data in its current form. This document attempts to solve that problem by defining a common file format for import and export of user data in XMPP-IM servers.</p>
  73. </section1>
  74. <section1 topic='Requirements' anchor='reqs'>
  75. <p>The following constraints are imposed on this standard:</p>
  76. <ul>
  77. <li>
  78. <p>The file format is XML-based.</p>
  79. <p>XMPP-IM servers already have tools to process XML data. This also allows extension of the format using namespaces. Furthermore, some of the data that needs to be stored is by definition already in XML form.</p>
  80. </li>
  81. <li>
  82. <p>The data layout is flexible.</p>
  83. <p>The data is contained in a single XML document; however, it can be split into several files using &w3xinclude;.</p>
  84. </li>
  85. <li>
  86. <p>All user data is stored, but no server configuration data.</p>
  87. <p>User data has similar form throughout the XMPP world, but server configuration is implementation-specific. Therefore this specification does not attempt to transfer any aspects of the server configuration from one server to another.</p>
  88. <p>Furthermore, the contents of MUC, Pubsub and other services are out of scope for this specification.</p>
  89. </li>
  90. <li>
  91. <p>Multiple virtual hosts are supported.</p>
  92. <p>Many server implementations can serve several hostnames in a single server instance. Thus this specification allows storing data from several virtual hosts.</p>
  93. </li>
  94. </ul>
  95. </section1>
  96. <section1 topic='Glossary' anchor='glossary'>
  97. <dl>
  98. <di><dt>Exporting server</dt>
  99. <dd>The XMPP-IM server writing its user data to files, following this specification.</dd>
  100. </di>
  101. <di><dt>Importing server</dt>
  102. <dd>The XMPP-IM server reading data from such files.</dd>
  103. </di>
  104. </dl>
  105. </section1>
  106. <section1 topic='File format' anchor='fileformat'>
  107. <p>Data is contained in an XML document, whose root element is &lt;server-data/&gt; qualified by the 'urn:xmpp:pie:0' namespace &NSNOTE;.</p>
  108. <example caption='The root element'><![CDATA[
  109. <?xml version='1.0' encoding='UTF-8'?>
  110. <server-data xmlns='urn:xmpp:pie:0'>
  111. [ ... ]
  112. </server-data>
  113. ]]>
  114. </example>
  115. <p>At any point in the file, an exporting server may put elements qualified by a namespace not mentioned in this specification. The exported data SHOULD be meaningful without the extensions. An importing server that encounters a namespace that it doesn't understand, or otherwise is unable to import all given data, SHOULD ignore the unknown data, SHOULD notify the operator, and MAY offer to terminate the process.</p>
  116. <p>At any point in the file, an exporting server may put an XInclude &lt;include/&gt; element; see <link url='#xinclude'>Use of XInclude</link>.</p>
  117. <section2 topic='Hosts' anchor='hosts'>
  118. <p>The child elements of the &lt;server-data/&gt; elements are &lt;host/&gt; elements. Each &lt;host/&gt; element describes a virtual host, and has a 'jid' attribute that contains its JID.</p>
  119. <p>An importing server MAY automatically adjust its list of virtual hosts to fit the ones present in the data being imported. If it does not, it SHOULD notify the operator about any mismatch.</p>
  120. <example caption='The host element'><![CDATA[
  121. <?xml version='1.0' encoding='UTF-8'?>
  122. <server-data xmlns='urn:xmpp:pie:0'>
  123. <host jid='capulet.com'>
  124. [ ... ]
  125. </host>
  126. <host jid='montague.net'>
  127. [ ... ]
  128. </host>
  129. </server-data>
  130. ]]></example>
  131. </section2>
  132. <section2 topic='Users' anchor='users'>
  133. <p>Each user is represented by a &lt;user/&gt; element under the &lt;host/&gt; element. The &lt;user/&gt; element MUST have a 'name' attribute, which contains the node part of the user's JID, and SHOULD have a 'password' attribute, which contains the user's password.</p>
  134. <example caption='The user element'><![CDATA[
  135. <?xml version='1.0' encoding='UTF-8'?>
  136. <server-data xmlns='urn:xmpp:pie:0'>
  137. <host jid='capulet.com'>
  138. <user name='juliet' password='s3crEt'>
  139. [ ... ]
  140. </user>
  141. </host>
  142. <host jid='montague.net'>
  143. <user name='romeo' password='iLuvJuLi3T'>
  144. [ ... ]
  145. </user>
  146. </host>
  147. </server-data>
  148. ]]></example>
  149. </section2>
  150. <section2 topic='Rosters' anchor='rosters'>
  151. <p>Each &lt;user/&gt; element SHOULD contain the user's roster in the form of a &lt;query/&gt; element qualified by the 'jabber:iq:roster' namespace. This element contains the user's roster in the same format as when retrieving the roster from the server, as described in section 7.3 of &xmppim;.</p>
  152. <example caption='The roster'><![CDATA[
  153. <?xml version='1.0' encoding='UTF-8'?>
  154. <server-data xmlns='urn:xmpp:pie:0'>
  155. <host jid='capulet.com'>
  156. <user name='juliet' password='s3crEt'>
  157. <query xmlns='jabber:iq:roster'>
  158. <item jid='romeo@montague.net'
  159. name='Romeo'
  160. subscription='both'>
  161. <group>Friends</group>
  162. </item>
  163. </query>
  164. </user>
  165. </host>
  166. </server-data>
  167. ]]></example>
  168. </section2>
  169. <section2 topic='Offline Messages' anchor='offlinemessages'>
  170. <p>If the exporting server stores messages received while the user was offline, it SHOULD include an &lt;offline-messages/&gt; element as a child of the &lt;user/&gt; element. This element contains all the stored messages to the user, if any, as &lt;message/&gt; elements qualified by the 'jabber:client' namespace, starting with the oldest.</p>
  171. <example caption='Offline messages'><![CDATA[
  172. <?xml version='1.0' encoding='UTF-8'?>
  173. <server-data xmlns='urn:xmpp:pie:0'>
  174. <host jid='capulet.com'>
  175. <user name='juliet' password='s3crEt'>
  176. <offline-messages>
  177. <message xmlns='jabber:client'
  178. from='romeo@montague.net/orchard'
  179. to='juliet@capulet.com/balcony'
  180. type='chat'>
  181. <body>Neither, fair saint, if either thee dislike.</body>
  182. <delay xmlns='urn:xmpp:delay'
  183. from='capulet.com'
  184. stamp='1469-07-21T00:32:29Z'>
  185. Offline Storage
  186. </delay>
  187. </message>
  188. </offline-messages>
  189. </user>
  190. </host>
  191. </server-data>
  192. ]]></example>
  193. </section2>
  194. <section2 topic='Private XML Storage' anchor='privatexmlstorage'>
  195. <p>Private data stored by the server as specified in &xep0049; is represented in this format by including a &lt;query/&gt; element qualified by the 'jabber:iq:private' namespace as a child of the &lt;user/&gt; element. This &lt;query/&gt; element in turn contains all elements saved in private XML storage.</p>
  196. <example caption='Private XML Storage'><![CDATA[
  197. <?xml version='1.0' encoding='UTF-8'?>
  198. <server-data xmlns='urn:xmpp:pie:0'>
  199. <host jid='shakespeare.lit'>
  200. <user name='hamlet' password='2b0Rnot2B'>
  201. <query xmlns="jabber:iq:private">
  202. <exodus xmlns="exodus:prefs">
  203. <defaultnick>Hamlet</defaultnick>
  204. </exodus>
  205. </query>
  206. </user>
  207. </host>
  208. </server-data>
  209. ]]></example>
  210. </section2>
  211. <section2 topic='vCards' anchor='vcards'>
  212. <p>By &xep0054;, users can store vCards on the server. In this specification, vCards are child elements of the &lt;user/&gt; element, namely a &lt;vCard/&gt; element qualified by the 'vcard-temp' namespace.</p>
  213. <example caption='vCards'><![CDATA[
  214. <?xml version='1.0' encoding='UTF-8'?>
  215. <server-data xmlns='urn:xmpp:pie:0'>
  216. <host jid='capulet.com'>
  217. <user name='juliet' password='s3crEt'>
  218. <vCard xmlns='vcard-temp'>
  219. <FN>Juliet Capulet</FN>
  220. </vCard>
  221. </user>
  222. </host>
  223. </server-data>
  224. ]]></example>
  225. </section2>
  226. <section2 topic='Privacy Lists' anchor='privacy-lists'>
  227. <p>Privacy lists, as specified in &xep0016;, are represented in this format by including a &lt;query/&gt; element qualified by the 'jabber:iq:privacy' namespace as a child of the &lt;user/&gt; element. This element should contain all privacy lists associated with the user. A default privacy list, if set, is specified by including a &lt;default/&gt; element as a child of the &lt;query/&gt; element.</p>
  228. <example caption='Privacy lists'><![CDATA[
  229. <?xml version='1.0' encoding='UTF-8'?>
  230. <server-data xmlns='urn:xmpp:pie:0'>
  231. <host jid='capulet.com'>
  232. <user name='juliet' password='s3crEt'>
  233. <query xmlns='jabber:iq:privacy'>
  234. <default name='public'/>
  235. <list name='public'>
  236. <item type='jid'
  237. value='tybalt@example.com'
  238. action='deny'
  239. order='1'/>
  240. <item action='allow' order='2'/>
  241. </list>
  242. <list name='private'>
  243. <item type='subscription'
  244. value='both'
  245. action='allow'
  246. order='10'/>
  247. <item action='deny' order='15'/>
  248. </list>
  249. </query>
  250. </user>
  251. </host>
  252. </server-data>
  253. ]]></example>
  254. </section2>
  255. <section2 topic='Incoming Subscription Requests' anchor='incoming-subscription-requests'>
  256. <p>Each &lt;user/&gt; element SHOULD contain pending incoming subscription requests associated with the user's account. Incoming subscription requests are represented by including &lt;presence/&gt; elements qualified by the 'jabber:client' namespace with the 'type' attribute set to a value of 'subscribe' as children of the &lt;user/&gt; element.</p>
  257. <example caption='Incoming subscription requests'><![CDATA[
  258. <?xml version='1.0' encoding='UTF-8'?>
  259. <server-data xmlns='urn:xmpp:pie:0'>
  260. <host jid='capulet.com'>
  261. <user name='juliet' password='s3crEt'>
  262. <presence xmlns='jabber:client'
  263. type='subscribe'
  264. id='xk3h1v69'
  265. from='romeo@montague.net'>
  266. <nick xmlns="http://jabber.org/protocol/nick">Romeo</nick>
  267. </presence>
  268. <presence xmlns='jabber:client'
  269. type='subscribe'
  270. from='mercutio@montague.net'/>
  271. </user>
  272. </host>
  273. </server-data>
  274. ]]></example>
  275. </section2>
  276. </section1>
  277. <section1 topic='Use of XInclude' anchor='xinclude'>
  278. <p>An exporting server may split the data in several files by using the XInclude &lt;include/&gt; element. An importing server MUST support &lt;include/&gt; elements having an 'href' attribute containing a relative URI, having no 'parse' attribute, and having no 'xpointer' attribute; it MAY support other kinds of &lt;include/&gt; elements. An exporting server SHOULD NOT include and an importing server SHOULD NOT process &lt;include/&gt; elements which are descendants, but not children of the &lt;user/&gt; element (since these may be part of user data).</p>
  279. <section2 topic='File and Directory Layout' anchor='xinclude-layout'>
  280. <p>If an exporting server chooses to split the data into several files, it SHOULD use the following scheme:</p>
  281. <p>The main file contains the &lt;server-data/&gt; element, which contains nothing but one &lt;include/&gt; element for each host. The file included for a certain host is placed in the same directory as the main file, and is named by appending ".xml" to the JID of the host, e.g. "capulet.com.xml".</p>
  282. <example caption='The main file, which includes host files'><![CDATA[
  283. <?xml version='1.0' encoding='UTF-8'?>
  284. <server-data xmlns='urn:xmpp:pie:0'
  285. xmlns:xi='http://www.w3.org/2001/XInclude'>
  286. <xi:include href='capulet.com.xml'/>
  287. <xi:include href='montague.net.xml'/>
  288. </server-data>
  289. ]]></example>
  290. <p>Each host file contains a &lt;host/&gt; element, which contains nothing but one &lt;include/&gt; element for each user of the host. The file included for a certain user is placed in a subdirectory whose name is the JID of the host, and is named by appending ".xml" to the node part of the user's JID, e.g. "capulet.com/juliet.xml".</p>
  291. <example caption='The host file, which includes user files'><![CDATA[
  292. <?xml version='1.0' encoding='UTF-8'?>
  293. <host xmlns='urn:xmpp:pie:0'
  294. xmlns:xi='http://www.w3.org/2001/XInclude'
  295. jid='capulet.com'>
  296. <xi:include href='capulet.com/juliet.xml'/>
  297. <xi:include href='capulet.com/mercutio.xml'/>
  298. </host>
  299. ]]></example>
  300. <p>Each user file contains a &lt;user/&gt; element, and includes all data relating to that user.</p>
  301. <example caption='The user file'><![CDATA[
  302. <?xml version='1.0' encoding='UTF-8'?>
  303. <user xmlns='urn:xmpp:pie:0'
  304. name='juliet' password='s3crEt'>
  305. <query xmlns='jabber:iq:roster'>
  306. <item jid='romeo@montague.net'
  307. name='Romeo'
  308. subscription='both'>
  309. <group>Friends</group>
  310. </item>
  311. </query>
  312. <vCard xmlns='vcard-temp'>
  313. <FN>Juliet Capulet</FN>
  314. </vCard>
  315. <offline-messages>
  316. <message xmlns='jabber:client'
  317. from='romeo@montague.net/orchard'
  318. to='juliet@capulet.com/balcony'
  319. type='chat'>
  320. <body>Neither, fair saint, if either thee dislike.</body>
  321. <delay xmlns='urn:xmpp:delay'
  322. from='capulet.com'
  323. stamp='1469-07-21T00:32:29Z'>
  324. Offline Storage
  325. </delay>
  326. </message>
  327. </offline-messages>
  328. </user>
  329. ]]>
  330. </example>
  331. <p>The definition of JIDs ensures that this generates valid file names on traditional Unix-like file systems, except for possible length constraints. However, various constraints may force an exporting server to alter this scheme. In any case, the importing server MUST NOT rely on this layout, but MUST do proper XInclude processing.</p>
  332. </section2>
  333. </section1>
  334. <section1 topic='Security Considerations' anchor='security'>
  335. <p>Exported data files are to be handled with care, since they contain data that users expect to be protected, in particular passwords. An exporting server SHOULD make sure that the generated file is not accessible to unauthorized persons, e.g. by enforcing strict file permissions.</p>
  336. <p>XInclude &lt;include/&gt; elements which are indirect descendants of the &lt;user/&gt; element SHOULD be treated as opaque user data, and SHOULD NOT be processed.</p>
  337. </section1>
  338. <section1 topic='IANA Considerations' anchor='iana'>
  339. <p>This document requires no interaction with &IANA;.</p>
  340. </section1>
  341. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  342. <section2 topic='Protocol Namespaces' anchor='registrar-ns'>
  343. <p>This specification defines the following XML namespace:</p>
  344. <ul>
  345. <li>urn:xmpp:pie:0</li>
  346. </ul>
  347. <p>The &REGISTRAR; includes the foregoing namespace in its registry at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>
  348. </section2>
  349. <section2 topic='Protocol Versioning' anchor='registrar-versioning'>
  350. &NSVER;
  351. </section2>
  352. </section1>
  353. <section1 topic='XML Schema' anchor='schema'>
  354. <code><![CDATA[
  355. <?xml version='1.0' encoding='UTF-8'?>
  356. <xs:schema
  357. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  358. targetNamespace='urn:xmpp:pie:0'
  359. xmlns='urn:xmpp:pie:0'
  360. elementFormDefault='qualified'>
  361. <xs:annotation>
  362. <xs:documentation>
  363. The protocol documented by this schema is defined in
  364. XEP-0227: http://xmpp.org/extensions/xep-0227.html
  365. </xs:documentation>
  366. </xs:annotation>
  367. <xs:element name='server-data'>
  368. <xs:complexType>
  369. <xs:sequence>
  370. <xs:element ref='host' maxOccurs='unbounded'/>
  371. <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
  372. </xs:sequence>
  373. </xs:complexType>
  374. </xs:element>
  375. <xs:element name='host'>
  376. <xs:complexType>
  377. <xs:sequence>
  378. <xs:element ref='user' maxOccurs='unbounded'/>
  379. <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
  380. </xs:sequence>
  381. <xs:attribute name='jid' type='xs:string' use='required'/>
  382. </xs:complexType>
  383. </xs:element>
  384. <xs:element name='user'>
  385. <xs:complexType>
  386. <xs:sequence>
  387. <xs:element ref='offline-messages' minOccurs='0' maxOccurs='1'/>
  388. <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
  389. </xs:sequence>
  390. <xs:attribute name='name' type='xs:string' use='required'/>
  391. <xs:attribute name='password' type='xs:string' use='optional'/>
  392. </xs:complexType>
  393. </xs:element>
  394. <xs:element name='offline-messages'>
  395. <xs:complexType>
  396. <xs:sequence>
  397. <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
  398. </xs:sequence>
  399. </xs:complexType>
  400. </xs:element>
  401. </xs:schema>
  402. ]]></code>
  403. </section1>
  404. </xep>