# HG changeset patch # User Seve Ferrer # Date 1600605958 -7200 # Node ID 6906562af2ee3011169a35436637760676553909 # Parent aef6f5b9f6fd57907bf50ff5da2aac1304b3f397 mod_muc_inject_mentions: Allow preffixes to be used after a new line diff -r aef6f5b9f6fd -r 6906562af2ee mod_muc_inject_mentions/mod_muc_inject_mentions.lua --- a/mod_muc_inject_mentions/mod_muc_inject_mentions.lua Sun Sep 20 13:45:32 2020 +0200 +++ b/mod_muc_inject_mentions/mod_muc_inject_mentions.lua Sun Sep 20 14:45:58 2020 +0200 @@ -43,10 +43,12 @@ -- There are no configured prefixes if not prefixes or #prefixes < 1 then return false end - -- Preffix must have a space before it - -- or be the first character of the body + -- Preffix must have a space before it, + -- be the first character of the body + -- or be the first character after a new line if body:sub(first - 2, first - 2) ~= "" and - body:sub(first - 2, first - 2) ~= " " + body:sub(first - 2, first - 2) ~= " " and + body:sub(first - 2, first - 2) ~= "\n" then return false end @@ -131,7 +133,9 @@ -- @nickname ... elseif has_preffix and not has_suffix then - if body:sub(last + 1, last + 1) == " " then + if body:sub(last + 1, last + 1) == " " or + body:sub(last + 1, last + 1) == "\n" + then table.insert(mentions, {bare_jid=bare_jid, first=first, last=last}) end