# HG changeset patch # User Kim Alvefur # Date 1557058010 -7200 # Node ID 444e2306c99a6a39a25467f072eb4e93a6a92580 # Parent dbc67120097f09aea3d61fcd497d6bb4fd31269d mod_http_muc_log: Add option to show OOB images diff -r dbc67120097f -r 444e2306c99a mod_http_muc_log/README.markdown --- a/mod_http_muc_log/README.markdown Sun May 05 14:05:00 2019 +0200 +++ b/mod_http_muc_log/README.markdown Sun May 05 14:06:50 2019 +0200 @@ -50,6 +50,15 @@ for rendering templates, with the pattern `"%b{}"` and HTML / XML escaping enabled. +## Inline images + +Inline images can optionally be shown. This is disabled by default for +privacy reasons. + +``` {.lua} +http_muc_log_show_images = true +``` + ## Calendar optimization The calendar view relies on an optional part of the Prosody archive diff -r dbc67120097f -r 444e2306c99a mod_http_muc_log/http_muc_log.html --- a/mod_http_muc_log/http_muc_log.html Sun May 05 14:05:00 2019 +0200 +++ b/mod_http_muc_log/http_muc_log.html Sun May 05 14:06:50 2019 +0200 @@ -89,6 +89,7 @@ {item.nick} {item.verb?} {item.body?} +{item.oob.url&
{item.oob.desc?}
{item.oob.desc?}
} } diff -r dbc67120097f -r 444e2306c99a mod_http_muc_log/mod_http_muc_log.lua --- a/mod_http_muc_log/mod_http_muc_log.lua Sun May 05 14:05:00 2019 +0200 +++ b/mod_http_muc_log/mod_http_muc_log.lua Sun May 05 14:06:50 2019 +0200 @@ -28,6 +28,7 @@ return get_room_from_jid(jid); end +local use_oob = module:get_option_boolean(module.name .. "_show_images", false); module:depends"http"; local template; @@ -268,8 +269,9 @@ -- TODO Distinguish between join and presence update verb = item.attr.type == "unavailable" and "has left" or "has joined"; end - if body or verb then - logs[i], i = { + local oob = use_oob and item:get_child("x", "jabber:x:oob"); + if body or verb or oob then + local line = { key = key; datetime = datetime.datetime(when); time = datetime.time(when); @@ -278,7 +280,14 @@ nick = select(3, jid_split(item.attr.from)); st_name = item.name; st_type = item.attr.type; - }, i + 1; + }; + if oob then + line.oob = { + url = oob:get_child_text("url"); + desc = oob:get_child_text("desc"); + } + end + logs[i], i = line, i + 1; end first = first or key; last = key;