Mercurial > prosody-modules
comparison mod_pastebin/mod_pastebin.lua @ 3196:01503000d2f1
mod_pastebin: Make first line and URL more clearly separated
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 31 Jul 2018 18:29:08 +0200 |
parents | 11087a72990b |
children | 4a12abccdbaf |
comparison
equal
deleted
inserted
replaced
3195:66b3085ecc49 | 3196:01503000d2f1 |
---|---|
130 module:log("debug", "Pasted message as %s", url); | 130 module:log("debug", "Pasted message as %s", url); |
131 --module:log("debug", " stanza[bodyindex] = %q", tostring( stanza[bodyindex])); | 131 --module:log("debug", " stanza[bodyindex] = %q", tostring( stanza[bodyindex])); |
132 local summary = (body:sub(1, max_summary_length):gsub(utf8_pattern, drop_invalid_utf8) or ""):match("[^\n]+") or ""; | 132 local summary = (body:sub(1, max_summary_length):gsub(utf8_pattern, drop_invalid_utf8) or ""):match("[^\n]+") or ""; |
133 summary = summary:match("^%s*(.-)%s*$"); | 133 summary = summary:match("^%s*(.-)%s*$"); |
134 local summary_prefixed = summary:match("[,:]$"); | 134 local summary_prefixed = summary:match("[,:]$"); |
135 replace_tag(stanza, st.stanza("body"):text(summary .. " " .. url)); | 135 replace_tag(stanza, st.stanza("body"):text(summary .. "\n" .. url)); |
136 | 136 |
137 stanza:add_child(st.stanza("query", { xmlns = "jabber:iq:oob" }):tag("url"):text(url)); | 137 stanza:add_child(st.stanza("query", { xmlns = "jabber:iq:oob" }):tag("url"):text(url)); |
138 | 138 |
139 if html_preview then | 139 if html_preview then |
140 local line_count = select(2, body:gsub("\n", "%0")) + 1; | 140 local line_count = select(2, body:gsub("\n", "%0")) + 1; |