Abstract: | This document defines a protocol to query an archive of messages stored on a server. |
Author: | Matthew Wild |
Copyright: | © 1999 - 2010 XMPP Standards Foundation. SEE LEGAL NOTICES. |
Status: | ProtoXEP |
Type: | Standards Track |
Version: | 0.1 |
Last Updated: | 2010-07-01 |
WARNING: This document has not yet been accepted for consideration or approved in any official manner by the XMPP Standards Foundation, and this document is not yet an XMPP Extension Protocol (XEP). If this document is accepted as a XEP by the XMPP Council, it will be published at <http://xmpp.org/extensions/> and announced on the <standards@xmpp.org> mailing list.
1. Introduction
2. Querying the archive
2.1. Filtering results
2.1.1. Filtering by contact
2.1.2. Filtering by time received
2.2. Query results
3. Archiving Preferences
3.1. Default behaviour
3.2. Always archive
3.3. Never archive
3.4. JID matching
3.4.1. General rules
3.4.2. Outgoing messages
3.4.3. Incoming messages
Appendices
A: Document Information
B: Author Information
C: Legal Notices
D: Relation to XMPP
E: Discussion Venue
F: Requirements Conformance
G: Notes
H: Revision History
Good XEP.
A client is able to query the archive for all messages within a certain timespan, optionally restricting results to those to/from a particular JID.
A query consists of an <iq/> stanza addressed to the account or server entity hosting the archive, with a 'query' payload. On receiving the query, the server pushes to the client a series of messages from the archive that match the client's given criteria, and finally returns an <iq/> result.
<iq type='get' id='juliet1'> <query xmlns='urn:xmpp:archive#management'/> </iq> [... server returns matching messages ...] <iq type='result' id='juliet1'/>
The query can contain any combination of three filtering attributes - 'with', 'start' and 'end'. By default all messages match a query, the filters are used to request a subset of the archived messages.
If a 'with' attribute is present on the query element, it contains a JID against which to match messages. The server MUST only return messages if they match the supplied JID.
If the 'with' attribute is omitted, the server SHOULD return all messages in the selected timespan, regardless of the to/from addresses on each message.
<iq type='get' id='juliet1'> <query xmlns='urn:xmpp:archive#management' with='juliet@capulet.com'/> </iq>
If (and only if) the supplied JID is a bare JID (of the form "user@domain"), then the server SHOULD return messages if their bare to/from address would match it. For example, if the client supplies with='juliet@capulet.com', this filter would also match messages to or from "juliet@capulet.com/balcony", and "juliet@capulet.com/chamber".
The 'start' and 'end' attributes, if provided, MUST contain timestamps formatted according to the DateTime profile defined in XMPP Date and Time Profiles [1]
The 'start' attribute is used to filter out messages before a certain date/time. If specified, a server MUST only return messages whose timestamp is equal to or later than the given timestamp.
If omitted, the server SHOULD assume the value of 'start' to be equal to the date/time of the earliest message stored in the archive.
Conversely, the 'end' attribute is used to exclude from the results messages after a certain point in time. If specified, a server MUST only return messages whose timestamp is equal to or earlier than the timestamp given in the 'end' attribute.
If omitted, the server SHOULD assume the value of 'end' to be equal to the date/time of the most recent message stored in the archive.
<iq type='get' id='juliet1'> <query xmlns='urn:xmpp:archive#management' start='2010-06-07T00:00:00Z' end='2002-07-07T13:23:54Z'/> </iq>
<iq type='get' id='juliet1'> <query xmlns='urn:xmpp:archive#management' start='2010-08-07T00:00:00Z' /> </iq>
The server responds to the archive query by transmitting to the client all the messages that match the criteria the client requested. The results are sent as individual stanzas, the original message wrapped in a new <message/> stanza.
The <forwarded/> element SHOULD contain the original message as it was received, and SHOULD also contain a <delay/> element qualified by the 'urn:xmpp:delay' namespace specified in Delayed Delivery [2]. The value of the 'stamp' attribute MUST be the time the message was originally received by the forwarding entity.
<message id='aeb213' to='juliet@capulet.com/chamber'> <forwarded xmlns='urn:xmpp:forward:tmp'> <delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:08:25Z'/> <message to='juliet@capulet.com/balcony' from='romeo@montague.net/orchard' type='chat'> <body>Call me but love, and I'll be new baptized; Henceforth I never will be Romeo.</body> </message> </forwarded> </message> <message id='aeb214' to='juliet@capulet.com/chamber'> <forwarded xmlns='urn:xmpp:forward:tmp'> <delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:09:32Z'/> <message to='romeo@montague.net/orchard' from='juliet@capulet.com/balcony' type='chat' id='8a54s'> <body>What man art thou that thus bescreen'd in night so stumblest on my counsel?</body> </message> </forwarded> </message>
For message archives that support preference management, the user may configure the following preferences:
<iq type='get' id='juliet1'> <prefs xmlns='urn:xmpp:archive#preferences' default="roster"> <always> <jid>romeo@montague.net</jid> </always> <never> <jid>montague@montague.net</jid> </never> </prefs> </iq>
If a JID is in neither the 'always archive' nor the 'never archive' list then whether it is archived depends on this setting, the default.
The 'default' attribute of the 'prefs' element MUST be one of the following values:
The <prefs/> element MAY contain an <always/> child element. If present, it contains a list of <jid/> elements, each containing a single JID. The server SHOULD archive any messages to/from this JID (see 'JID matching').
If missing from the preferences, <always/> SHOULD be assumed by the server to be an empty list.
The <prefs/> element MAY contain an <never/> child element. If present, it contains a list of <jid/> elements, each containing a single JID. The server SHOULD NOT archive any messages to/from this JID (see 'JID matching').
If missing from the preferences, <never/> SHOULD be assumed by the server to be an empty list.
When comparing the message target JID against the user's roster (ie. when the user has set default='roster') the comparison MUST use the bare target JID (that is, stripped of any resource).
For matching against entries in either the 'allow' or 'never' lists, for each listed JID:
For outgoing messages, the server MUST use the value of the 'to' attribute as the target JID.
For incoming messages, the server MUST use the value of the 'from' attribute as the target JID.
Series: XEP
Number: xxxx
Publisher: XMPP Standards Foundation
Status:
ProtoXEP
Type:
Standards Track
Version: 0.1
Last Updated: 2010-07-01
Approving Body: XMPP Council
Dependencies: XMPP Core, XEP-0030
Supersedes: None
Superseded By: None
Short Name: archive
Schema: <http://www.xmpp.org/schemas/archive-management.xsd>
This document in other formats:
XML
PDF
Email:
me@matthewwild.co.uk
JabberID:
me@matthewwild.co.uk
The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the XMPP Standards 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 document 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 primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.
Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.
Errata can be sent to <editor@xmpp.org>.
The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".
1. XEP-0082: XMPP Date and Time Profiles <http://xmpp.org/extensions/xep-0082.html>.
2. XEP-0203: Delayed Delivery <http://xmpp.org/extensions/xep-0203.html>.
Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/
Initial version.
(mw)END