%ents; ]>
Flexible Offline Message Retrieval This document defines an XMPP protocol extension for flexible, POP3-like handling of offline messages. &LEGALNOTICE; 0013 Draft Standards Track Standards XMPP Core XMPP IM XEP-0030 XEP-0082 offline http://www.xmpp.org/schemas/offline.xsd &stpeter; Craig Kaes ckaes@jabber.com ckaes@corp.jabber.com 1.2 2005-07-14 psa Added use case for retrieving number of messages; defined registar considerations more completely. 1.1 2004-01-22 psa Editorial revisions. 1.0 2003-09-09 psa Per a vote of the Jabber Council, advanced status to Draft. 0.8 2003-08-25 psa More changes to address Council feedback: removed bandwidth rationale in requirements; added protocol flow section; adjusted semantics for node values (opaque, but dictionary ordering allowed). Also added <fetch/> and <purge/> elements. 0.7 2003-08-21 psa Changes to address Council feedback: added error codes; enhanced the security considerations; clarified the nature of the node IDs and removed the protocol URI string (leaving only the timestamp). 0.6 2003-06-10 psa Slight fixes to XEP-0082 reference and XML schema. 0.5 2003-04-28 psa Added reference to XEP-0082; changed timestamp format to use milliseconds rather than ten-thousandths of a second; made several small editorial changes throughout. 0.4 2003-02-27 psa Major overhaul: clarified requirements, incorporated disco, simplified and updated the protocol, specified syntax and semantics for nodes, defined business rules, and added XML schema. 0.3 2002-10-02 cak Reworked to exclude XDBID performace hack, thereby maximizing palatability. Removed all changes made by psa. 0.2 2002-10-02 psa Changed type and added information about scope. 0.1 2002-01-11 cak Initial version

Although not required to do so by &rfc3920; and &rfc3921;, many existing Jabber/XMPP instant messaging servers will store messages received while a user is offline and deliver them when the user is next online. Such messages are commonly called "offline messages". The current means of 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:

  1. 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.

  2. 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 &rfc1939;). 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 should support the following use cases:

  1. Client determines server support for this protocol.
  2. Client requests number of messages.
  3. Client requests message "header" information (thereby choosing flexible offline message retrieval as opposed to old-fashioned "flood" mode).
  4. Client retrieves specific messages.
  5. Client removes specific messages.
  6. Client retrieves all messages.
  7. Client removes all messages.

In order to discover whether one's server supports this protocol, one uses &xep0030;.

]]> ... ... ]]>

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'.

RFC 1939 includes a feature (the "STAT" command) that enables a user to determine how many messages are waiting to be retrieved (without retrieving all of the headers). Such a feature would be helpful in Jabber/XMPP as well, especially if the client is constrained with regard to storage capacity or available bandwidth.

In order to determine the number of messages in the offline message queue, the user sends a disco#info request without a 'to' address (i.e., implicitly to the user himself) and with the disco node specified as 'http://jabber.org/protocol/offline':

]]>

If the server supports retrieval of the number of messages, it MUST include &xep0128; data specifying the number of messages:

http://jabber.org/protocol/offline 66 ]]>

Upon receiving a service discovery request addressed to a node of "http://jabber.org/protocol/offline" (either a disco#info request as in this use case or a disco#items request as in the next use case), the server 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. However, once the user sends presence, the user's server MUST deliver in-session messages as usual; this document 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.

In order to retrieve headers for all of the messages in the queue, 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'.

]]>

The server now MUST return headers for all of the user's offline messages. So that the user may determine whether to view a full message, the header information 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.

]]>

If the requester is a JID other than an authorized resource of the user (i.e., the user@host of the requester does not match the user@host of the user), the server MUST return a &forbidden; error. If the requester is authorized but the node does not exist, the server MUST return an ¬found; error. If there are no offline messages for this user, the server MUST return an empty query as defined in XEP-0030. (For information about the syntax of error conditions, refer to &xep0086;.)

The syntax and semantics of the attributes are as follows:

  • The 'jid' attribute is the Jabber ID with which the item nodes are associated, i.e., the user himself.
  • The 'name' attribute is the full JID of the sender as received in the 'from' address of the message itself.
  • The 'node' attribute is a unique identifier for the message. The value SHOULD be considered opaque, but applications MAY perform character-by-character dictionary ordering on the values. This enables applications to implement ordering on messages, such as that shown above, wherein the node values are UTC timestamps (if timestamps are used, they MUST conform to the 'Datetime' profile defined in &xep0082;).

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.

]]>

If the requester is a JID other than an authorized resource of the user, the server MUST return a &forbidden; error. If the requester is authorized but the node does not exist, the server MUST return an ¬found; error. Otherwise, the server MUST send the requested message(s) plus an IQ result:

O Romeo, Romeo! wherefore art thou Romeo? ]]>

In order to distinguish incoming messages, each message MUST contain the node value. It is RECOMMENDED for the server to include &xep0091; information in the message.

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, an implementation 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.

]]>

If the requester is a JID other than an authorized resource of the user, the server MUST return a &forbidden; error. If the requester is authorized but the node does not exist, the server MUST return a ¬found; error. Otherwise, the server MUST remove the messages and inform the user:

]]>

The user retrieves all message by sending the "fetch" command:

]]>

If the requester is a JID other than an authorized resource of the user, the server MUST return a &forbidden; error. If the requester is authorized but the node does not exist, the server MUST return a ¬found; error. Otherwise, the server MUST retrieve all messages and inform the user:

O Romeo, Romeo! wherefore art thou Romeo? ... ]]>

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:

]]>

If the requester is a JID other than an authorized resource of the user, the server MUST return a &forbidden; error. If the requester is authorized but the node does not exist, the server MUST return a ¬found; error. Otherwise, the server MUST remove all messages and inform the user:

]]>

This section shows the flow of protocol between client (C:) and server (S:) for the existing (flood) scenario and the improved (POP3-like) scenario.

S: C: authentication (SASL in XMPP, non-SASL in older systems) S: acknowledge successful authentication C: 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...

S: 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: 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 document requires no interaction with &IANA;.

The ®ISTRAR; includes 'http://jabber.org/protocol/offline' in its registry of protocol namespaces.

The XMPP Registrar includes "automation" in its registry of Service Discovery categories for use for any entities and nodes that provide automated or programmed interaction. This document specifies the following new types for the "automation" category:

Type Description
message-list The node for the offline message queue; valid only for the node "http://jabber.org/protocol/offline".
message-node A node for a specific offline message if service discovery is provided for messages.

The registry submission is as follows:

message-list The node for the offline message queue; valid only for the node "http://jabber.org/protocol/offline" XEP-0013 message-node A node for a specific offline message if service discovery is provided for messages XEP-0013 ]]>

The XMPP Registrar includes "http://jabber.org/protocol/offline" in its registry of well-known Service Discovery nodes.

&xep0068; defines a process for standardizing the fields used within Data Forms qualified by a particular namespace. There is one uses of such forms in offline message retrieval as described in the Requesting Number of Messages section of this XEP. The registry submission is as follows:

http://jabber.org/protocol/offline XEP-0013 Service Discovery extension for number of messages in an offline message queue. ]]>
The protocol documented by this schema is defined in XEP-0013: http://www.xmpp.org/extensions/xep-0013.html ]]>