aboutsummaryrefslogtreecommitdiff
path: root/src/noui.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2019-04-30 20:55:12 +0300
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2019-06-19 19:22:34 +0300
commit96fd4ee02f6c3be21cade729b95a85c60634b0f8 (patch)
tree25cc4654e027e8e78671f7a523384c6405c4604d /src/noui.cpp
parentf0641f274ffe94fbe7cae43c07a9373013739df2 (diff)
Add MSG_NOPREFIX flag for user messages
It forces do not prepend error/warning prefix.
Diffstat (limited to 'src/noui.cpp')
-rw-r--r--src/noui.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/noui.cpp b/src/noui.cpp
index 0c18b0e231..caab9f326e 100644
--- a/src/noui.cpp
+++ b/src/noui.cpp
@@ -18,26 +18,30 @@ bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& ca
{
bool fSecure = style & CClientUIInterface::SECURE;
style &= ~CClientUIInterface::SECURE;
+ bool prefix = !(style & CClientUIInterface::MSG_NOPREFIX);
+ style &= ~CClientUIInterface::MSG_NOPREFIX;
std::string strCaption;
- // Check for usage of predefined caption
- switch (style) {
- case CClientUIInterface::MSG_ERROR:
- strCaption += _("Error");
- break;
- case CClientUIInterface::MSG_WARNING:
- strCaption += _("Warning");
- break;
- case CClientUIInterface::MSG_INFORMATION:
- strCaption += _("Information");
- break;
- default:
- strCaption += caption; // Use supplied caption (can be empty)
+ if (prefix) {
+ switch (style) {
+ case CClientUIInterface::MSG_ERROR:
+ strCaption = "Error: ";
+ break;
+ case CClientUIInterface::MSG_WARNING:
+ strCaption = "Warning: ";
+ break;
+ case CClientUIInterface::MSG_INFORMATION:
+ strCaption = "Information: ";
+ break;
+ default:
+ strCaption = caption + ": "; // Use supplied caption (can be empty)
+ }
}
- if (!fSecure)
- LogPrintf("%s: %s\n", strCaption, message);
- tfm::format(std::cerr, "%s: %s\n", strCaption.c_str(), message.c_str());
+ if (!fSecure) {
+ LogPrintf("%s%s\n", strCaption, message);
+ }
+ tfm::format(std::cerr, "%s%s\n", strCaption.c_str(), message.c_str());
return false;
}