This JEP defines a protocol for flexible, POP3-like handling of offline messages in Jabber/XMPP.
NOTICE: The protocol defined herein is a Draft Standard of the Jabber Software Foundation. Implementations are encouraged and the protocol is appropriate for deployment in production systems, but some changes to the protocol are possible before it becomes a Final Standard.
Status: Draft
Type: Standards Track
Number: 0013
Version: 1.1
Last Updated: 2004-01-22
JIG: Standards JIG
Approving Body: Jabber Council
Dependencies: XMPP Core, XMPP IM, JEP-0030, JEP-0082
Supersedes: None
Superseded By: None
Short Name: offline
Schema: <http://jabber.org/protocol/offline/offline.xsd>
Email: stpeter@jabber.org
JID: stpeter@jabber.org
Email: ckaes@jabber.com
JID: ckaes@corp.jabber.com
This Jabber Enhancement Proposal is copyright 1999 - 2005 by the Jabber Software Foundation (JSF) and is in full conformance with the JSF's Intellectual Property Rights Policy <http://www.jabber.org/jsf/ipr-policy.shtml>. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at <http://www.opencontent.org/openpub/>).
The preferred venue for discussion of this document is the Standards-JIG discussion list: <http://mail.jabber.org/mailman/listinfo/standards-jig>.
The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the Jabber Software Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this JEP has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
The current means for retrieving one's offline messages is simple: one sends available presence to the server and, as a consequence, the server sends a one-time "flood" of all the messages that have been stored while one was offline. This simplification has the following deficiencies:
It can be overwhelming, which is undesirable for the vacationer or heavy user. Many individuals upon returning to work from a weeklong vacation spend the first few hours wading through the dozens, even hundreds, of emails that they received during their absence. Unlucky, however, is this user who then logs onto their Jabber server and is bombarded by hundreds of instant messages, possibly in scores of popup dialogs, simultaneously. Should their client crash, they have lost all communication that occurred while they were away.
It can be difficult to integrate with web-based email clients, which is undesirable for some portals. Several large portals are currently trying to blur the distinction between IM and email -- providing both through one web interface. With offline retrieval semantics so vastly different between the two, this is quite difficult.
What is needed is a flexible semantic for offline message handling, similar to POP3 in the email world (see RFC 1939 [1]). This would enable the wireless user to view header information for all offline messages and select only those from their boss and important clients for viewing. It would enable the vacationer to read and delete their messages one at a time, minimizing the possibility of losing all correspondence. And it would provide for seamless integration with existing web-based email clients.
In particular, such a protocol must support the following use cases:
In order to discover whether one's server supports this protocol, one uses Service Discovery [2].
<iq type='get' to='montague.net'> <query xmlns='http://jabber.org/protocol/disco#info'/> </iq>
<iq type='result' from='montague.net' to='romeo@montague.net/orchard'> <query xmlns='http://jabber.org/protocol/disco#info'/> ... <feature var='http://jabber.org/protocol/offline'/> ... </query> </iq>
If the server supports this protocol, it MUST return a <feature/> element in the disco result with the 'var' attribute set to the namespace name for this protocol: 'http://jabber.org/protocol/offline'.
So that the user may determine whether to view a full message, the header infromation provided MUST include the full Jabber ID of the sender (encoded in the 'name' attribute) and a unique identifier for the message within the user's "inbox" (encoded in the 'node' attribute), so that the user may appropriately manage (view or remove) the message.
In order to retrieve meta-information about the message, the user sends a disco#items request without a 'to' address (i.e., implicitly to the user himself) and with the disco node specified as 'http://jabber.org/protocol/offline'.
<iq type='get'> <query xmlns='http://jabber.org/protocol/disco#items' node='http://jabber.org/protocol/offline'/> </iq>
Upon receiving this request, the server MUST return headers for all of the user's offline messages. The server also MUST NOT send a flood of offline messages if the user subsequently sends initial presence to the server during this session. Thus the user is now free to send initial presence (if desired) and to engage in normal IM activities while continuing to read through offline messages. Note well: once the user sends presence, the user's server MUST deliver in-session messages as usual; this JEP applies to offline messages only! In addition, if the user authenticates and provides presence for another resource while the first (non-flood) resource still has an active session, the server MUST NOT flood the second resource with the offline message queue.
<iq type='result' to='romeo@montague.net/orchard'> <query xmlns='http://jabber.org/protocol/disco#items' node='http://jabber.org/protocol/offline'> <item jid='romeo@montague.net' node='2003-02-27T22:49:17.008Z' name='mercutio@shakespeare.lit/pda'/> <item jid='romeo@montague.net' node='2003-02-27T22:52:37.225Z' name='juliet@capulet.com/balcony'/> <item jid='romeo@montague.net' node='2003-02-27T22:52:51.270Z' name='juliet@capulet.com/balcony'/> <item jid='romeo@montague.net' node='2003-02-27T22:53:03.421Z' name='juliet@capulet.com/balcony'/> <item jid='romeo@montague.net' node='2003-02-27T22:53:13.925Z' name='juliet@capulet.com/balcony'/> </query> </iq>
If the requestor is a JID other than an authorized resource of the user, the server MUST return a "Forbidden" error. If the requestor is authorized but the node does not exist, the server MUST return an "Item Not Found" error. If there are no offline messages for this user, the server MUST return an empty query as defined in JEP-0030. (For information about the syntax of error conditions, refer to Error Condition Mappings [3].)
The syntax and semantics of the attributes are as follows:
Messages are viewed based on the value of the 'node' attribute as provided for each item returned by the server in the header information. A user MAY request one or more messages in the same IQ get.
<iq type='get' id='view1'> <offline xmlns='http://jabber.org/protocol/offline'> <item action='view' node='2003-02-27T22:52:37.225Z'/> </offline> </iq>
If the requestor is a JID other than an authorized resource of the user, the server MUST return a "Forbidden" error. If the requestor is authorized but the node does not exist, the server MUST return an "Item Not Found" error. Otherwise, the server MUST send the requested message(s) plus an IQ result:
<message to='romeo@montague.net' from='juliet@capulet.com/balcony'> <body>O Romeo, Romeo! wherefore art thou Romeo?</body> <offline xmlns='http://jabber.org/protocol/offline'> <item node='2003-02-27T22:52:37.225Z'/> </offline> </message> <iq type='result' to='user@domain/resource' id='view1'/>
In order to distinguish incoming messages, each message MUST contain the node value.
A server MUST NOT remove a message simply because it has been requested by and delivered to the user; instead, the user must specifically request to remove a message. This further implies that the user's offline message queue SHOULD NOT be automatically cleared out by the server if there are offline messages remaining when the user's session ends. However, a server or deployment MAY remove messages according to its own algorithms (e.g., storage timeouts based on a "first in first out" rule) or policies (e.g., message queue size limits) if desired.
As with viewing, messages are removed based on the value of the 'node' attribute as provided for each item returned by the server in the header information. The user MAY request the removal of one or more messages in the same IQ set.
<iq type='set' id='remove1'> <offline xmlns='http://jabber.org/protocol/offline'> <item action='remove' node='2003-02-27T22:49:17.008Z' <item action='remove' node='2003-02-27T22:52:37.225Z'/> </offline> </iq>
If the requestor is a JID other than an authorized resource of the user, the server MUST return a "Forbidden" error. If the requestor is authorized but the node does not exist, the server MUST return a "Item Not Found" error. Otherwise, the server MUST remove the messages and inform the user:
<iq type='result' to='romeo@montague.net/orchard' id='remove1'/>
The user retrieves all message by sending the "fetch" command:
<iq type='get' id='fetch1'> <offline xmlns='http://jabber.org/protocol/offline'> <fetch/> </offline> </iq>
If the requestor is a JID other than an authorized resource of the user, the server MUST return a "Forbidden" error. If the requestor is authorized but the node does not exist, the server MUST return a "Item Not Found" error. Otherwise, the server MUST retrieve all messages and inform the user:
<message to='romeo@montague.net' from='juliet@capulet.com/balcony'> <body>O Romeo, Romeo! wherefore art thou Romeo?</body> <offline xmlns='http://jabber.org/protocol/offline'> <item node='2003-02-27T22:52:37.225Z'/> </offline> </message> ... <iq type='result' to='romeo@montague.net/orchard' id='fetch1'/>
A client MAY retrieve all messages without first requesting message headers. In this case, the server MUST return all of the user's offline messages and also MUST NOT send a flood of offline messages if the user subsequently sends initial presence to the server during this session. That is, the semantics here are the same as for requesting message headers.
The user removes all message by sending the "purge" command:
<iq type='set' id='purge1'> <offline xmlns='http://jabber.org/protocol/offline'> <purge/> </offline> </iq>
If the requestor is a JID other than an authorized resource of the user, the server MUST return a "Forbidden" error. If the requestor is authorized but the node does not exist, the server MUST return a "Item Not Found" error. Otherwise, the server MUST remove all messages and inform the user:
<iq type='result' to='romeo@montague.net/orchard' id='purge1'/>
This section shows the flow of protocol between client (C:) and server (S:) for the existing (flood) scenario and the improved (POP3-like) scenario.
C: <stream:stream ...> S: <stream:stream ...> C: authentication (SASL in XMPP, non-SASL in older systems) S: acknowledge successful authentication C: <presence/> S: send message flood to Client C: receive flood, send and receive messages, etc. ... and so on
The semantics change with POP-like offline message handling, and server behavior changes as well...
C: <stream:stream ...> S: <stream:stream ...> C: authentication (SASL in XMPP, non-SASL in older systems) S: acknowledge successful authentication C: request message headers S: send message headers to Client NOTE: Server now MUST NOT flood Client with offline messages. C: <presence/> NOTE: Server does not flood Client with offline messages, but sends in-session messages as usual. C: request and remove offline messages, send and receive messages, etc. ... and so on
A server MUST NOT deliver a user's offline messages to any JID except one of the user's authorized resources.
This JEP requires no interaction with the Internet Assigned Numbers Authority (IANA) [5].
The 'http://jabber.org/protocol/offline' protocol namespace shall be registered with the Jabber Registrar [6] as a result of this JEP.
<?xml version='1.0' encoding='UTF-8'?> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://jabber.org/protocol/offline' xmlns='http://jabber.org/protocol/offline' elementFormDefault='qualified'> <xs:annotation> <xs:documentation> The protocol documented by this schema is defined in JEP-0013: http://www.jabber.org/jeps/jep-0013.html </xs:documentation> </xs:annotation> <xs:element name='offline'> <xs:complexType> <xs:sequence> <xs:element ref='item' minOccurs='1' maxOccurs='unbounded'/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name='item'> <xs:complexType> <xs:attribute name='action' use='optional'> <xs:simpleType> <xs:restriction base='xs:NCName'> <xs:enumeration value='remove'/> <xs:enumeration value='view'/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name='jid' type='xs:string' use='optional'/> <xs:attribute name='node' type='xs:string' use='required'/> </xs:complexType> </xs:element> </xs:schema>
1. RFC 1939: Post Office Protocol - Version 3 <http://www.ietf.org/rfc/rfc1939.txt>.
2. JEP-0030: Service Discovery <http://www.jabber.org/jeps/jep-0030.html>.
3. JEP-0086: Error Condition Mappings <http://www.jabber.org/jeps/jep-0086.html>.
4. JEP-0082: Jabber Date and Time Profiles <http://www.jabber.org/jeps/jep-0082.html>.
5. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.
6. The Jabber Registrar maintains a list of reserved Jabber protocol namespaces as well as registries of parameters used in the context of protocols approved by the Jabber Software Foundation. For further information, see <http://www.jabber.org/registrar/>.
END