diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/tabs/setup_chat.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 7 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.h | 1 |
3 files changed, 11 insertions, 1 deletions
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; }; |