XEP-0430: Inbox

Abstract
This specification proposes a mechanism by which clients can find a list of ongoing conversations and their state.
Author
Dave Cridland
Copyright
© 1999 – 2020 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

Experimental

WARNING: This Standards-Track document is Experimental. Publication as an XMPP Extension Protocol does not imply approval of this proposal by the XMPP Standards Foundation. Implementation of the protocol described herein is encouraged in exploratory implementations, but production systems are advised to carefully consider whether it is appropriate to deploy implementations of this protocol before it advances to a status of Draft.
Type
Standards Track
Version
0.1.0 (2020-01-29)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Draft
  4. Final

1. Introduction

When initially run, a messaging client typically shows some list of contacts and chatrooms, and whether any new messages are present in each.

The current mechanism for achieving this UX involves a complete synchronization of the server-side archive, and is both time-consuming and bandwidth-intensive. This specification proposes a solution to directly obtain such data from the server.

Moreover, the information gathered by the server to support this can be used in support of mobile push notifications.

1.1 Terminology

Nomenclature used for instant messages versus ancillary messages will need to be adjusted to make it consistent with Message Fastening (XEP-0422) [1] et al.

2. Overview

2.1 Discovering Support

Support for this protocol is advertised by the Service Discovery protocol defined in Service Discovery (XEP-0030) [2] using a feature of urn:xmpp:inbox:0.

2.2 The Inbox

The Inbox consists semantically of a list of conversations in order of last activity. Each conversation is identified by a jid - for group chats this would be the chatroom, and for individual contacts this would be their bare jid.

Each Inbox entry includes a count of messages considered new, the last MAM stanza-id relating to this conversation, and the last MAM result for this conversation, as defined by Message Archive Management (XEP-0313) [3]. In addition, a client-controlled boolean marker can be used to indicate a manual "set unread" state.

Finding more messages from this conversation can be achieved via a MAM query using with to specify the conversation required.

3. Protocol Elements

3.1 Querying

An <iq/> of type "get" is used, containing a single element <inbox/>, containing an optional RSM filter as specified by Result Set Management (XEP-0059) [4]. This will typically be sent only to the user's own bare jid. The server responds with a sequence of <message/> stanzas, each containing an <entry/> element qualified by the urn:xmpp:inbox:0 namespace with a number of attributes:

The <entry/> element contains the latest instant message, if any, which is encapsulated as a <result/> element as defined by Message Archive Management (XEP-0313) [3]. This contains collated fastenings if supported by the server.

After all entries required have been returned, the server then responds with an <iq/> result containing a <fin/> element qualified by urn:xmpp:inbox:0. This contains the RSM data, a total count of conversation entries within the inbox, a count of conversations with unread messages, and a total count of unread messages.

Any counter of unread SHOULD be accurate, however client implementors please note that due to heuristics involved and other issues these counters can be inaccurate at times.

3.2 Marking

A client MAY at any time set a conversation as marked by sending an <iq/> of type "set" containing something or other. This causes the server to set the "marked" flag on a conversation. A client SHOULD display a marked conversation in the same way as an unread conversation, and explicitly removed the marked flag when the conversation is considered re-read.

Removing a marked flag, even when the conversation is not currently marked, causes the unread counter for that conversation to be set to zero.

4. Unread Messages

Servers MUST track which instant messages sent to clients remain unread.

5. Examples

Let us assume a user has only two contacts they have exchanges messages with, and a single chatroom. Asking for their inbox is simple:

Example 1.
    <iq type='get' id='iq_stanza_id'>
      <inbox xmlns='urn:xmpp:inbox:0'/>
    </iq>
    

The server responds with a list of conversations:

Example 2.
    <message>
      <entry xmlns='urn:xmpp:inbox:0' unread='2' marked='false' jid='first_contact@example.net'>
        <result xmlns='urn:xmpp:mam:2' queryid='iq_stanza_id' id='uuid-1'>
          <forwarded xmlns='urn:xmpp:forward:0'>
            <message xmlns='jabber:client' from='first_contact@example.net' to='user@example.org' type='chat'>
              <body>Greetings from Alpha Centauri!</body>
            </message>
          </forwarded>
        </result>
      </entry>
    </message>
    

After the list of messages, the server completes its response with a the reply to the original IQ.

Example 3.
      <iq type='result' id='iq_stanza_id'>
        <fin xmlns='urn:xmpp:inbox:0' total='3' unread='1' all-unread='2'>
          <!-- RSM -->
        </fin>
    

6. Schema

TODO - Hopefully roughly given by the examples.

7. Security Considerations

TODO

8. IANA Considerations

This XEP requires no interaction with the Internet Assigned Numbers Authority (IANA) [7].

9. XMPP Registrar Considerations

None.

10. Acknowledgements

The author notes that this protocol is heavily based on the mod_inbox system of MongooseIM. In addition, Kevin Smith provided useful feedback which has shaped this specification.


Appendices

Appendix A: Document Information

Series
XEP
Number
0430
Publisher
XMPP Standards Foundation
Status
Experimental
Type
Standards Track
Version
0.1.0
Last Updated
2020-01-29
Approving Body
XMPP Council
Dependencies
XMPP Core, XEP-0313
Supersedes
None
Superseded By
None
Short Name
inbox
Source Control
HTML

This document in other formats: XML  PDF

Appendix B: Author Information

Dave Cridland
Email
dave@hellopando.com
JabberID
dwd@dave.cridland.net

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2020 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).

Visual Presentation

The HTML representation (you are looking at) is maintained by the XSF. It is based on the YAML CSS Framework, which is licensed under the terms of the CC-BY-SA 2.0 license.

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) 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.

Appendix E: Discussion Venue

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

Appendix F: Requirements Conformance

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

Appendix G: Notes

1. XEP-0422: Message Fastening <https://xmpp.org/extensions/xep-0422.html>.

2. XEP-0030: Service Discovery <https://xmpp.org/extensions/xep-0030.html>.

3. XEP-0313: Message Archive Management <https://xmpp.org/extensions/xep-0313.html>.

4. XEP-0059: Result Set Management <https://xmpp.org/extensions/xep-0059.html>.

5. XEP-0333: Chat Markers <https://xmpp.org/extensions/xep-0333.html>.

6. XEP-0184: Message Delivery Receipts <https://xmpp.org/extensions/xep-0184.html>.

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

Appendix H: Revision History

Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/

  1. Version 0.1.0 (2020-01-29)
    Accepted by vote of Council on 2020-01-22.
    XEP Editor (jsc)
  2. Version 0.0.1 (2019-12-30)
    dwd

END