diff mod_muc_inject_mentions/mod_muc_inject_mentions.lua @ 4145:837c4340653f

mod_muc_inject_mentions: Catch nicknames between new lines
author Seve Ferrer <seve@delape.net>
date Sun, 20 Sep 2020 15:24:09 +0200
parents 1c05671598ae
children 308b92b07da6
line wrap: on
line diff
--- 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