1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-12-22 07:38:52 -05:00
xeps/xep-0160.xml

131 lines
7.7 KiB
XML
Raw Normal View History

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Best Practices for Handling Offline Messages</title>
<abstract>This document specifies best practices to be followed by Jabber/XMPP servers in handling messages sent to recipients who are offline.</abstract>
&LEGALNOTICE;
<number>0160</number>
<status>Active</status>
<type>Informational</type>
<jig>Standards JIG</jig>
<approver>Council</approver>
<dependencies>
<spec>XMPP Core</spec>
<spec>XMPP IM</spec>
<spec>XEP-0030</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>msgoffline</shortname>
&stpeter;
<revision>
<version>1.0</version>
<date>2006-01-24</date>
<initials>psa</initials>
<remark>Per a vote of the Jabber Council, advanced status to Active.</remark>
</revision>
<revision>
<version>0.2</version>
<date>2005-11-15</date>
<initials>psa</initials>
<remark>Added section on handling of each message type.</remark>
</revision>
<revision>
<version>0.1</version>
<date>2005-10-05</date>
<initials>psa</initials>
<remark>Initial version.</remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2005-09-27</date>
<initials>psa</initials>
<remark>First draft.</remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>&rfc3920; and &rfc3921; specify general rules for handling XML stanzas, but explicitly do not address how to handle message stanzas sent to recipients (e.g., IM users or other nodes) that are offline, except to say that a server MUST return a &unavailable; error if offline message storage or message forwarding is not enabled (see Section 11.1 of <cite>RFC 3921</cite>). This document fills the gap by specifying best practices for storage and delivery of so-called "offline messages".</p>
</section1>
<section1 topic='Process Flow' anchor='flow'>
<p>The RECOMMENDED process flow is as follows:</p>
<ol>
<li>Sender generates XMPP message stanza <note>This document does not discuss IQ or presence stanzas, handling of which is described in <cite>RFC 3920</cite> and <cite>RFC 3921</cite>.</note> for delivery to a recipient such as an IM user or other node, where the 'to' address is of the form &lt;node@domain&gt; or &lt;node@domain/resource&gt; (see <cite>RFC 3921</cite> for rules regarding server handling of such XMPP message stanzas).</li>
<li>Recipient's server determines that the intended recipient has no available resources that have specified non-negative presence priority. <note>As specified in <cite>RFC 3920</cite>, available resources that have specified a negative presence priority shall never receive message stanzas addressed to &lt;node@domain&gt;.</note></li>
<li>Recipient's server does not return a &unavailable; error but instead stores the message stanza for later delivery.</li>
<li>When the recipient next sends non-negative available presence to the server, the server delivers the message to the resource that has sent that presence. (Alternatively, the server may support &xep0013;, although that functionality is not described herein.)</li>
</ol>
<p>This flow is described more fully below.</p>
<p>First, the sender (in this example, romeo@montague.net) sends a message to an intended recipient (juliet@capulet.com).</p>
<example caption='Sender Generates Message to Recipient'><![CDATA[
<message from='romeo@montague.net/orchard' to='juliet@capulet.com'>
<body>
O blessed, blessed night! I am afeard.
Being in night, all this is but a dream,
Too flattering-sweet to be substantial.
</body>
</message>
]]></example>
<p>Next, the recipient's server determines if there are any available resources that have sent non-negative presence priority. If there are, the server immediately delivers the message stanza to the resource that it determines to be most available (based on its own algorithm). If there are not, the server stores the message for later delivery.</p>
<p>Now the recipient authenticates with the server and sends initial presence (with a non-negative priority) to the server.</p>
<example caption='Recipient Becomes Available'><![CDATA[
<presence from='juliet@capulet.com/balcony'>
<priority>1</priority>
</presence>
]]></example>
<p>The recipient's server now delivers the offline message to that resource (it is RECOMMENDED for the server to add a &xep0091; extension to indicate that the message was stored offline).</p>
<example caption='Recipient&apos;s Server Delivers Message'><![CDATA[
<message from='romeo@montague.net/orchard' to='juliet@capulet.com'>
<body>
O blessed, blessed night! I am afeard.
Being in night, all this is but a dream,
Too flattering-sweet to be substantial.
</body>
<x from='capulet.com' stamp='20020910T23:08:25' xmlns='jabber:x:delay'>
Offline Storage
</x>
</message>
]]></example>
</section1>
<section1 topic='Handling of Message Types' anchor='types'>
<p>Message stanzas SHOULD be handled by a server as follows (based on the values of the 'type' attribute specified in <cite>RFC 3921</cite>):</p>
<ul>
<li><p><strong>normal</strong> -- Messages with a 'type' attribute whose value is "normal" (or messages with no 'type' attribute) SHOULD be stored offline.</p></li>
<li><p><strong>chat</strong> -- Messages with a 'type' attribute whose value is "chat" SHOULD be stored offline, with the exception of messages that contain only &xep0085; content (such messages SHOULD NOT be stored offline).</p></li>
<li><p><strong>groupchat</strong> -- Messages with a 'type' attribute whose value is "groupchat" SHOULD NOT be stored offline, since by definition a user without online presence cannot be in a &xep0045; room.</p></li>
<li><p><strong>headline</strong> -- Messages with a 'type' attribute whose value is "headline" SHOULD NOT be stored offline, since such messages are usually time-sensitive.</p></li>
<li><p><strong>error</strong> -- Messages with a 'type' attribute whose value is "error" SHOULD NOT be stored offline, although a server MAY store &xep0079; error messages offline.</p></li>
</ul>
</section1>
<section1 topic='Service Discovery' anchor='disco'>
<p>If a server supports offline message handling as described herein, it SHOULD return a "msgoffline" feature in response to &xep0030; information requests:</p>
<example caption='Recipient Queries Server About Support'><![CDATA[
<iq from='juliet@capulet.com/chamber' to='capulet.com'>
<query xmlns='http://jabber.org/disco#info'/>
</iq>
]]></example>
<example caption='Server Returns Information About Support'><![CDATA[
<iq from='capulet.com' to='juliet@capulet.com/chamber'>
<query xmlns='http://jabber.org/disco#info'>
...
<feature var='msgoffline'/>
</query>
</iq>
]]></example>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<p>A message stored offline may not be readable by the recipient if the message was encrypted using a session-based encryption method such as &xep0116; or if the key used in object encryption is revoked after the message was sent but before it is read.</p>
<p>In certain countries, offline storage of message stanzas may introduce legal requirements or privacy vulnerabilities that do not apply to messages that are delivered immediately and never stored on an intermediate server.</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<p>The &REGISTRAR; includes "msgoffline" in its registry of service discovery features (see &DISCOFEATURES;).</p>
</section1>
</xep>