Software /
code /
prosody-modules
Diff
mod_http_muc_log/mod_http_muc_log.lua @ 4992:ed5abb8b8fa8
mod_http_muc_log: Use XEP-0421 ID over nickname for XEP-0308
This prevents someone else from joining with the same nickname as
someone who left, and "correcting" their messages.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 16 Aug 2022 01:41:45 +0200 |
parent | 4991:b17d63ef5bdf |
child | 4993:f36d15107c15 |
line wrap: on
line diff
--- a/mod_http_muc_log/mod_http_muc_log.lua Tue Aug 16 01:39:25 2022 +0200 +++ b/mod_http_muc_log/mod_http_muc_log.lua Tue Aug 16 01:41:45 2022 +0200 @@ -326,6 +326,7 @@ end local nick = select(3, jid_split(item.attr.from)); + local occupant_id = item:find("{urn:xmpp:occupant-id:0}occupant-id@id") or nick; -- XEP-0066: Out of Band Data local oob = use_oob and item:get_child("x", "jabber:x:oob"); @@ -351,7 +352,7 @@ if edit then local found = false; for n = i-1, 1, -1 do - if logs[n].message_id == edit and nick == logs[n].nick then + if logs[n].message_id == edit and occupant_id == logs[n].occupant_id then found = true; logs[n].edited = archive_id; edit = logs[n].archive_id; @@ -394,6 +395,7 @@ local line = { message_id = message_id; archive_id = archive_id; + occupant_id = occupant_id; datetime = datetime.datetime(when); time = datetime.time(when); verb = verb;