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.2.0 (2020-02-03)
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:1.

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. If a client requests the inbox without RSM, the server MAY limit the number of conversations arbitrarily by either time or number. This element has a number of attributes:

The server responds with a sequence of <message/> stanzas, each containing an <entry/> element qualified by the urn:xmpp:inbox:1 namespace with a number of attributes:

If the messages attribute is missing or set to true, the <entry/> element is followed by 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:1. 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.

4. Unread Messages

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

5. Examples

Let us assume a user has only three jids they have exchanged messages with. Asking for their inbox is simple:

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

The server responds with a list of conversations:

Example 2.
    <message>
      <entry xmlns='urn:xmpp:inbox:1' unread='5' jid='first_contact@example.net' id='uuid-1'/>
      <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>
    </message>

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

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

If the id of a conversation has changed, a client might fetch the missing messages and metadata by requesting the MAM archive with the jid of the entry, and after the previous known id for the conversation.

After the list of conversations, 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:1' total='3' unread='2' all-unread='6'>
          <!-- 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) [8].

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 and several others at the XMPP Summit 24 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.2.0
Last Updated
2020-02-03
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-0427: MAM Fastening Collation <https://xmpp.org/extensions/xep-0427.html>.

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

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

8. 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.2.0 (2020-02-03)
    Updates from the Summit 24 discussion:
    dwd
  2. Version 0.1.0 (2020-01-29)
    Accepted by vote of Council on 2020-01-22.
    XEP Editor (jsc)
  3. Version 0.0.1 (2019-12-30)
    dwd

END