Skip to content

XEP-0317: Hats, Update and complete the protocol #1437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

edhelas
Copy link
Contributor

@edhelas edhelas commented Apr 30, 2025

As a client developper the current Hats XEP is far from be usable and feature complete.

The goal of those changes is to:

This PR make the following changes:

  • Specify a urn:xmpp:hats:commands:dcreate command to add a hat to the available list
  • Specify a urn:xmpp:hats:commands:ddestroy command to destroy a hat from the list
  • Clarify how the service should broadcast the hat changes when it is edited, assigned, removed or destroyed
  • Specify a way for an entity to get the complete list of hats using a hash in disco#info
  • Add a hue optional parameter allowing entities to assign a color to the hat that can be displayed properly in any conditions on the client (as explained in XEP-0392: Consistent Color Generation)
  • Standardize the all the form fields using XEP-0068
  • Rename the :dlist, :don and :doff commands to :list, :assign and :unassign
  • Add myself in the list of authors
  • Fix some typos

The HTML generated version of this PR is available here: https://movim.eu/xeps/xep-0317.html

@github-actions github-actions bot added Needs Version Block The change requires a version block, and this is to be done by Editors at merge time. Needs Author The XEP is experimental and the PR was not made by the author. The author needs to acknowledge it. labels Apr 30, 2025
@edhelas edhelas changed the title XEP-0317: Update and complete the protocol XEP-0317: Hats, Update and complete the protocol Apr 30, 2025
@edhelas edhelas force-pushed the master branch 2 times, most recently from 265d78a to 9208423 Compare April 30, 2025 21:44
@lovetox
Copy link

lovetox commented Apr 30, 2025

If we need a notification mechanism, we can use the MUC Status that the config changed. See https://xmpp.org/extensions/xep-0486.html#example-7 for an example.

It does not really matter if the config is really available via MUC Config form.

What client usually do after receiving the status code, is disco the room.

So i would propose to put the full configured list of hats into disco info. That gives us out of the box a way to query the data and receive a notification when something changes. And its in line with other muc configuration which is also available in disco info.

@edhelas
Copy link
Contributor Author

edhelas commented Apr 30, 2025

@lovetox what kind of syntax would you use to list the hats in the disco#info ? 🤔

@lovetox
Copy link

lovetox commented Apr 30, 2025

hm i thought we could include a <reported> form, but seems those have no FORM_TYPE value, and therefore we cannot discover that this form belongs to hats.

Seems we are only allowed to add normal forms to disco, and these tabular data would be quite ugly in a form.

the only other idea i would have is that the room provides a hats hash in disco info. (analog to the avatar hash)
How this hash is generated is up to the server.

whenever this hash changes we know we need to query the hats via adhoc form. Basically doing exactly what we do with avatar hash, just that we dont query vcard and instead executing an adhoc command get-hats or whatever.

@edhelas
Copy link
Contributor Author

edhelas commented May 1, 2025

A hash could work and prevent those disco#info to be very verbose (I anticipate some MUCs to have like 100 hats configured like on some Discord servers).

But I'm still figuring out how you can list all the hats in a form while also integrating all their attributes, basically URI, Title and Hue Color at the moment 🤔

@lovetox
Copy link

lovetox commented May 1, 2025

Ah now i understand because adhoc is also a dataform..

@edhelas edhelas changed the title XEP-0317: Hats, Update and complete the protocol WIP: XEP-0317: Hats, Update and complete the protocol May 1, 2025
@edhelas
Copy link
Contributor Author

edhelas commented May 1, 2025

@lovetox I've updated my PR with a hash + dlist query that returns a form

@edhelas edhelas changed the title WIP: XEP-0317: Hats, Update and complete the protocol XEP-0317: Hats, Update and complete the protocol May 1, 2025
@edhelas
Copy link
Contributor Author

edhelas commented May 25, 2025

I added Field Standardization using XEP-0068

@stpeter
Copy link
Member

stpeter commented Jun 30, 2025

With my author hat on (!), this looks good to me. See feedback on the list as well.

@edhelas
Copy link
Contributor Author

edhelas commented Jul 7, 2025

@mwild1 It seems that you had a few feedback to give on the XEP, feel free to do so then I can amend it (or amend it yourself with a PR :) ).

Copy link
Contributor

@mwild1 mwild1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left suggestions inline, fixing some minor nits. There are two other changes I would like to request:

  • Make it clear that the "hat list" and all associated commands are optional. Clients may receive hats from the server, even if these commands are not exposed. As mentioned on the mailing list, many deployments will pull hat information from external sources, such as LDAP and may not want to offer control over these.
  • Replace uses of 'don' and 'doff' with 'assign' and 'unassign' for clarity (the word "don" typically applies to dressing oneself, and originally the commands were specified this way, but now the commands are about admins giving hats to other people - combined with the general unfamiliarity of these words I think it is best if we change them while we still can).

@edhelas edhelas force-pushed the master branch 2 times, most recently from 924af65 to e11b9de Compare July 18, 2025 07:24
As a client developper the current Hats XEP is far from be usable and feature complete.

The goal of those changes is to:
- Allow clients to develop a nice UI to manage and assign hats, for example like Discord is doing (see https://support.discord.com/hc/en-us/articles/214836687-Discord-Roles-and-Permissions)
- Reconciliate existing implementations and their specificities, see https://docs.ejabberd.im/tutorials/muc-hats/
- Those changes were meant to be backward compatible with the current 0.2.0 version

This PR make the following changes:

- Specify a urn:xmpp:hats:commands:create command to add a hat to the available list
- Specify a urn:xmpp:hats:commands:destroy command to destroy a hat from the list
- Clarify how the service should broadcast the hat changes when it is edited, assigned, removed or destroyed
- Specify a way for an entity to get the complete list of hats using a hash in disco#info
- Add a hue optional parameter allowing entities to assign a color to the hat that can be displayed properly in any conditions on the client (as explained in XEP-0392: Consistent Color Generation)
- Standardize the all the form fields using XEP-0068
- Rename the :dlist, :don and :doff commands to :list, :assign and :unassign
- Add myself in the list of authors
- Fix some typos
@edhelas
Copy link
Contributor Author

edhelas commented Jul 18, 2025

@mwild1 @stpeter I took care of all your feedbacks, and added myself in the authors list if you don't mind :)

I recompiled the XEP there https://movim.eu/xeps/xep-0317.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Author The XEP is experimental and the PR was not made by the author. The author needs to acknowledge it. Needs Version Block The change requires a version block, and this is to be done by Editors at merge time.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants