changeset 4987:8a8ec909ac20

mod_http_muc_log: Link to replied-to message using XEP-0461: Message Replies
author Kim Alvefur <zash@zash.se>
date Fri, 12 Aug 2022 17:15:11 +0200
parents 3bcefa9cf1ca
children 732229fe68ab
files mod_http_muc_log/mod_http_muc_log.lua mod_http_muc_log/res/http_muc_log.html
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_muc_log/mod_http_muc_log.lua	Fri Aug 12 17:14:43 2022 +0200
+++ b/mod_http_muc_log/mod_http_muc_log.lua	Fri Aug 12 17:15:11 2022 +0200
@@ -388,6 +388,9 @@
 			end
 		end
 
+		-- XEP-0461: Message Replies
+		local reply = item:get_child("reply", "urn:xmpp:reply:0");
+
 		if body or verb or oob then
 			local line = {
 				id = item.attr.id,
@@ -401,6 +404,7 @@
 				st_name = item.name;
 				st_type = item.attr.type;
 				edit = edit;
+				reply = reply and reply.attr.id;
 			};
 			if oob then
 				line.oob = {
--- a/mod_http_muc_log/res/http_muc_log.html	Fri Aug 12 17:14:43 2022 +0200
+++ b/mod_http_muc_log/res/http_muc_log.html	Fri Aug 12 17:15:11 2022 +0200
@@ -114,7 +114,7 @@
 <a class="time" href="#{item.key}"><time id="{item.time}" datetime="{item.datetime}">{item.time}</time></a>
 <b class="nick">{item.nick}</b>
 <em class="verb">{item.verb?}</em>
-<q class="body">{item.edited&<del>}{item.body?}{item.edited&</del> <a href="#{item.edited}" title="jump to corrected version">&#9998;</a>}{item.edit& <a href="#{item.edit}" title="jump to previous version">&#9999;</a>}</q>
+<q class="body">{item.edited&<del>}{item.body?}{item.edited&</del> <a href="#{item.edited}" title="jump to corrected version">&#9998;</a>}{item.edit& <a href="#{item.edit}" title="jump to previous version">&#9999;</a>}{item.reply& <a href="#{item.reply}" title="jump to message responded to">&#8634;</a>}</q>
 {item.reactions%<span class="reaction">{idx} {item}</span>}
 {item.oob.url&<figure><a rel="nofollow" href="{item.oob.url?}"><img alt="{item.oob.desc?}" src="{item.oob.url?}"/></a><figcaption>{item.oob.desc?}</figcaption></figure>}
 </li>}