--- a/mod_http_muc_log/mod_http_muc_log.lua Mon Jun 20 18:24:32 2022 +0200
+++ b/mod_http_muc_log/mod_http_muc_log.lua Sun Jun 26 21:23:42 2022 +0200
@@ -368,6 +368,30 @@
end
end
+ local reactions = item:get_child("reactions", "urn:xmpp:reactions:0");
+ if reactions then
+ -- COMPAT Movim uses an @to attribute instead of the correct @id
+ local target_id = reactions.attr.id or reactions.attr.to;
+ for n = i - 1, 1, -1 do
+ if not logs[n] then
+ break -- Probably reached logs[0]
+ elseif logs[n].key == target_id then
+ local react_map = logs[n].reactions; -- { string : integer }
+ if not react_map then
+ react_map = {};
+ logs[n].reactions = react_map;
+ end
+ for reaction_tag in reactions:childtags("reaction") do
+ -- FIXME This doesn't replace previous reactions by the same user
+ -- on the same message.
+ local reaction_text = reaction_tag:get_text() or "�";
+ react_map[reaction_text] = (react_map[reaction_text] or 0) + 1;
+ end
+ break
+ end
+ end
+ end
+
if body or verb or oob then
local line = {
id = item.attr.id,
--- a/mod_http_muc_log/res/http_muc_log.html Mon Jun 20 18:24:32 2022 +0200
+++ b/mod_http_muc_log/res/http_muc_log.html Sun Jun 26 21:23:42 2022 +0200
@@ -44,6 +44,7 @@
.unavailable .verb{color:#c03030;}
.button{display:inline-block}
.button>a{color:white;background-color:orange;border-radius:4px}
+.reaction{font-size:smaller;outline:1px solid silver;border-radius:2px}
form{text-align:right}
li.edited{display:none}
li:target{outline:1px gray dotted;display:inherit}
@@ -113,6 +114,7 @@
<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}">✎</a>}{item.edit& <a href="#{item.edit}">✏</a>}</q>
+{item.reactions%<span class="reaction">{idx} {item}</span>}
{item.oob.url&<figure><a rel="nofollow" href="{item.oob.url?}"><img style="max-height:9em;max-width:16em" alt="{item.oob.desc?}" src="{item.oob.url?}"/></a><figcaption>{item.oob.desc?}</figcaption></figure>}
</li>}
</ol>