Repository navigation
Create and configure rooms from a spec, and never create one on a join - #4279
Merged
Merged
Conversation
jcbrand
force-pushed
the
feat/rooms-create
branch
3 times, most recently
from
November 29, 2026 09:02
09b1193 to
37d4927
Compare
jcbrand
marked this pull request as ready for review
November 29, 2026 12:59
jcbrand
force-pushed
the
feat/rooms-create
branch
from
November 29, 2026 13:01
37d4927 to
f02ff03
Compare
…the registry's class onCreated() handles a room we've just created (status 201), so a subclass can configure it its own way. api.rooms.get now creates new rooms with the class in the chatboxes registry, as restored rooms already were, so the subclass is used for both.
jcbrand
force-pushed
the
feat/rooms-create
branch
2 times, most recently
from
November 29, 2026 15:36
0e3a55b to
4c8b05d
Compare
jcbrand
force-pushed
the
feat/rooms-create
branch
from
November 29, 2026 16:10
4c8b05d to
35a3b9b
Compare
…e one on a join - rooms.create creates a room with the given settings and affiliations, and leaves a room that exists as it is. rooms.config shows a room's settings and affiliations, and rooms.configure changes them, adding affiliations only. All three need full access. - A join no longer creates a room with the server's defaults. It fails with NOT_FOUND, and a members-only refusal is reported as JOIN_REFUSED. - The CLI adds rooms create, rooms config show and rooms config set. They read the room's spec from ~/.config/converse/rooms/<jid>.json when no --file is given. rooms join asks at a terminal before creating a missing room, or creates it with --create. - New FORBIDDEN error (exit code 10) for a room we don't own.
jcbrand
force-pushed
the
feat/rooms-create
branch
from
November 29, 2026 16:14
35a3b9b to
e8803ba
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets a groupchat be created and configured from a spec, so an installer (such as Kronik's) can set up the rooms its agents use, with the user as the owner.
Daemon
rooms.createcreates a room with the given settings and affiliations, then joins it. A room that already exists is left as it is (created: false).rooms.configreturns a room's settings, affiliation lists and form fields.rooms.configurechanges settings and gives affiliations: it promotes but never demotes or bans someone with an affiliation, and lifts a ban only for JIDs inunban. A JID left as it is comes back inkept, anddry_runreports the changes only.muc_instant_roomslet a join recreate a room that had disappeared, with the server's defaults (not members-only, not persistent). Now the join fails withNOT_FOUND, and a members-only refusal comes back asJOIN_REFUSEDwith the server's reason.FORBIDDENerror, for a room we don't own.CLI
converse rooms create <room>,converse rooms config show <room>andconverse rooms config set <room>.~/.config/converse/rooms/<jid>.json({"settings": {...}, "affiliations": {...}}) when no--fileis given.--set name=valueand--member jidadd to it.config setwith no flags brings the room in line with its spec, and--dry-runshows what would change.config set --unban <jid>lifts a ban. A ban the spec alone would lift is asked about at a terminal, and kept without one.rooms joinon a missing room asks at a terminal before creating it, and--createcreates it without asking. Without a terminal it exits 3.FORBIDDENmaps to exit code 10.Headless
The protocol work lives here, so the web app and other front ends get the same behaviour as the daemon, which only checks its parameters and maps errors.
api.rooms.config.get(jid)andapi.rooms.config.set(jid, settings, { dry_run, force }). Settings are checked against the room's owner form, and if any isn't one of its fields, or has a value the field doesn't take, aRoomSettingsErroris thrown and nothing is sent.api.rooms.exists(jid)andapi.rooms.destroy(jid, { reason, new_jid }).MUC.sendDestroyIQ()uses the latter.api.rooms.affiliations.fetch(jid), the lists we may see, andapi.rooms.affiliations.grant(jid, lists, { unban, dry_run }), which promotes but never demotes, bans only JIDs without an affiliation, and lifts a ban only for JIDs inunban.auto_configuregoes throughapi.rooms.config.set. Aroomconfigsetting the server doesn't have used to be dropped silently, which could leave a room meant to be members-only open. Now nothing is set and the configuration form is shown. Afalsegiven as a string is no longer taken for true.MUC.onCreated(), called when we've just created a room (status 201). The daemon overrides it to fill in the owner form.api.rooms.getcreates new rooms with the chatboxes registry's class, as restored rooms already were.StanzaErrorkeeps the error's text, astext.Tests
src/daemon/tests/room-setup.prosody.jsandsrc/cli/tests/rooms.prosody.jsrun against a real Prosody (npm run test:prosody). The existing Prosody tests now create their rooms explicitly.