mod_muc_inject_mentions: Catch nicknames between new lines
authorSeve Ferrer <seve@delape.net>
Sun, 20 Sep 2020 15:24:09 +0200
changeset 4149 837c4340653f
parent 4148 1c05671598ae
child 4150 bebc5740fc16
mod_muc_inject_mentions: Catch nicknames between new lines
mod_muc_inject_mentions/mod_muc_inject_mentions.lua
--- a/mod_muc_inject_mentions/mod_muc_inject_mentions.lua	Sun Sep 20 15:04:22 2020 +0200
+++ b/mod_muc_inject_mentions/mod_muc_inject_mentions.lua	Sun Sep 20 15:24:09 2020 +0200
@@ -119,9 +119,9 @@
             if first == 1 and last == #body then
                 table.insert(mentions, {bare_jid=bare_jid, first=first, last=last})
 
-            -- Nickname between spaces
-            elseif body:sub(first - 1, first - 1) == " " and
-                body:sub(last + 1, last + 1) == " "
+            -- Nickname between spaces or new lines
+            elseif body:sub(first - 1, first - 1) == " " or body:sub(first - 1, first - 1) == "\n" and
+                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})
             else