# HG changeset patch # User Kim Alvefur # Date 1570649713 -7200 # Node ID 7244ff1d62a87de0aff63c65f2ebe843b097ad86 # Parent caf27826c7b2c769b6108256637b3dc1e11e2ec0 mod_http_muc_log: Expose xml:lang from each message/body #a11y Individual messages may be in a different language than the main language of the room. diff -r caf27826c7b2 -r 7244ff1d62a8 mod_http_muc_log/http_muc_log.html --- a/mod_http_muc_log/http_muc_log.html Wed Oct 09 21:36:23 2019 +0200 +++ b/mod_http_muc_log/http_muc_log.html Wed Oct 09 21:35:13 2019 +0200 @@ -91,7 +91,7 @@
    {lines# -
  1. +
  2. {item.nick} {item.verb?} diff -r caf27826c7b2 -r 7244ff1d62a8 mod_http_muc_log/mod_http_muc_log.lua --- a/mod_http_muc_log/mod_http_muc_log.lua Wed Oct 09 21:36:23 2019 +0200 +++ b/mod_http_muc_log/mod_http_muc_log.lua Wed Oct 09 21:35:13 2019 +0200 @@ -294,9 +294,11 @@ local first, last; for key, item, when in iter do - local body = item:get_child_text("body"); + local body_tag = item:get_child("body"); + local body = body_tag and body_tag:get_text(); local subject = item:get_child_text("subject"); local verb = nil; + local lang = body_tag and body_tag.attr["xml:lang"] or item.attr["xml:lang"]; if subject then verb, body = "set the topic to", subject; elseif body and body:sub(1,4) == "/me " then @@ -304,6 +306,7 @@ elseif item.name == "presence" then -- TODO Distinguish between join and presence update verb = item.attr.type == "unavailable" and "has left" or "has joined"; + lang = "en"; end local oob = use_oob and item:get_child("x", "jabber:x:oob"); if body or verb or oob then @@ -313,6 +316,7 @@ time = datetime.time(when); verb = verb; body = body; + lang = lang; nick = select(3, jid_split(item.attr.from)); st_name = item.name; st_type = item.attr.type;