summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-03 16:01:15 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-03 16:01:15 +0300
commite183ff2fa9bfc3c9f61130209e191dae4ce2a886 (patch)
tree002f0512213543681e9ab710745bc72bfe227f89 /src
parentd155816b5c271a0ed549e19128a54ef2f4a7a72a (diff)
downloadmanaverse-e183ff2fa9bfc3c9f61130209e191dae4ce2a886.tar.gz
manaverse-e183ff2fa9bfc3c9f61130209e191dae4ce2a886.tar.bz2
manaverse-e183ff2fa9bfc3c9f61130209e191dae4ce2a886.tar.xz
manaverse-e183ff2fa9bfc3c9f61130209e191dae4ce2a886.zip
Add option in settings to allow enable/disable sell spam filter.
Diffstat (limited to 'src')
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/gui/widgets/tabs/setup_chat.cpp4
-rw-r--r--src/gui/windows/chatwindow.cpp7
-rw-r--r--src/gui/windows/chatwindow.h1
4 files changed, 12 insertions, 1 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 2ba787af2..5ab858a5f 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -383,6 +383,7 @@ DefaultsData* getConfigDefaults()
AddDEF("skillAutotarget", true);
AddDEF("logPlayerActions", false);
AddDEF("enableGuiOpacity", true);
+ AddDEF("enableTradeFilter", true);
return configData;
}
diff --git a/src/gui/widgets/tabs/setup_chat.cpp b/src/gui/widgets/tabs/setup_chat.cpp
index a25613d27..a005524c2 100644
--- a/src/gui/widgets/tabs/setup_chat.cpp
+++ b/src/gui/widgets/tabs/setup_chat.cpp
@@ -275,6 +275,10 @@ Setup_Chat::Setup_Chat(const Widget2 *const widget) :
"less usable space for text."),
"hideChatInput", this, "hideChatInputEvent");
+ // TRANSLATORS: settings option
+ new SetupItemCheckBox(_("Enable trade spam filter"),
+ "", "enableTradeFilter", this, "enableTradeFilterEvent");
+
// TRANSLATORS: settings group
new SetupItemLabel(_("Time"), "", this);
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 940eb75e5..84f24fa6c 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -116,6 +116,7 @@ ChatWindow::ChatWindow() :
mAutoHide(config.getBoolValue("autohideChat")),
mShowBattleEvents(config.getBoolValue("showBattleEvents")),
mShowAllLang(serverConfig.getValue("showAllLang", 0)),
+ mEnableTradeFilter(config.getBoolValue("enableTradeFilter")),
mTmpVisible(false)
{
setWindowName("Chat");
@@ -191,6 +192,7 @@ ChatWindow::ChatWindow() :
config.addListener("autohideChat", this);
config.addListener("showBattleEvents", this);
config.addListener("globalsFilter", this);
+ config.addListener("enableTradeFilter", this);
enableVisibleSound(true);
}
@@ -1540,7 +1542,8 @@ bool ChatWindow::resortChatLog(std::string line,
{
prefix = std::string("##3").append(channel).append("##0");
}
- else if (tradeChatTab &&
+ else if (mEnableTradeFilter &&
+ tradeChatTab &&
findI(line, mTradeFilter) != std::string::npos)
{
tradeChatTab->chatLog(std::string("##S") + _("Moved: ") + line,
@@ -2059,6 +2062,8 @@ void ChatWindow::optionChanged(const std::string &name)
mShowBattleEvents = config.getBoolValue("showBattleEvents");
else if (name == "globalsFilter")
parseGlobalsFilter();
+ else if (name == "enableTradeFilter")
+ mEnableTradeFilter = config.getBoolValue("enableTradeFilter");
}
void ChatWindow::mouseMoved(MouseEvent &event)
diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h
index bd0797e8c..0e1b6336d 100644
--- a/src/gui/windows/chatwindow.h
+++ b/src/gui/windows/chatwindow.h
@@ -416,6 +416,7 @@ class ChatWindow final : public Window,
bool mAutoHide;
bool mShowBattleEvents;
bool mShowAllLang;
+ bool mEnableTradeFilter;
bool mTmpVisible;
};