Comparison

mod_muc_inject_mentions/mod_muc_inject_mentions.lua @ 4143:b2080f76e0aa

mod_muc_inject_mentions: Allow suffixes to be used before a new line
author Seve Ferrer <seve@delape.net>
date Sun, 20 Sep 2020 14:57:55 +0200
parent 4142:6906562af2ee
child 4144:1c05671598ae
comparison
equal deleted inserted replaced
4142:6906562af2ee 4143:b2080f76e0aa
69 if last == #body then return true end 69 if last == #body then return true end
70 70
71 -- There are no configured suffixes 71 -- There are no configured suffixes
72 if not suffixes or #suffixes < 1 then return false end 72 if not suffixes or #suffixes < 1 then return false end
73 73
74 -- Suffix must have a space after it 74 -- Suffix must have a space after it,
75 -- or be the last character of the body 75 -- be the last character of the body
76 -- or be the last character before a new line
76 if body:sub(last + 2, last + 2) ~= "" and 77 if body:sub(last + 2, last + 2) ~= "" and
77 body:sub(last + 2, last + 2) ~= " " 78 body:sub(last + 2, last + 2) ~= " " and
79 body:sub(last + 2, last + 2) ~= "\n"
78 then 80 then
79 return false 81 return false
80 end 82 end
81 83
82 local suffix = body:sub(last+1, last+1) 84 local suffix = body:sub(last+1, last+1)