From: Georgios Kontaxis Date: Fri, 12 Mar 2021 22:30:14 +0000 (+0000) Subject: feat: redact sender, channel, and network when message previews are off. X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=refs%2Fheads%2Fkontaxis%2Fredacted-notifications;p=znc-palaver.git feat: redact sender, channel, and network when message previews are off. --- diff --git a/palaver.cpp b/palaver.cpp index 0a2adcb..204915b 100644 --- a/palaver.cpp +++ b/palaver.cpp @@ -812,13 +812,25 @@ public: sJSON += ",\"private\": true"; } - sJSON += ",\"sender\": \"" + sSender.Replace_n("\"", "\\\"") + "\""; + if (GetShowMessagePreview()) { + sJSON += ",\"sender\": \"" + sSender.Replace_n("\"", "\\\"") + "\""; + } else { + sJSON += ",\"sender\": \"Redacted Sender\""; + } if (pChannel) { - sJSON += ",\"channel\": \"" + pChannel->GetName().Replace_n("\"", "\\\"") + "\""; + if (GetShowMessagePreview()) { + sJSON += ",\"channel\": \"" + pChannel->GetName().Replace_n("\"", "\\\"") + "\""; + } else { + sJSON += ",\"channel\": \"Redacted Channel\""; + } } if (module.GetNetwork()) { - const CString sNetworkID = GetNetworkID(*module.GetNetwork()); - sJSON += ",\"network\": \"" + sNetworkID.Replace_n("\"", "\\\"") + "\""; + if (GetShowMessagePreview()) { + const CString sNetworkID = GetNetworkID(*module.GetNetwork()); + sJSON += ",\"network\": \"" + sNetworkID.Replace_n("\"", "\\\"") + "\""; + } else { + sJSON += ",\"network\": \"Redacted Network\""; + } } if (!sIntent.empty()) { sJSON += ",\"intent\": \"" + sIntent + "\"";