Comparison

mod_pastebin/mod_pastebin.lua @ 3045:26977c4760f5

mod_pastebin: Restore URL in final body text
author Kim Alvefur <zash@zash.se>
date Fri, 25 May 2018 00:18:46 +0200
parent 3044:be9e213d089b
child 3099:c88f91626e07
comparison
equal deleted inserted replaced
3044:be9e213d089b 3045:26977c4760f5
125 module:log("debug", "Pasted message as %s", url); 125 module:log("debug", "Pasted message as %s", url);
126 --module:log("debug", " stanza[bodyindex] = %q", tostring( stanza[bodyindex])); 126 --module:log("debug", " stanza[bodyindex] = %q", tostring( stanza[bodyindex]));
127 local summary = (body:sub(1, max_summary_length):gsub(utf8_pattern, drop_invalid_utf8) or ""):match("[^\n]+") or ""; 127 local summary = (body:sub(1, max_summary_length):gsub(utf8_pattern, drop_invalid_utf8) or ""):match("[^\n]+") or "";
128 summary = summary:match("^%s*(.-)%s*$"); 128 summary = summary:match("^%s*(.-)%s*$");
129 local summary_prefixed = summary:match("[,:]$"); 129 local summary_prefixed = summary:match("[,:]$");
130 replace_tag(stanza, st.stanza("body"):text(summary)); 130 replace_tag(stanza, st.stanza("body"):text(summary .. " " .. url));
131 131
132 stanza:add_child(st.stanza("query", { xmlns = "jabber:iq:oob" }):tag("url"):text(url)); 132 stanza:add_child(st.stanza("query", { xmlns = "jabber:iq:oob" }):tag("url"):text(url));
133 133
134 if html_preview then 134 if html_preview then
135 local line_count = select(2, body:gsub("\n", "%0")) + 1; 135 local line_count = select(2, body:gsub("\n", "%0")) + 1;