Comparison

mod_watchuntrusted/mod_watchuntrusted.lua @ 2887:65082d91950e

Many modules: Simplify st.message(…):tag("body"):text(…):up() into st.message(…, …)
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 17 Feb 2018 08:42:10 +0100
parent 2810:9a3e51f348fe
child 3020:ec671ad1a8a9
comparison
equal deleted inserted replaced
2886:5ca6d53d3186 2887:65082d91950e
47 sha1 = event.cert and event.cert:digest("sha1") or "(No certificate)", 47 sha1 = event.cert and event.cert:digest("sha1") or "(No certificate)",
48 sha256 = event.cert and event.cert:digest("sha256") or "(No certificate)", 48 sha256 = event.cert and event.cert:digest("sha256") or "(No certificate)",
49 errors = error_message 49 errors = error_message
50 }; 50 };
51 51
52 local message = st.message{ type = "chat", from = local_host } 52 local message = st.message({ type = "chat", from = local_host },
53 :tag("body") 53 untrusted_fail_notification:gsub("%$([%w_]+)", function (v)
54 :text(untrusted_fail_notification:gsub("%$([%w_]+)", function (v) 54 return event[v] or session and session[v] or replacements and replacements[v] or nil;
55 return event[v] or session and session[v] or replacements and replacements[v] or nil; 55 end));
56 end));
57 for jid in untrusted_fail_watchers do 56 for jid in untrusted_fail_watchers do
58 module:log("debug", "Notifying %s", jid); 57 module:log("debug", "Notifying %s", jid);
59 message.attr.to = jid; 58 message.attr.to = jid;
60 module:send(message); 59 module:send(message);
61 end 60 end