comparison mod_cloud_notify_priority_tag/mod_cloud_notify_priority_tag.lua @ 4334:d90ce7dc3f88

mod_cloud_notify_priority_tag: New module to support Tigase's push priority indicator extension
author Matthew Wild <mwild1@gmail.com>
date Wed, 13 Jan 2021 15:02:27 +0000
parents
children
comparison
equal deleted inserted replaced
4333:97f369745ec7 4334:d90ce7dc3f88
1 local xmlns_push_priority = "tigase:push:priority:0";
2
3 -- https://xeps.tigase.net//docs/push-notifications/encrypt/#41-discovering-support
4 local function account_disco_info(event)
5 event.reply:tag("feature", {var=xmlns_push_priority}):up();
6 end
7 module:hook("account-disco-info", account_disco_info);
8
9 function handle_push(event)
10 if event.important then
11 event.notification_payload:text_tag("priority", "high", { xmlns = xmlns_push_priority });
12 end
13 end
14
15 module:hook("cloud_notify/push", handle_push);