XEP-xxxx: Mentions

Abstract
This specification defines a way to mention users or groups of users.
Author
Maxime Buquet
Copyright
© 1999 – 2021 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

ProtoXEP

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 <https://xmpp.org/extensions/> and announced on the <standards@xmpp.org> mailing list.
Type
Standards Track
Version
0.0.1 (2023-03-23)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Stable
  4. Final

1. Introduction

A common feature in online communication is ability to address a message to a specific user or a group of users, and have their clients notify them on the way. Mentions have been somewhat specified in a first revision of References (XEP-0372) [1], and used in a few implementations, but they were missing the ability to mention pre-defined groups of users.

It was chosen to separate this document from References (XEP-0372) [1] to keep the original document short and generic.

2. Requirements

3. Discovering Support

An entity implementing this specification MUST advertise urn:xmpp:reference:mentions:0 as a Service Discovery (XEP-0030) [2] feature. It SHOULD also advertize subsquent features declared in this document that it supports.

4. Use Cases

This References (XEP-0372) [1] type urn:xmpp:reference:mentions:0 is defined to work with urn:xmpp:reference:1.

There may be as many references as there are users or groups of users to mention in a stanza.

Specific server support may be required to handle notifications to offline devices, commonly done via Push Notifications (XEP-0357) [3].

4.1 Modifiers

modifiers are a way to alter the behaviour of a mention. Below is the list of available modifiers, described in their own section.

Table 1: Modifiers
Tag Description
{urn:xmpp:reference:mentions:0}active Only mention active users of the targeted group.

4.1.1 Active

The active modifier changes the mention to only include the set of active users in a defined group. Whether to notify the user is left to entities handling the mention, (e.g., a server deciding whether to send push notifications to the most active device of a user, a client reading a mention and deciding whether to notify the user depending on their online status).

The active modifiers MUST be in the urn:xmpp:reference:mentions:0 namespace and placed as a child of the References (XEP-0372) [1] reference element.

4.2 Mentioning users

An entity can mention a user by sending a References (XEP-0372) [1] element with the urn:xmpp:reference:mentions:0 type, which MUST include a jid attribute filled with the JID of the user being mentioned, and MAY include an anchor attribute that takes a URI referring to the payload doing the original mentioning.

In a Multi-User Chat (XEP-0045) [4] room, one can send a References (XEP-0372) [1] element with the urn:xmpp:reference:mentions:0 type, and MUST include an occupantid attribute containing the Anonymous unique occupant identifiers for MUCs (XEP-0421) [5] identifier.

Example 1. Mention someone in a room
<message to='news@chat.commons.example' type='groupchat'>
  <!-- Supposing the stanza has been sent on a stream with xml:lang='en' -->
  <body>Hi Louise, how are you doing?</body>
  <reference xmlns='urn:xmpp:reference:1'
    type='urn:xmpp:reference:mention:1'
    begin='3'
    end='8'
    hreflang='en'
    occupantid='ddfe47eabacabr2q1'/>
  <body xml:lang='fr'>Salut Louise, ça va ?</body>
  <reference xmlns='urn:xmpp:reference:1'
    type='urn:xmpp:reference:mention:1'
    begin='7'
    end='12'
    hreflang='fr'
    occupantid='ddfe47eabacabr2q1'/>
</message>
Example 2. Mention someone from a gateway'd article
<message to='louise\40commons.example@ap.example' type='chat'>
  <reference xmlns='urn:xmpp:reference:1'
    type='urn:xmpp:reference:mention:1'
    jid='louise\40commons.example@ap.example'
    anchor='xmpp:rosa\40commons.example@ap.example?;node=urn%3Axmpp%3Amicroblog%3A0&item=ddfe47eabacabr2q1'
  />
  <store xmlns="urn:xmpp:hints"/>
  <!-- Possibly more elements not including <body/> -->
  <!-- TODO: No @begin nor @end because there's no way to designate an element other than body yet. -->
</message>

4.3 Mentioning groups of people

Many legacy services offer the possibility to mention groups of users, for example mentioning all users of a room.

The following table lists types of mentions:

Table 2: Groups
Reference type Description
urn:xmpp:reference:mentions:0#channel Mention all occupants of a room, including affiliated offline occupants, independant of their status.

An entity implementing any of the available group mentions MUST also advertize same string as a Service Discovery (XEP-0030) [2] feature.

Example 3. Mentioning all active users of a channel
<message to='news@chat.commons.example' type='groupchat'>
  <body>Hey all!</body>
  <reference xmlns='urn:xmpp:reference:1' type='urn:xmpp:reference:mention:1#channel'>
    <active/>
  </reference>
</message>

4.4 Mentioning roles or affiliations

It is possible to mention users with specific Multi-User Chat (XEP-0045) [4] roles or affiliations. The reference type to use is defined in the table below.

Table 3: Reference types
Type Description
urn:xmpp:reference:mentions:0#moderators Occupants with a moderator role
urn:xmpp:reference:mentions:0#participants Occupants with a participant role
urn:xmpp:reference:mentions:0#visitors Occupants with a visitor role
urn:xmpp:reference:mentions:0#owner Occupants with an owner affiliation
urn:xmpp:reference:mentions:0#admin Occupants with an admin affiliation
urn:xmpp:reference:mentions:0#member Occupants with a member affiliation
urn:xmpp:reference:mentions:0#none Occupants with no affiliation

An entity implementing this MUST advertize the urn:xmpp:reference:mentions:0#associations Service Discovery (XEP-0030) [2] feature.

Example 4. Mention moderators in a room
<message to='news@chat.commons.example' type='groupchat'>
  <body>Any moderator to handle the spam above please?</body>
  <reference xmlns='urn:xmpp:reference:1' type='urn:xmpp:reference:mention:1#moderators' />
</message>

4.5 Mentioning hats

To mention a Hats (XEP-0317) [6] hat, an entity MUST use the reference type urn:xmpp:reference:mentions:0#hats and the uri attribute filled with the hat URI.

An entity implementing this MUST advertize the urn:xmpp:reference:mentions:0#hats Service Discovery (XEP-0030) [2] feature.

Example 5. Mentioning all (hats) students in a room
<message to='news@chat.commons.example' type='groupchat'>
  <body>To all students, [..]</body>
  <reference xmlns='urn:xmpp:reference:1'
             type='urn:xmpp:reference:mention:1#hats'
             uri='http://schemas.example.com/hats#students'/>
</message>

4.6 Begin and end attributes

If a References (XEP-0372) [1] element of type urn:xmpp:reference:mentions:0 or its subtypes contains both begin and end attributes, the receiving entity MAY use this as a hint that the specified range of the content is being addressed to the specified users. If the element doesn't contain these attributes, the mention doesn't refer to a specific part of the content, and implementations MAY check other parts of the payload to know what it refers to, (e.g., xhtml-im links).

Begin and end pairs in a message SHOULD not overlap, except in the case where they are all equal.

Example 6. Mentioning members of a loosely defined group in a channel with many users
<message to='news@chat.commons.example' type='groupchat'>
  <body>Hi Spartacists!</body>
  <!-- @begin and @end are equal throughout all references here -->
  <reference xmlns='urn:xmpp:reference:1'
    type='urn:xmpp:reference:mention:1'
    begin='3'
    end='14'
    occupantid='rosa@occupant-id'/>
  <reference xmlns='urn:xmpp:reference:1'
    type='urn:xmpp:reference:mention:1'
    begin='3'
    end='14'
    occupantid='clara@occupant-id'/>
  <reference xmlns='urn:xmpp:reference:1'
    type='urn:xmpp:reference:mention:1'
    begin='3'
    end='14'
    occupantid='karl@occupant-id'/>
</message>

5. Implementation Notes

This specification allows sending clients to convey the user's intent. It should also allow sending users to talk about someone without having to mention them.

Anonymous unique occupant identifiers for MUCs (XEP-0421) [5] is being used to mention in Multi-User Chat (XEP-0045) [4] instead of a participant JID or a real JID. This allows us to have a common solution across MUC, and also to use a stable identifier, that is guaranteed to be unique per occupant (bare JID) and prevent usurpation.

As Anonymous unique occupant identifiers for MUCs (XEP-0421) [5] in MUC can point to multiple nicknames, it may be confusing for clients which would want to display something based on the nickname (colors, etc.). It also may be an issue for a service sending push notifications that need to device which devices to send to.

The use of the URI attribute of the original References (XEP-0372) [1] was overly generic for mentions that are meant to notify users of the network. Also, referring to (message, id) or (room, occupantid) tuples aren't possible yet. They may be specified later on.

Future developments could include mentions to all, or space, to respectively mention all users of an instance or a space.

6. Accessibility Considerations

This specification should eventually help receiving clients to remove their nickname matching regex that is bound to yield false positives and negatives results for the content they parse.

7. Internationalization Considerations

If an implementation sends a References (XEP-0372) [1] element of type urn:xmpp:reference:mentions:0 or its subtypes which contains a valid hreflang attribute that refers to content with an xml:lang attribute, it SHOULD take care to send a mention for every languages it sends.

8. Security Considerations

Being able to notify groups of people at the same time may also be used by malicious entities.

Using Anonymous unique occupant identifiers for MUCs (XEP-0421) [5] instead of a regular participant JID in MUC prevents moderators possibly leaking JIDs they have access to that other occupants don't.

9. IANA Considerations

REQUIRED.

10. XMPP Registrar Considerations

REQUIRED.

11. XML Schema

Defined in 0392?


Appendices

Appendix A: Document Information

Series
XEP
Number
xxxx
Publisher
XMPP Standards Foundation
Status
ProtoXEP
Type
Standards Track
Version
0.0.1
Last Updated
2023-03-23
Approving Body
XMPP Council
Dependencies
XMPP Core, XEP-0001, XEP-0372, XEP-0421
Supersedes
None
Superseded By
None
Short Name
NOT_YET_ASSIGNED

This document in other formats: XML  PDF

Appendix B: Author Information

Maxime Buquet
Email
pep@bouah.net
JabberID
pep@bouah.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 <https://xmpp.org/community/> 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-0372: References <https://xmpp.org/extensions/xep-0372.html>.

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

3. XEP-0357: Push Notifications <https://xmpp.org/extensions/xep-0357.html>.

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

5. XEP-0421: Anonymous unique occupant identifiers for MUCs <https://xmpp.org/extensions/xep-0421.html>.

6. XEP-0317: Hats <https://xmpp.org/extensions/xep-0317.html>.

Appendix H: Revision History

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

  1. Version 0.0.1 (2023-03-23)

    First draft.

    pep

Appendix I: Bib(La)TeX Entry

@report{buquet2023xepxxxx,
  title = {Mentions},
  author = {Buquet, Maxime},
  type = {XEP},
  number = {xxxx},
  version = {0.0.1},
  institution = {XMPP Standards Foundation},
  url = {https://xmpp.org/extensions/xep-xxxx.html},
  date = {2023-03-23/2023-03-23},
}

END