--- a/mod_push2/mod_push2.lua Tue Sep 19 21:21:17 2023 -0500
+++ b/mod_push2/mod_push2.lua Tue Sep 19 21:33:40 2023 -0500
@@ -201,6 +201,22 @@
envelope_bytes = tostring(envelope)
end
if string.len(envelope_bytes) > max_data_size then
+ local body = stanza:get_child_text("body")
+ if string.len(body) > 50 then
+ stanza_clone:maptags(function(el)
+ if el.name == "body" then
+ return nil
+ else
+ return el
+ end
+ end)
+
+ body = string.gsub(string.gsub("\n" .. body, "\n>[^\n]*", ""), "^%s", "")
+ stanza_clone:body(body:sub(1, utf8.offset(body, 50)) .. "…")
+ envelope_bytes = tostring(envelope)
+ end
+ end
+ if string.len(envelope_bytes) > max_data_size then
-- If still too big, get aggressive
stanza_clone:maptags(function(el)
if el.name == "body" or