comparison mod_cloud_notify_encrypted/mod_cloud_notify_encrypted.lua @ 4331:2e355540f8c8

mod_cloud_notify_encrypted: Truncate message body to 255 characters Total size limit is 3-4KB, and this should be enough for a small notification.
author Matthew Wild <mwild1@gmail.com>
date Wed, 13 Jan 2021 14:19:20 +0000
parents e655581173be
children 97f369745ec7
comparison
equal deleted inserted replaced
4330:e655581173be 4331:2e355540f8c8
54 end 54 end
55 55
56 local push_summary = event.push_summary; 56 local push_summary = event.push_summary;
57 57
58 local original_stanza = event.original_stanza; 58 local original_stanza = event.original_stanza;
59 local body = original_stanza:get_child_text("body");
60 if #body > 255 then
61 body = body:sub(1, 255);
62 end
59 63
60 local push_payload = { 64 local push_payload = {
61 unread = tonumber(push_summary["message-count"]) or 1; 65 unread = tonumber(push_summary["message-count"]) or 1;
62 sender = jid.bare(original_stanza.attr.from); 66 sender = jid.bare(original_stanza.attr.from);
63 message = body; 67 message = body;