view mod_cloud_notify_priority_tag/mod_cloud_notify_priority_tag.lua @ 5016:964de9997552

mod_admin_blocklist: Fix traceback due to misplaced parenthesis get_jids_with_role() throws an exception when 'host' is nil since Prosody trunk rev 7ca5645f46cd
author Kim Alvefur <zash@zash.se>
date Sat, 27 Aug 2022 15:39:38 +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);