view mod_cloud_notify_priority_tag/mod_cloud_notify_priority_tag.lua @ 5612:2e30af180da5

mod_muc_moderation: Stamp XEP-0421 occupant-id for the acting moderator Gives clients some hint about which moderator it was who did the deed. The @by attribute does have the nick of the actor, but they could change their nickname at some point, which is what occupant-id solves. Ref #1816
author Kim Alvefur <zash@zash.se>
date Thu, 20 Jul 2023 10:38:33 +0200
parents d90ce7dc3f88
children
line wrap: on
line source

local xmlns_push_priority = "tigase:push:priority:0";

-- https://xeps.tigase.net//docs/push-notifications/encrypt/#41-discovering-support
local function account_disco_info(event)
	event.reply:tag("feature", {var=xmlns_push_priority}):up();
end
module:hook("account-disco-info", account_disco_info);

function handle_push(event)
	if event.important then
		event.notification_payload:text_tag("priority", "high", { xmlns = xmlns_push_priority });
	end
end

module:hook("cloud_notify/push", handle_push);