changeset 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 7a5ca4b285cb
files mod_cloud_notify_encrypted/mod_cloud_notify_encrypted.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_cloud_notify_encrypted/mod_cloud_notify_encrypted.lua	Wed Jan 13 14:18:24 2021 +0000
+++ b/mod_cloud_notify_encrypted/mod_cloud_notify_encrypted.lua	Wed Jan 13 14:19:20 2021 +0000
@@ -56,6 +56,10 @@
 	local push_summary = event.push_summary;
 
 	local original_stanza = event.original_stanza;
+	local body = original_stanza:get_child_text("body");
+	if #body > 255 then
+		body = body:sub(1, 255);
+	end
 
 	local push_payload = {
 		unread = tonumber(push_summary["message-count"]) or 1;