refactor: Remove empty caption from ThreadSafeMessageBox

The caption was empty for all call-sites, so this refactor does not
change any behavior.

Note that noui_ThreadSafeMessageBoxRedirect is test-only, so no end-user
behavior is changed here.
This commit is contained in:
MarcoFalke committed 2026-01-14 19:36:14 +01:00
1 parent fa8d0088e7
commit fafe71b743
9 files changed
+19 -19

No files matched your search

+1 -1
View File
@@ -230,7 +230,7 @@ static bool InitHTTPAllowList()
if (!subnet.IsValid()) { if (!subnet.IsValid()) {
uiInterface.ThreadSafeMessageBox( uiInterface.ThreadSafeMessageBox(
Untranslated(strprintf("Invalid -rpcallowip subnet specification: %s. Valid values are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0), a network/CIDR (e.g. 1.2.3.4/24), all ipv4 (0.0.0.0/0), or all ipv6 (::/0). RFC4193 is allowed only if -cjdnsreachable=0.", strAllow)), Untranslated(strprintf("Invalid -rpcallowip subnet specification: %s. Valid values are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0), a network/CIDR (e.g. 1.2.3.4/24), all ipv4 (0.0.0.0/0), or all ipv6 (::/0). RFC4193 is allowed only if -cjdnsreachable=0.", strAllow)),
"", CClientUIInterface::MSG_ERROR); CClientUIInterface::MSG_ERROR);
return false; return false;
} }
rpc_allow_subnets.push_back(subnet); rpc_allow_subnets.push_back(subnet);
+1 -1
View File
@@ -1377,7 +1377,7 @@ static ChainstateLoadResult InitAndLoadChainstate(
options.coins_error_cb = [] { options.coins_error_cb = [] {
uiInterface.ThreadSafeMessageBox( uiInterface.ThreadSafeMessageBox(
_("Error reading from database, shutting down."), _("Error reading from database, shutting down."),
"", CClientUIInterface::MSG_ERROR); CClientUIInterface::MSG_ERROR);
}; };
uiInterface.InitMessage(_("Loading block index…")); uiInterface.InitMessage(_("Loading block index…"));
auto catch_exceptions = [](auto&& f) -> ChainstateLoadResult { auto catch_exceptions = [](auto&& f) -> ChainstateLoadResult {
+1 -1
View File
@@ -219,7 +219,7 @@ public:
//! Register handler for message box messages. //! Register handler for message box messages.
using MessageBoxFn = using MessageBoxFn =
std::function<bool(const bilingual_str& message, const std::string& caption, unsigned int style)>; std::function<bool(const bilingual_str& message, unsigned int style)>;
virtual std::unique_ptr<Handler> handleMessageBox(MessageBoxFn fn) = 0; virtual std::unique_ptr<Handler> handleMessageBox(MessageBoxFn fn) = 0;
//! Register handler for question messages. //! Register handler for question messages.
+3 -3
View File
@@ -3423,7 +3423,7 @@ bool CConnman::Bind(const CService& addr_, unsigned int flags, NetPermissionFlag
bilingual_str strError; bilingual_str strError;
if (!BindListenPort(addr, strError, permissions)) { if (!BindListenPort(addr, strError, permissions)) {
if ((flags & BF_REPORT_ERROR) && m_client_interface) { if ((flags & BF_REPORT_ERROR) && m_client_interface) {
m_client_interface->ThreadSafeMessageBox(strError, "", CClientUIInterface::MSG_ERROR); m_client_interface->ThreadSafeMessageBox(strError, CClientUIInterface::MSG_ERROR);
} }
return false; return false;
} }
@@ -3478,7 +3478,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
if (m_client_interface) { if (m_client_interface) {
m_client_interface->ThreadSafeMessageBox( m_client_interface->ThreadSafeMessageBox(
_("Failed to listen on any port. Use -listen=0 if you want this."), _("Failed to listen on any port. Use -listen=0 if you want this."),
"", CClientUIInterface::MSG_ERROR); CClientUIInterface::MSG_ERROR);
} }
return false; return false;
} }
@@ -3546,7 +3546,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
if (m_client_interface) { if (m_client_interface) {
m_client_interface->ThreadSafeMessageBox( m_client_interface->ThreadSafeMessageBox(
_("Cannot provide specific connections and have addrman find outgoing connections at the same time."), _("Cannot provide specific connections and have addrman find outgoing connections at the same time."),
"", CClientUIInterface::MSG_ERROR); CClientUIInterface::MSG_ERROR);
} }
return false; return false;
} }
+3 -3
View File
@@ -47,7 +47,7 @@ ADD_SIGNALS_IMPL_WRAPPER(NotifyBlockTip);
ADD_SIGNALS_IMPL_WRAPPER(NotifyHeaderTip); ADD_SIGNALS_IMPL_WRAPPER(NotifyHeaderTip);
ADD_SIGNALS_IMPL_WRAPPER(BannedListChanged); ADD_SIGNALS_IMPL_WRAPPER(BannedListChanged);
bool CClientUIInterface::ThreadSafeMessageBox(const bilingual_str& message, const std::string& caption, unsigned int style) { return g_ui_signals.ThreadSafeMessageBox(message, caption, style).value_or(false);} bool CClientUIInterface::ThreadSafeMessageBox(const bilingual_str& message, unsigned int style) { return g_ui_signals.ThreadSafeMessageBox(message, style).value_or(false);}
bool CClientUIInterface::ThreadSafeQuestion(const bilingual_str& message, const std::string& non_interactive_message, unsigned int style) { return g_ui_signals.ThreadSafeQuestion(message, non_interactive_message, style).value_or(false);} bool CClientUIInterface::ThreadSafeQuestion(const bilingual_str& message, const std::string& non_interactive_message, unsigned int style) { return g_ui_signals.ThreadSafeQuestion(message, non_interactive_message, style).value_or(false);}
void CClientUIInterface::InitMessage(const std::string& message) { return g_ui_signals.InitMessage(message); } void CClientUIInterface::InitMessage(const std::string& message) { return g_ui_signals.InitMessage(message); }
void CClientUIInterface::InitWallet() { return g_ui_signals.InitWallet(); } void CClientUIInterface::InitWallet() { return g_ui_signals.InitWallet(); }
@@ -61,7 +61,7 @@ void CClientUIInterface::BannedListChanged() { return g_ui_signals.BannedListCha
bool InitError(const bilingual_str& str) bool InitError(const bilingual_str& str)
{ {
uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_ERROR); uiInterface.ThreadSafeMessageBox(str, CClientUIInterface::MSG_ERROR);
return false; return false;
} }
@@ -79,5 +79,5 @@ bool InitError(const bilingual_str& str, const std::vector<std::string>& details
void InitWarning(const bilingual_str& str) void InitWarning(const bilingual_str& str)
{ {
uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_WARNING); uiInterface.ThreadSafeMessageBox(str, CClientUIInterface::MSG_WARNING);
} }
+2 -2
View File
@@ -74,9 +74,9 @@ public:
boost::signals2::connection signal_name##_connect(std::function<signal_name##Sig> fn) boost::signals2::connection signal_name##_connect(std::function<signal_name##Sig> fn)
/** Show message box. */ /** Show message box. */
ADD_SIGNALS_DECL_WRAPPER(ThreadSafeMessageBox, bool, const bilingual_str& message, const std::string& caption, unsigned int style); ADD_SIGNALS_DECL_WRAPPER(ThreadSafeMessageBox, bool, const bilingual_str& message, unsigned int style);
/** If possible, ask the user a question. If not, falls back to ThreadSafeMessageBox(noninteractive_message, caption, style) and returns false. */ /** If possible, ask the user a question. If not, falls back to ThreadSafeMessageBox(noninteractive_message, style) and returns false. */
ADD_SIGNALS_DECL_WRAPPER(ThreadSafeQuestion, bool, const bilingual_str& message, const std::string& noninteractive_message, unsigned int style); ADD_SIGNALS_DECL_WRAPPER(ThreadSafeQuestion, bool, const bilingual_str& message, const std::string& noninteractive_message, unsigned int style);
/** Progress message during initialization. */ /** Progress message during initialization. */
+5 -5
View File
@@ -19,7 +19,7 @@ boost::signals2::connection noui_ThreadSafeMessageBoxConn;
boost::signals2::connection noui_ThreadSafeQuestionConn; boost::signals2::connection noui_ThreadSafeQuestionConn;
boost::signals2::connection noui_InitMessageConn; boost::signals2::connection noui_InitMessageConn;
bool noui_ThreadSafeMessageBox(const bilingual_str& message, const std::string& caption, unsigned int style) bool noui_ThreadSafeMessageBox(const bilingual_str& message, unsigned int style)
{ {
bool fSecure = style & CClientUIInterface::SECURE; bool fSecure = style & CClientUIInterface::SECURE;
style &= ~CClientUIInterface::SECURE; style &= ~CClientUIInterface::SECURE;
@@ -39,7 +39,7 @@ bool noui_ThreadSafeMessageBox(const bilingual_str& message, const std::string&
if (!fSecure) LogInfo("%s\n", message.original); if (!fSecure) LogInfo("%s\n", message.original);
break; break;
default: default:
strCaption = caption + ": "; // Use supplied caption (can be empty) strCaption = ": "; // caption is always empty TODO fix this
if (!fSecure) LogInfo("%s%s\n", strCaption, message.original); if (!fSecure) LogInfo("%s%s\n", strCaption, message.original);
} }
@@ -49,7 +49,7 @@ bool noui_ThreadSafeMessageBox(const bilingual_str& message, const std::string&
bool noui_ThreadSafeQuestion(const bilingual_str& /* ignored interactive message */, const std::string& message, unsigned int style) bool noui_ThreadSafeQuestion(const bilingual_str& /* ignored interactive message */, const std::string& message, unsigned int style)
{ {
return noui_ThreadSafeMessageBox(Untranslated(message), /*caption=*/"", style); return noui_ThreadSafeMessageBox(Untranslated(message), style);
} }
void noui_InitMessage(const std::string& message) void noui_InitMessage(const std::string& message)
@@ -64,9 +64,9 @@ void noui_connect()
noui_InitMessageConn = uiInterface.InitMessage_connect(noui_InitMessage); noui_InitMessageConn = uiInterface.InitMessage_connect(noui_InitMessage);
} }
bool noui_ThreadSafeMessageBoxRedirect(const bilingual_str& message, const std::string& caption, unsigned int style) bool noui_ThreadSafeMessageBoxRedirect(const bilingual_str& message, unsigned int style)
{ {
LogInfo("%s: %s", caption, message.original); LogInfo("%s", message.original);
return false; return false;
} }
+1 -1
View File
@@ -10,7 +10,7 @@
struct bilingual_str; struct bilingual_str;
/** Non-GUI handler, which logs and prints messages. */ /** Non-GUI handler, which logs and prints messages. */
bool noui_ThreadSafeMessageBox(const bilingual_str& message, const std::string& caption, unsigned int style); bool noui_ThreadSafeMessageBox(const bilingual_str& message, unsigned int style);
/** Non-GUI handler, which logs and prints questions. */ /** Non-GUI handler, which logs and prints questions. */
bool noui_ThreadSafeQuestion(const bilingual_str& /* ignored interactive message */, const std::string& message, unsigned int style); bool noui_ThreadSafeQuestion(const bilingual_str& /* ignored interactive message */, const std::string& message, unsigned int style);
/** Non-GUI handler, which only logs a message. */ /** Non-GUI handler, which only logs a message. */
+2 -2
View File
@@ -1615,8 +1615,8 @@ static bool ThreadSafeMessageBox(BitcoinGUI* gui, const bilingual_str& message,
void BitcoinGUI::subscribeToCoreSignals() void BitcoinGUI::subscribeToCoreSignals()
{ {
// Connect signals to client // Connect signals to client
m_handler_message_box = m_node.handleMessageBox([this](const bilingual_str& message, const std::string& caption, unsigned int style) { m_handler_message_box = m_node.handleMessageBox([this](const bilingual_str& message, unsigned int style) {
return ThreadSafeMessageBox(this, message, caption, style); return ThreadSafeMessageBox(this, message, /*caption=*/"", style);
}); });
m_handler_question = m_node.handleQuestion([this](const bilingual_str& message, const std::string& /*non_interactive_message*/, unsigned int style) { m_handler_question = m_node.handleQuestion([this](const bilingual_str& message, const std::string& /*non_interactive_message*/, unsigned int style) {
return ThreadSafeMessageBox(this, message, /*caption=*/"", style); return ThreadSafeMessageBox(this, message, /*caption=*/"", style);