|
|
@ -233,14 +233,25 @@ bool CAlert::ProcessAlert(bool fThread) |
|
|
|
if(AppliesToMe()) |
|
|
|
if(AppliesToMe()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
uiInterface.NotifyAlertChanged(GetHash(), CT_NEW); |
|
|
|
uiInterface.NotifyAlertChanged(GetHash(), CT_NEW); |
|
|
|
|
|
|
|
Notify(strStatusBar, fThread); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LogPrint("alert", "accepted alert %d, AppliesToMe()=%d\n", nID, AppliesToMe()); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
|
|
|
CAlert::Notify(const std::string& strMessage, bool fThread) |
|
|
|
|
|
|
|
{ |
|
|
|
std::string strCmd = GetArg("-alertnotify", ""); |
|
|
|
std::string strCmd = GetArg("-alertnotify", ""); |
|
|
|
if (!strCmd.empty()) |
|
|
|
if (strCmd.empty()) return; |
|
|
|
{ |
|
|
|
|
|
|
|
// Alert text should be plain ascii coming from a trusted source, but to
|
|
|
|
// Alert text should be plain ascii coming from a trusted source, but to
|
|
|
|
// be safe we first strip anything not in safeChars, then add single quotes around
|
|
|
|
// be safe we first strip anything not in safeChars, then add single quotes around
|
|
|
|
// the whole string before passing it to the shell:
|
|
|
|
// the whole string before passing it to the shell:
|
|
|
|
std::string singleQuote("'"); |
|
|
|
std::string singleQuote("'"); |
|
|
|
std::string safeStatus = SanitizeString(strStatusBar); |
|
|
|
std::string safeStatus = SanitizeString(strMessage); |
|
|
|
safeStatus = singleQuote+safeStatus+singleQuote; |
|
|
|
safeStatus = singleQuote+safeStatus+singleQuote; |
|
|
|
boost::replace_all(strCmd, "%s", safeStatus); |
|
|
|
boost::replace_all(strCmd, "%s", safeStatus); |
|
|
|
|
|
|
|
|
|
|
@ -248,10 +259,4 @@ bool CAlert::ProcessAlert(bool fThread) |
|
|
|
boost::thread t(runCommand, strCmd); // thread runs free
|
|
|
|
boost::thread t(runCommand, strCmd); // thread runs free
|
|
|
|
else |
|
|
|
else |
|
|
|
runCommand(strCmd); |
|
|
|
runCommand(strCmd); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LogPrint("alert", "accepted alert %d, AppliesToMe()=%d\n", nID, AppliesToMe()); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|