view mod_cloud_notify_priority_tag/mod_cloud_notify_priority_tag.lua @ 5406:b86d80e21c60

mod_http_oauth2: Validate consistency of response and grant types Ensure that these correlated fields make sense per RFC 7591 ยง 2.1, even though we currently only check the response type during authorization. This could probably all be deleted if (when!) we remove the implicit grant, since then these things don't make any sense anymore.
author Kim Alvefur <zash@zash.se>
date Tue, 02 May 2023 16:34:31 +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);