Changeset

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 (2020-09-20)
parents 4144:1c05671598ae
children 4146:bebc5740fc16
files mod_muc_inject_mentions/mod_muc_inject_mentions.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
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