fix(fcm): pass full JID to fcm_notify and use st.clone in MUC handler
fcm_notify splits userName internally via jid_split, so callers were double-splitting: passing jid_split(to) fed the bare node as userName and shifted every subsequent argument by one (host→title, resource→body, …), corrupting all notification payloads. Pass the full JID instead. In mod_vnc_muc_fcm, replace event.stanza:clone() with st.clone() and add the util.stanza import for robustness. Part-of: <http://gitlab.vnc.biz/uxf/vnctalk-prosody/-/merge_requests/11>
This commit is contained in:
@@ -114,7 +114,7 @@ local function message_handler(event, fromLocal)
|
||||
if (signalType == "read") then
|
||||
local signalTarget = vncTalkSignal:find("{xmpp:vnctalk}target#") or nil;
|
||||
if (signalTarget ~= nil) then
|
||||
fcm_notify(jid_split(to), nil, nil, "read", nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, signalTarget);
|
||||
fcm_notify(to, nil, nil, "read", nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, signalTarget);
|
||||
end
|
||||
elseif (signalType == "notification-settings") then
|
||||
local u = jid_split(to);
|
||||
@@ -151,7 +151,7 @@ local function message_handler(event, fromLocal)
|
||||
local vnctalk_broadcast_target = vnctalk_broadcast.attr.origtarget;
|
||||
local body = stanza:get_child("body");
|
||||
if (not(vnctalk_avatarup)) then
|
||||
fcm_notify(jid_split(to), vnctalk_broadcast_target, content, type, getDisplayName_cached(jid_split(from)), "Broadcast: "..vnctalk_broadcast_title, vnc_attachment_type, message_id, vncTalkConferenceEtype, vncTalkConferenceId, nil, jitsiURL, jitsiRoom);
|
||||
fcm_notify(to, vnctalk_broadcast_target, content, type, getDisplayName_cached(jid_split(from)), "Broadcast: "..vnctalk_broadcast_title, vnc_attachment_type, message_id, vncTalkConferenceEtype, vncTalkConferenceId, nil, jitsiURL, jitsiRoom);
|
||||
end
|
||||
return nil;
|
||||
end
|
||||
@@ -185,10 +185,10 @@ local function message_handler(event, fromLocal)
|
||||
local fromuser2, fromdomain2 = jid_split(stanza.attr.from);
|
||||
local touser2, todomain2 = jid_split(stanza.attr.to);
|
||||
if (fromLocal and (fromdomain2 == ThisDomain) and ((todomain2 == ThisDomain) or (todomain2 == nil))) and (type ~= "groupchat") then
|
||||
fcm_notify(jid_split(to), from, content, type, getDisplayName_cached(jid_split(from)), nil, vnc_attachment_type, message_id, vncTalkConferenceEtype, vncTalkConferenceId, nil, jitsiURL, jitsiRoom, isMessageCorrection);
|
||||
fcm_notify(to, from, content, type, getDisplayName_cached(jid_split(from)), nil, vnc_attachment_type, message_id, vncTalkConferenceEtype, vncTalkConferenceId, nil, jitsiURL, jitsiRoom, isMessageCorrection);
|
||||
else
|
||||
if (type ~= "groupchat") and (fromdomain2 ~= ThisDomain) then
|
||||
fcm_notify(jid_split(to), from, content, type, getDisplayName_cached(jid_split(from)), nil, vnc_attachment_type, message_id, vncTalkConferenceEtype, vncTalkConferenceId, nil, jitsiURL, jitsiRoom, isMessageCorrection);
|
||||
fcm_notify(to, from, content, type, getDisplayName_cached(jid_split(from)), nil, vnc_attachment_type, message_id, vncTalkConferenceEtype, vncTalkConferenceId, nil, jitsiURL, jitsiRoom, isMessageCorrection);
|
||||
else
|
||||
if not (prosody.hosts[fromdomain2]) then
|
||||
module:log("info", "I do not know about %s", fromdomain2);
|
||||
@@ -203,7 +203,7 @@ local function message_handler(event, fromLocal)
|
||||
module:log("debug", "541-doNotify IOM: %s -> %s fl=%s, type=%s, content=%s, carbon=%s, isMUC=%s => doNotify=%s, rdn=%s",
|
||||
stanza.attr.from, stanza.attr.to, tostring(fromLocal), type, content, isSentCarbonMessage, tostring(isMUC), tostring(doNotify), rdn);
|
||||
|
||||
fcm_notify(jid_split(to), from, content, type, getDisplayName_cached(rdn), nil, vnc_attachment_type, message_id, vncTalkConferenceEtype, vncTalkConferenceId, nil, jitsiURL, jitsiRoom, isMessageCorrection);
|
||||
fcm_notify(to, from, content, type, getDisplayName_cached(rdn), nil, vnc_attachment_type, message_id, vncTalkConferenceEtype, vncTalkConferenceId, nil, jitsiURL, jitsiRoom, isMessageCorrection);
|
||||
end
|
||||
else
|
||||
module:log("debug", " WTF ignoring message");
|
||||
@@ -233,7 +233,7 @@ local function message_handler(event, fromLocal)
|
||||
for _aff, role in pairs(affs) do
|
||||
if from ~= _aff then
|
||||
module:log("debug", " notify MUC affilaite Jid=%s", _aff);
|
||||
fcm_notify(jid_split(_aff), roomJid, content, type, senderDisplayName, roomTopic, vnc_attachment_type, message_id, vncTalkConferenceEtype, vncTalkConferenceId, from, jitsiURL, jitsiRoom, isMessageCorrection);
|
||||
fcm_notify(_aff, roomJid, content, type, senderDisplayName, roomTopic, vnc_attachment_type, message_id, vncTalkConferenceEtype, vncTalkConferenceId, from, jitsiURL, jitsiRoom, isMessageCorrection);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,6 +14,7 @@ local storagemanager = require "core.storagemanager";
|
||||
local jid_bare = require "util.jid".bare;
|
||||
local jid_split = require "util.jid".split;
|
||||
local timer = require "util.timer";
|
||||
local st = require "util.stanza";
|
||||
local common = require "vnc_fcm_common";
|
||||
|
||||
local trim = common.utils.trim;
|
||||
@@ -83,7 +84,7 @@ local invalidateVcardCache = F.invalidateVcardCache;
|
||||
|
||||
local function handle_muc_message(event)
|
||||
local room = event.room
|
||||
local stanza = event.stanza:clone()
|
||||
local stanza = st.clone(event.stanza)
|
||||
|
||||
timer.add_task(0, function()
|
||||
local message_id = stanza.attr.id;
|
||||
|
||||
Reference in New Issue
Block a user