| 257 | } |
| 258 | |
| 259 | void CAlert::Notify(const std::string& strMessage, bool fThread) |
| 260 | { |
| 261 | std::string strCmd = GetArg("-alertnotify", ""); |
| 262 | if (strCmd.empty()) return; |
| 263 | |
| 264 | // Alert text should be plain ascii coming from a trusted source, but to |
| 265 | // be safe we first strip anything not in safeChars, then add single quotes around |
| 266 | // the whole string before passing it to the shell: |
| 267 | std::string singleQuote("'"); |
| 268 | std::string safeStatus = SanitizeString(strMessage); |
| 269 | safeStatus = singleQuote + safeStatus + singleQuote; |
| 270 | boost::replace_all(strCmd, "%s", safeStatus); |
| 271 | |
| 272 | if (fThread) |
| 273 | boost::thread t(runCommand, strCmd); // thread runs free |
| 274 | else |
| 275 | runCommand(strCmd); |
| 276 | } |
| 277 | |
| 278 | void ThreadSendAlert() |
| 279 | { |
nothing calls this directly
no test coverage detected