Changeset

4991:b17d63ef5bdf

mod_http_muc_log: Use XEP-0359 ID if available Clients apparently prefer this over message@id for reasons. Only used internally to find items for message edits
author Kim Alvefur <zash@zash.se>
date Tue, 16 Aug 2022 01:39:25 +0200
parents 4990:d55b10878e43
children 4992:ed5abb8b8fa8
files mod_http_muc_log/mod_http_muc_log.lua
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_muc_log/mod_http_muc_log.lua	Tue Aug 16 01:34:27 2022 +0200
+++ b/mod_http_muc_log/mod_http_muc_log.lua	Tue Aug 16 01:39:25 2022 +0200
@@ -312,6 +312,9 @@
 		local verb = nil;
 		local lang = body_tag and body_tag.attr["xml:lang"] or item.attr["xml:lang"];
 
+		-- XEP-0359: Unique and Stable Stanza IDs
+		local message_id = item:find("{urn:xmpp:sid:0}origin-id@id") or item.attr.id;
+
 		if subject then
 			verb, body = "set the topic to", subject;
 		elseif body and body:sub(1,4) == "/me " then
@@ -389,7 +392,7 @@
 
 		if body or verb or oob then
 			local line = {
-				message_id = item.attr.id;
+				message_id = message_id;
 				archive_id = archive_id;
 				datetime = datetime.datetime(when);
 				time = datetime.time(when);