Software / code / prosody-modules
Comparison
mod_watchuntrusted/mod_watchuntrusted.lua @ 1878:7f96183a60ce
mod_watchuntrusted: Add support for SHA-256 hash in message
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 27 Sep 2015 21:41:35 +0200 |
| parent | 1877:055b39c08fd0 |
| child | 1926:4c4a4191b825 |
comparison
equal
deleted
inserted
replaced
| 1877:055b39c08fd0 | 1878:7f96183a60ce |
|---|---|
| 41 | 41 |
| 42 if session.cert_identity_status then | 42 if session.cert_identity_status then |
| 43 error_message = error_message .. "This certificate is " .. session.cert_identity_status .. " for " .. host .. "."; | 43 error_message = error_message .. "This certificate is " .. session.cert_identity_status .. " for " .. host .. "."; |
| 44 end | 44 end |
| 45 | 45 |
| 46 local replacements = { sha1 = event.cert and event.cert:digest("sha1"), errors = error_message }; | 46 local replacements = { |
| 47 sha1 = event.cert and event.cert:digest("sha1"), | |
| 48 sha256 = event.cert and event.cert:digest("sha256"), | |
| 49 errors = error_message | |
| 50 }; | |
| 47 | 51 |
| 48 local message = st.message{ type = "chat", from = local_host } | 52 local message = st.message{ type = "chat", from = local_host } |
| 49 :tag("body") | 53 :tag("body") |
| 50 :text(untrusted_fail_notification:gsub("%$([%w_]+)", function (v) | 54 :text(untrusted_fail_notification:gsub("%$([%w_]+)", function (v) |
| 51 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; |