Software /
code /
prosody-modules
Comparison
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 |
parent | 4144:1c05671598ae |
child | 4155:308b92b07da6 |
comparison
equal
deleted
inserted
replaced
4144:1c05671598ae | 4145:837c4340653f |
---|---|
117 | 117 |
118 -- Body only contains nickname | 118 -- Body only contains nickname |
119 if first == 1 and last == #body then | 119 if first == 1 and last == #body then |
120 table.insert(mentions, {bare_jid=bare_jid, first=first, last=last}) | 120 table.insert(mentions, {bare_jid=bare_jid, first=first, last=last}) |
121 | 121 |
122 -- Nickname between spaces | 122 -- Nickname between spaces or new lines |
123 elseif body:sub(first - 1, first - 1) == " " and | 123 elseif body:sub(first - 1, first - 1) == " " or body:sub(first - 1, first - 1) == "\n" and |
124 body:sub(last + 1, last + 1) == " " | 124 body:sub(last + 1, last + 1) == " " or body:sub(last + 1, last + 1) == "\n" |
125 then | 125 then |
126 table.insert(mentions, {bare_jid=bare_jid, first=first, last=last}) | 126 table.insert(mentions, {bare_jid=bare_jid, first=first, last=last}) |
127 else | 127 else |
128 -- Check if occupant is mentioned using affixes | 128 -- Check if occupant is mentioned using affixes |
129 local has_preffix = has_nick_prefix(body, first) | 129 local has_preffix = has_nick_prefix(body, first) |