Permalink
Browse files

XEP-0357: Add last-message-priority support to distinguish messages w…

…ith body
  • Loading branch information...
chrisballinger committed Oct 17, 2017
1 parent 701d007 commit 40486273306f13ea68236745858df9b95a07c4fb
Showing with 8 additions and 0 deletions.
  1. +8 −0 mod_cloud_notify/mod_cloud_notify.lua
@@ -14,6 +14,7 @@ local hashes = require"util.hashes";
local xmlns_push = "urn:xmpp:push:0";
-- configuration
local include_priority = module:get_option_boolean("push_notification_with_priority", true);
local include_body = module:get_option_boolean("push_notification_with_body", false);
local include_sender = module:get_option_boolean("push_notification_with_sender", false);
local max_push_errors = module:get_option_number("push_max_errors", 50);
@@ -270,6 +271,13 @@ local function handle_notify_request(stanza, node, user_push_services)
if stanza and include_body then
form_data["last-message-body"] = stanza:get_child_text("body");
end
if stanza and include_priority then
if stanza:get_child("body") or stanza:get_child("encrypted", "eu.siacs.conversations.axolotl") then
form_data["last-message-priority"] = "high"
else
form_data["last-message-priority"] = "low"
end
end
push_publish:add_child(push_form:form(form_data));
if stanza and push_info.include_payload == "stripped" then
push_publish:tag("payload", { type = "stripped" })

0 comments on commit 4048627

Please sign in to comment.