XEP-0402: PEP Native Bookmarks

Abstract
This specification defines a syntax and storage profile for keeping a list of chatroom bookmarks on the server.
Authors
  • Dave Cridland
  • JC Brand
Copyright
© 1999 – 2020 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

Draft

NOTICE: The protocol defined herein is a Draft Standard of the XMPP Standards 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.
Type
Standards Track
Version
1.1.0 (2020-05-26)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Draft
  4. Final

1. Introduction

The original Bookmarks specification (Bookmark Storage (XEP-0048) [1]) used the widely available Private XML Storage (Private XML Storage (XEP-0049) [2]), but stored all bookmarks in a single element. When the specification was moved to the Standards Track and Draft, it was also updated to use the user's Pubsub service (Best Practices for Persistent Storage of Private Data via Publish-Subscribe (XEP-0223) [3]), but kept this single element containing all bookmarks inside a single Pubsub item.

Most implementations have kept to the original, Private XML Storage based solution, and while some newer implementations have used Pubsub, these are limited in capability by the use of a single item, which prevents safe atomic updates of individual bookmarks.

Finally, while some clients used custom XML elements to store additional private metadata about bookmarks, this was usually stripped when any bookmark was edited by another client.

This specification resolves all three issues by providing a new Bookmarks specification to migrate to, and takes the opportunity to update the XML namespace in use as well. The URL storage is dropped, since it is rarely used. Storage of URL bookmarks is therefore out of scope.

This specification was originally entitled "Bookmarks 2: This Time It's Serious". Any implication of a sense of humour has been removed with the change in title.

2. Outline of use

Clients store each bookmarked chatroom as a Pubsub item within the 'urn:xmpp:bookmarks:1' node. Each item SHALL have, as item id, the Room JID of the chatroom (eg, coven@chat.shakespeare.lit). While a client can typically assume a chatroom based on Multi-User Chat (XEP-0045) [4], clients are free to store chatrooms based on any particular groupchat protocol.

The payload of the item SHALL be a conference element qualified by the 'urn:xmpp:bookmarks:1' namespace, with the following syntax:

Table 1: Syntax of conference element
Element or Attribute Definition Datatype Inclusion
'autojoin' attribute Whether the client should automatically join the conference room on login. boolean defaulting to false [5] OPTIONAL
'name' attribute A friendly name for the bookmark, specified by the user. Clients SHOULD NOT attempt to autogenerate this from the JID. string OPTIONAL
<nick/> element The user's preferred roomnick for the chatroom, if different to that specified by User Nickname (XEP-0172) [6]. In the absence of this element being present, the nickname from User Nickname (XEP-0172) [6] SHOULD be used if present. string OPTIONAL
<password/> element A password used to access the chatroom. Note this is not intended to be a secure storage. string OPTIONAL
<extensions/> element A set of child elements (of potentially any namespace). Clients MUST preserve these (particularly preserving unknown elements) when editing items. XML Elements OPTIONAL

Note: The datatypes are as defined in XML Schema Part 2 [7].

Example 1. An example of the conference element
<conference xmlns='urn:xmpp:bookmarks:1'
            name='Council of Oberon'
            autojoin='true'>
  <nick>Puck</nick>
</conference>

This bookmark would be displayed as 'Council of Oberon' and, if activated, would attempt to join the conference room 'council@conference.underhill.org' with nickname 'Puck'.

Note that a bookmark item MUST contain only one conference room.

Note also that a conference element has no truly mandatory attributes or child elements, thus the following is legal:

Example 2. Minimalist conference element
<conference xmlns='urn:xmpp:bookmarks:1'/>

3. Workflow

3.1 Registering to receive notifications

A client interested in bookmarks SHOULD include the 'urn:xmpp:bookmarks:1+notify' feature in its Entity Capabilities (XEP-0115) [8], as per Personal Eventing Protocol (XEP-0163) [9], so that it receives notifications for updates done by other clients of the user, and reacts accordingly. The actual notifications are explained in the Bookmark Notifications section of this specification.

Example 3. Client replies with +notify to a XEP-0030 query from its server
<iq from='juliet@capulet.lit/balcony' to='capulet.lit' type='result' id='disco1'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    <identity category='client' type='pc' name='poezio'/>
    <feature var='http://jabber.org/protocol/disco#info'/>
    <feature var='urn:xmpp:bookmarks:1+notify'/>
    <!-- … -->
  </query>
</iq>

3.2 Retrieving all bookmarks

Once connected, a client first retrieves the current list of bookmarks. It then SHOULD join every MUC identified by the items’ 'id' attribute that have an 'autojoin' attribute that is set to "true" or "1".

NOTE: A future version of this specification might refer to PubSub Since (XEP-0312) [10] or a similar protocol to reduce the need for full synchronisation on each connection.

Example 4. Client retrieves all bookmarks
<iq from='juliet@capulet.lit/balcony' type='get' id='retrieve1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <items node='urn:xmpp:bookmarks:1'/>
  </pubsub>
</iq>
Example 5. Server returns the bookmarks
<iq type='result'
    to='juliet@capulet.lit/balcony'
    id='retrieve1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <items node='urn:xmpp:bookmarks:1'>
      <item id='theplay@conference.shakespeare.lit'>
          <conference xmlns='urn:xmpp:bookmarks:1'
                      name='The Play&apos;s the Thing'
                      autojoin='true'>
            <nick>JC</nick>
          </conference>
      </item>
      <item id='orchard@conference.shakespeare.lit'>
          <conference xmlns='urn:xmpp:bookmarks:1'
                      name='The Orcard'
                      autojoin='1'>
            <nick>JC</nick>
            <extensions>
              <state xmlns='http://myclient.example/bookmark/state' minimized='true'/>
            </extensions>
          </conference>
      </item>
    </items>
  </pubsub>
</iq>

3.3 Adding a bookmark

Adding a bookmark means publishing a new item, with the bookmark JID as id, to the 'urn:xmpp:bookmarks:1' node.

publish-options (as defined in XEP-0060) MUST be supported by the server in order to check that the node is correctly configured before publishing a new conference. This is especially important to avoid leaking your bookmarks to your contacts for instance.

Example 6. Client adds a new bookmark
<iq from='juliet@capulet.lit/balcony' type='set' id='pip1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='urn:xmpp:bookmarks:1'>
      <item id='theplay@conference.shakespeare.lit'>
        <conference xmlns='urn:xmpp:bookmarks:1'
                    name='The Play&apos;s the Thing'
                    autojoin='true'>
          <nick>JC</nick>
        </conference>
      </item>
    </publish>
    <publish-options>
      <x xmlns='jabber:x:data' type='submit'>
        <field var='FORM_TYPE' type='hidden'>
          <value>http://jabber.org/protocol/pubsub#publish-options</value>
        </field>
        <field var='pubsub#persist_items'>
          <value>true</value>
        </field>
        <field var='pubsub#max_items'>
          <value>10000</value>
        </field>
        <field var='pubsub#send_last_published_item'>
          <value>never</value>
        </field>
        <field var='pubsub#access_model'>
          <value>whitelist</value>
        </field>
      </x>
    </publish-options>
  </pubsub>
</iq>
Example 7. Server acknowledges successful storage
<iq to='juliet@capulet.lit/balcony' type='result' id='pip1'/>

3.4 Editing a bookmark

Editing a bookmark means republishing the item, with the same bookmark JID as id, to the 'urn:xmpp:bookmarks:1' node.

Note that clients MUST preserve any XML elements they do not understand, particularly including unknown elements, within the <extensions/> element of the bookmark.

publish-options (as defined in XEP-0060) MUST be supported by the server in order to check that the node is correctly configured before publishing a new conference. This is especially important to avoid leaking your bookmarks to your contacts for instance.

Example 8. Client corrects typo in name of bookmark
<iq from='juliet@capulet.lit/balcony' type='set' id='pip2'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='urn:xmpp:bookmarks:1'>
      <item id='orchard@conference.shakespeare.lit'>
        <conference xmlns='urn:xmpp:bookmarks:1'
                    name='The Orchard'
                    autojoin='true'>
          <nick>JC</nick>
          <extensions>
            <state xmlns='http://myclient.example/bookmark/state' minimized='true'/>
          </extensions>
        </conference>
      </item>
    </publish>
    <publish-options>
      <x xmlns='jabber:x:data' type='submit'>
        <field var='FORM_TYPE' type='hidden'>
          <value>http://jabber.org/protocol/pubsub#publish-options</value>
        </field>
        <field var='pubsub#persist_items'>
          <value>true</value>
        </field>
        <field var='pubsub#max_items'>
          <value>10000</value>
        </field>
        <field var='pubsub#send_last_published_item'>
          <value>never</value>
        </field>
        <field var='pubsub#access_model'>
          <value>whitelist</value>
        </field>
      </x>
    </publish-options>
  </pubsub>
</iq>
Example 9. Server acknowledges successful storage
<iq to='juliet@capulet.lit/balcony' type='result' id='pip2'/>

3.5 Removing a bookmark

Removing a bookmark means retracting an existing item, identified by the bookmark's JID, form the 'urn:xmpp:bookmarks:1' node.

This implies that server support for the "delete-items" pubsub feature is REQUIRED.

A 'notify' attribute SHOULD be included on the <retract/> element in order to inform other online clients of the deletion.

Example 10. Client removes a new bookmark
<iq from='juliet@capulet.lit/balcony' type='set' id='remove-bookmark1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <retract node='urn:xmpp:bookmarks:1' notify='true'>
      <item id='theplay@conference.shakespeare.lit'/>
    </retract>
  </pubsub>
</iq>
Example 11. Server acknowledges successful retraction
<iq to='juliet@capulet.lit/balcony' type='result' id='remove-bookmark1'/>

4. Bookmark Notifications

When a client is sent an event from the Pubsub service for the 'urn:xmpp:bookmarks:1' node, it SHOULD join the room immediately if the 'autojoin' attribute is both present and true.

Example 12. Client receives a new bookmark notification
<message from='juliet@capulet.lit' to='juliet@capulet.lit/balcony' type='headline' id='new-room1'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='urn:xmpp:bookmarks:1'>
      <item id='theplay@conference.shakespeare.lit'>
        <conference xmlns='urn:xmpp:bookmarks:1'
                    name='The Play&apos;s the Thing'
                    autojoin='1'>
          <nick>JC</nick>
        </conference>
      </item>
    </items>
  </event>
</message>

On the other hand, if the event is a retract notification, the client SHOULD leave the room immediately.

Example 13. Client receives a bookmark retraction notification
<message from='juliet@capulet.lit' to='juliet@capulet.lit/balcony' type='headline' id='removed-room1'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='urn:xmpp:bookmarks:1'>
      <retract id='theplay@conference.shakespeare.lit'/>
    </items>
  </event>
</message>

5. Implementation Notes

5.1 Differences to XEP-0048

5.2 Storage

Publish-Subscribe (XEP-0060) [11] is used for data storage, specifically through the use of private, personal pubsub nodes (described in Best Practices for Persistent Storage of Private Data via Publish-Subscribe (XEP-0223) [3]) hosted at the user's virtual pubsub service (see Personal Eventing Protocol (XEP-0163) [9]).

5.3 Compatibility

A server MAY choose to unify the bookmarks from both Private XML Storage (XEP-0049) [2] based and the current Bookmark Storage (XEP-0048) [1].

It is encouraged to at least support unification between Private XML Storage because as of 2019 this is still the storage backend that is implemented in the majority of clients.

A server that supports unifying bookmarks from Private XML Storage (XEP-0049) [2] and Bookmarks 2 (This Time it's Serious) (XEP-0402) [12] SHOULD announce the "urn:xmpp:bookmarks:1#compat" feature on the account. Clients may use that feature as an indication that it is safe to store bookmarks using only Bookmarks 2 (This Time it's Serious) (XEP-0402) [12] without losing backward compatibility to clients that are only using Private XML Storage (XEP-0049) [2].

A server that supports unifying bookmarks between Best Practices for Persistent Storage of Private Data via Publish-Subscribe (XEP-0223) [3] and Bookmarks 2 (This Time it's Serious) (XEP-0402) [12] SHOULD announce the "urn:xmpp:bookmarks:1#compat-pep" feature on the account.

5.3.1 Publishing via this specification

When a client publishes a new item, the server MAY collate all items, casting them into the 'storage:bookmarks' namespace and setting the jid attribute to the item id in each case. When contained within a storage element qualified by the 'storage:bookmarks' namespace, this will be the correct format for both current and previous variants of Bookmark Storage (XEP-0048) [1]

5.3.2 Publishing via the old specification

If a client publishes a replacement list of bookmarks via the older specifications, a server MAY examine the list and update the individual items as required, sending updates or retraction notifications as needed. Servers electing to perform this OPTIONAL behaviour SHOULD NOT send notifications for unchanged items.

6. Determining Support

This specification relies fully on a number of others. Most particularly, support for this protocol is available if Best Practices for Persistent Storage of Private Data via Publish-Subscribe (XEP-0223) [3] is supported.

Server side unification between Private XML Storage (XEP-0049) [2] bookmarks and PEP Native Bookmarks is announced with the feature "urn:xmpp:bookmarks:1#compat" on the account.

Server side unification between the current use of XEP-0048 bookmarks (PEP) is annouced with the feature "urn:xmpp:bookmarks:1#compat-pep" on the account.

7. Acknowledgements

The authors would like to note that much of the syntax description was copied exactly from Bookmark Storage (XEP-0048) [1] by Rachel Blackman, Peter Millard, and Peter Saint-Andre. Much of the remainder of this specification is based closely on their work.

8. Security Considerations

Security considerations related to object persistence via publish-subscribe are described in XEP-0060 and XEP-0223.

The client needs to make sure that the server actually supports the "http://jabber.org/protocol/pubsub#publish-options" feature, before relying on it. If it's not supported, the client should configure the 'urn:xmpp:bookmarks:1' node first (see xep-0060), before adding any bookmarks.

9. XML Schema

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:bookmarks:1'
    xmlns='urn:xmpp:bookmarks:1'
    elementFormDefault='qualified'>

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      XEP-0402: http://www.xmpp.org/extensions/xep-0402.html
    </xs:documentation>
  </xs:annotation>

  <xs:element name='conference'>
    <xs:complexType>
      <xs:sequence>
        <xs:element name='nick' type='xs:string' minOccurs='0'/>
        <xs:element name='password' type='xs:string' minOccurs='0'/>
        <xs:element ref='extensions'/>
      </xs:sequence>
      <xs:attribute name='autojoin' type='xs:boolean' use='optional' default='false'/>
      <xs:attribute name='name' type='xs:string' use='optional'/>
    </xs:complexType>
  </xs:element>

  <xs:element name='extensions'>
    <xs:complexType>
      <xs:sequence>
        <xs:any namespace='##other'
                minOccurs='0'
                maxOccurs='unbounded'
                processContents='lax'/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Appendices

Appendix A: Document Information

Series
XEP
Number
0402
Publisher
XMPP Standards Foundation
Status
Draft
Type
Standards Track
Version
1.1.0
Last Updated
2020-05-26
Approving Body
XMPP Council
Dependencies
XEP-0223
Supersedes
None
Superseded By
None
Short Name
bookmarks2
Registry
<http://xmpp.org/registrar/bookmarks2.html>
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
JC Brand
Email
jc@opkode.com
JabberID
jc@opkode.com

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

There exists a special venue for discussion related to the technology described in this document: the <standards@xmpp.org> mailing list.

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-0048: Bookmark Storage <https://xmpp.org/extensions/xep-0048.html>.

2. XEP-0049: Private XML Storage <https://xmpp.org/extensions/xep-0049.html>.

3. XEP-0223: Best Practices for Persistent Storage of Private Data via Publish-Subscribe <https://xmpp.org/extensions/xep-0223.html>.

4. XEP-0045: Multi-User Chat <https://xmpp.org/extensions/xep-0045.html>.

5. In accordance with Section 3.2.2.1 of XML Schema Part 2: Datatypes, the allowable lexical representations for the xs:boolean datatype are the strings "0" and "false" for the concept 'false' and the strings "1" and "true" for the concept 'true'; implementations MUST support both styles of lexical representation.

6. XEP-0172: User Nickname <https://xmpp.org/extensions/xep-0172.html>.

7. XML Schema Part 2: Datatypes <http://www.w3.org/TR/xmlschema11-2/>.

8. XEP-0115: Entity Capabilities <https://xmpp.org/extensions/xep-0115.html>.

9. XEP-0163: Personal Eventing Protocol <https://xmpp.org/extensions/xep-0163.html>.

10. XEP-0312: PubSub Since <https://xmpp.org/extensions/xep-0312.html>.

11. XEP-0060: Publish-Subscribe <https://xmpp.org/extensions/xep-0060.html>.

12. XEP-0402: Bookmarks 2 (This Time it's Serious) <https://xmpp.org/extensions/xep-0402.html>.

Appendix H: Revision History

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

  1. Version 1.1.0 (2020-05-26)

    Add schema + other editorial changes

    mb
  2. Version 1.0.0 (2020-03-31)

    Advanced to Draft per Council vote from 2020-03-04.

    XEP Editor (jsc)
  3. Version 0.4.0 (2020-02-13)
    dwd
  4. Version 0.3.0 (2019-09-28)
    egp
  5. Version 0.2.1 (2018-07-22)
    egp
  6. Version 0.2.0 (2018-03-28)
    Remove password element, add examples, update security considerations.
    jcb
  7. Version 0.1.0 (2018-03-28)
    Accepted by vote of Council on 2018-03-21.
    XEP Editor (jwi)
  8. Version 0.0.1 (2018-03-17)

    First draft

    dwd/jcb

END