Add new option message_escape

Allow to escape the keyword replacements before they are put into
message_content with any of the ZNC supported formats. An unknown
value will leave the string unmodified.
This commit is contained in:
Rainer Müller 2018-03-28 11:24:55 +02:00
parent e077fd97db
commit 11f0eb672e
1 changed files with 12 additions and 0 deletions

View File

@ -140,6 +140,7 @@ class CPushMod : public CModule
defaults["message_uri_title"] = "";
defaults["message_priority"] = "0";
defaults["message_sound"] = "";
defaults["message_escape"] = "";
// Notification conditions
defaults["away_only"] = "no";
@ -268,6 +269,14 @@ class CPushMod : public CModule
replace["{network}"] = "(No network)";
}
if (options["message_escape"] != "")
{
CString::EEscape esc = CString::ToEscape(options["message_escape"]);
for (MCString::iterator i = replace.begin(); i != replace.end(); i++) {
i->second = i->second.Escape(esc);
}
}
CString message_uri = expand(options["message_uri"], replace);
CString message_title = expand(options["message_title"], replace);
CString message_content = expand(options["message_content"], replace);
@ -728,6 +737,9 @@ class CPushMod : public CModule
params["chat_id"] = options["target"];
params["text"] = message_content;
if (options["message_escape"] == "HTML") {
params["parse_mode"] = "HTML";
}
}
else
{