Files
Stefan-SangerandClaude Fable 5 bdb9aed9e3 feat: upgrade prosody 0.11.6 -> 0.12.6 (milestone 1)
Re-port all source patches onto 0.12.6; three are gone entirely:
moduleapi (the two vnc_muc_fcm modules call core.storagemanager
directly now), mod_admin_telnet and portmanager (replaced by
console_interfaces/http_interfaces config). The muc.lib fork keeps its
four functional changes including the externally consumed
muc-config-sub-mitted event; the operator-precedence hunk was fixed
upstream. mod_muc_mam shrinks to keep-archive-on-room-destroy since
muc_log_expires_after="never" disables cleanup upstream in 0.12.

Delete the bundled mod_smacks fork and the no-op mod_smacks_offline;
core 0.12 smacks supersedes them (options audited, dead smacks_max_old
corrected to smacks_max_old_sessions).

Config/startup: drop legacyauth, run_as_root, daemonize; bosh_ports ->
http_ports; cross_domain_* -> http_cors_override; randomize
component_secret at startup (env-overridable); export
log_slow_events_threshold fallback (latent render bug).

Found while smoke-testing: pin --idn-library=idn (0.12's ICU default
segfaults without ICU data in the image); http became a private
service in 0.12 so 5280 needs http_interfaces to stay public; the
telnet console now depends on mod_admin_socket, whose socket moves to
/var/log/prosody.

Verified: prosodyctl check config clean; boots against Postgres with
empty error log and same port bindings as 0.11; healthcheck green;
telnet console and SQL storage round-trip; 0.11->0.12 schema upgrade
rehearsed on a 0.11-created database with data intact.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Part-of: <http://gitlab.vnc.biz/uxf/vnctalk-prosody/-/merge_requests/3>
2026-07-15 17:58:02 +02:00

98 lines
3.3 KiB
Diff

--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -201,11 +201,30 @@
-- Broadcast a stanza to all occupants in the room.
-- optionally checks conditional called with (nick, occupant)
function room_mt:broadcast(stanza, cond_func)
+ local xaffs = {};
+ if self._affiliations then
+ for _xaff, _xrol in pairs(self._affiliations) do
+ xaffs[_xaff] = true;
+ end
+ end
+
for nick, occupant in self:each_occupant() do
+ xaffs[occupant.bare_jid] = nil;
if cond_func == nil or cond_func(nick, occupant) then
self:route_to_occupant(occupant, stanza)
end
end
+
+ for offlineaff, orol in pairs(xaffs) do
+ local ouser, ohost = jid_split(offlineaff);
+ if not (prosody.hosts[ohost]) then
+ log("debug", "need to send to remote offline user: %s", offlineaff);
+ stanza.attr.to = offlineaff;
+ self:route_stanza(stanza);
+ end
+ end
+
+
end
local function can_see_real_jids(whois, occupant)
@@ -319,7 +338,8 @@
self_x:tag("status", {code = "110";}):up();
if occupant.role == nil then
-- They get an unavailable
- self:route_to_occupant(occupant, self_p);
+ log("debug", "skipping unavailable presence");
+ -- self:route_to_occupant(occupant, self_p);
else
-- use their own presences as templates
for full_jid, pr in occupant:each_session() do
@@ -971,6 +991,7 @@
return true;
end
module:fire_event("muc-config-submitted", event);
+ module:fire_event("muc-config-sub-mitted", event);
for submitted_field in pairs(present) do
event.field, event.value = submitted_field, fields[submitted_field];
module:fire_event("muc-config-submitted/"..submitted_field, event);
@@ -986,6 +1007,8 @@
for code in pairs(event.status_codes) do
msg:tag("status", {code = code;}):up();
end
+ -- SSA add config here?
+ -- :add_child(self:get_form_layout(stanza.attr.from):form())
msg:up();
self:broadcast_message(msg);
end
@@ -1161,6 +1184,8 @@
return true;
end
function room_mt:handle_owner_query_set_to_room(origin, stanza)
+-- module:log("info", "from: %s", stanza.attr.from);
+-- module:log("info", "aff: %s", self:get_affiliation(stanza.attr.from));
if self:get_affiliation(stanza.attr.from) ~= "owner" then
origin.send(st.error_reply(stanza, "auth", "forbidden", "Only owners can configure rooms"));
return true;
@@ -1195,14 +1220,20 @@
if not stanza.attr.id then
stanza.attr.id = new_id()
end
- local event_data = {room = self; origin = origin; stanza = stanza; from = from; occupant = occupant};
- if module:fire_event("muc-occupant-groupchat", event_data) then
- return true;
- end
- if event_data.occupant then
- stanza.attr.from = event_data.occupant.nick;
+ local from_res = jid_resource(stanza.attr.from);
+ local affiliate = self:get_affiliation(from_res) or "none";
+ local aff_allowed = false;
+ if (affiliate == "owner" or affiliate == "member" or affiliate == "admin") then
+ aff_allowed = true;
else
- stanza.attr.from = self.jid;
+ local event_data = {room = self; origin = origin; stanza = stanza; from = from; occupant = occupant};
+ if module:fire_event("muc-occupant-groupchat", event_data) then
+ return true;
+ end
+ occupant = event_data.occupant;
+ end
+ if occupant then
+ stanza.attr.from = occupant.nick;
end
self:broadcast_message(stanza);
stanza.attr.from = from;