mod_cloud_notify_priority_tag/mod_cloud_notify_priority_tag.lua
changeset 4338 d90ce7dc3f88
equal deleted inserted replaced
4337:97f369745ec7 4338: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);