MCPcopy Create free account
hub / github.com/Bitcoin-ABC/bitcoin-abc / AlertNotify

Function AlertNotify

src/node/kernel_notifications.cpp:29–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27using util::ReplaceAll;
28
29static void AlertNotify(const std::string &strMessage) {
30 uiInterface.NotifyAlertChanged();
31#if defined(HAVE_SYSTEM)
32 std::string strCmd = gArgs.GetArg("-alertnotify", "");
33 if (strCmd.empty()) {
34 return;
35 }
36
37 // Alert text should be plain ascii coming from a trusted source, but to be
38 // safe we first strip anything not in safeChars, then add single quotes
39 // around the whole string before passing it to the shell:
40 std::string singleQuote("'");
41 std::string safeStatus = SanitizeString(strMessage);
42 safeStatus = singleQuote + safeStatus + singleQuote;
43 ReplaceAll(strCmd, "%s", safeStatus);
44
45 std::thread t(runCommand, strCmd);
46 // thread runs free
47 t.detach();
48#endif
49}
50
51namespace node {
52

Callers 1

warningMethod · 0.85

Calls 5

SanitizeStringFunction · 0.85
ReplaceAllFunction · 0.85
NotifyAlertChangedMethod · 0.80
GetArgMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected