MCPcopy Create free account
hub / github.com/ElementsProject/elements / AlertNotify

Function AlertNotify

src/validation.cpp:1597–1615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1595}
1596
1597static void AlertNotify(const std::string& strMessage)
1598{
1599 uiInterface.NotifyAlertChanged();
1600#if HAVE_SYSTEM
1601 std::string strCmd = gArgs.GetArg("-alertnotify", "");
1602 if (strCmd.empty()) return;
1603
1604 // Alert text should be plain ascii coming from a trusted source, but to
1605 // be safe we first strip anything not in safeChars, then add single quotes around
1606 // the whole string before passing it to the shell:
1607 std::string singleQuote("'");
1608 std::string safeStatus = SanitizeString(strMessage);
1609 safeStatus = singleQuote+safeStatus+singleQuote;
1610 boost::replace_all(strCmd, "%s", safeStatus);
1611
1612 std::thread t(runCommand, strCmd);
1613 t.detach(); // thread runs free
1614#endif
1615}
1616
1617void CChainState::CheckForkWarningConditions()
1618{

Callers 1

DoWarningFunction · 0.85

Calls 4

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

Tested by

no test coverage detected