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

84 lines
2.5 KiB
Diff

--- a/plugins/mod_mam/mod_mam.lua
+++ b/plugins/mod_mam/mod_mam.lua
@@ -275,24 +275,7 @@
end
local function shall_store(user, who)
- -- TODO Cache this?
- if not um.user_exists(user, host) then
- module:log("debug", "%s@%s does not exist", user, host)
- return false;
- end
- local prefs = get_prefs(user);
- local rule = prefs[who];
- module:log("debug", "%s's rule for %s is %s", user, who, rule);
- if rule ~= nil then
- return rule;
- end
- -- Below could be done by a metatable
- local default = prefs[false];
- module:log("debug", "%s's default rule is %s", user, default);
- if default == "roster" then
- return has_in_roster(user, who);
- end
- return default;
+ return true;
end
local function strip_stanza_id(stanza, user)
@@ -387,7 +370,7 @@
end, -1)
-- Handle messages
-local function message_handler(event, c2s)
+local function message_handler(event, c2s, vnc_rest)
local origin, stanza = event.origin, event.stanza;
local log = c2s and origin.log or module._log;
local orig_from = stanza.attr.from;
@@ -396,6 +379,9 @@
-- Whose storage do we put it in?
local store_user = c2s and origin.username or jid_split(orig_to);
+ if vnc_rest then
+ store_user = jid_split(orig_from);
+ end
-- And who are they chatting with?
local with = jid_bare(c2s and orig_to or orig_from);
@@ -429,8 +415,10 @@
clone_for_storage = stanza;
end
+ local storebody = stanza:get_child("body") and stanza:get_child("body")[1];
+
-- Check with the users preferences
- if shall_store(store_user, with) then
+ if (storebody and shall_store(store_user, with)) then
log("debug", "Archiving stanza: %s (%s)", stanza:top_tag(), why);
-- And stash it
@@ -475,6 +463,10 @@
return message_handler(event, true);
end
+local function vnc_message_handler(event)
+ return message_handler(event, true, true);
+end
+
-- Filter out <stanza-id> before the message leaves the server to prevent privacy leak.
local function strip_stanza_id_after_other_events(event)
event.stanza = strip_stanza_id(event.stanza, event.origin.username);
@@ -608,6 +600,7 @@
-- Stanzas sent by local clients
module:hook("pre-message/bare", c2s_message_handler, 0);
module:hook("pre-message/full", c2s_message_handler, 0);
+module:hook("vnc-rest-message", vnc_message_handler, 0);
-- Stanzas to local clients
module:hook("message/bare", message_handler, 0);
module:hook("message/full", message_handler, 0);
@@ -621,4 +614,3 @@
end
(event.reply or event.stanza):tag("feature", {var=xmlns_st_id}):up();
end);
-