summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-24 21:49:22 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-24 21:49:22 +0300
commit860d3e8e1bbe99b77763d533aebba9fde01e74c6 (patch)
tree7c87dfc372592507ce0a574aff115f209daefd08 /src
parent4749c8977e2e803692bd844b5400f8d72cbaf17f (diff)
downloadmv-860d3e8e1bbe99b77763d533aebba9fde01e74c6.tar.gz
mv-860d3e8e1bbe99b77763d533aebba9fde01e74c6.tar.bz2
mv-860d3e8e1bbe99b77763d533aebba9fde01e74c6.tar.xz
mv-860d3e8e1bbe99b77763d533aebba9fde01e74c6.zip
Add strong typed bool type IgnoreRecord.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/being/localplayer.cpp4
-rw-r--r--src/enums/simpletypes/ignorerecord.h28
-rw-r--r--src/gui/widgets/tabs/chat/chattab.cpp11
-rw-r--r--src/gui/widgets/tabs/chat/chattab.h3
-rw-r--r--src/gui/windows/chatwindow.cpp10
-rw-r--r--src/gui/windows/chatwindow.h9
-rw-r--r--src/net/eathena/chathandler.cpp16
-rw-r--r--src/net/tmwa/chathandler.cpp19
10 files changed, 81 insertions, 21 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 89fe7f666..78b1e0196 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1064,6 +1064,7 @@ SET(SRCS
enums/simpletypes/favorite.h
enums/simpletypes/forcedisplay.h
enums/simpletypes/identified.h
+ enums/simpletypes/ignorerecord.h
enums/simpletypes/keep.h
enums/simpletypes/modal.h
enums/simpletypes/modifiable.h
diff --git a/src/Makefile.am b/src/Makefile.am
index b138ecf09..45962db50 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1192,6 +1192,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
enums/simpletypes/favorite.h \
enums/simpletypes/forcedisplay.h \
enums/simpletypes/identified.h \
+ enums/simpletypes/ignorerecord.h \
enums/simpletypes/keep.h \
enums/simpletypes/modal.h \
enums/simpletypes/modifiable.h \
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 6b8a6e1e9..efb483f6a 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -1908,7 +1908,9 @@ void LocalPlayer::afkRespond(ChatTab *const tab, const std::string &nick)
if (localChatTab)
{
localChatTab->chatLog(std::string(getName()).append(
- " : ").append(msg), ChatMsgType::ACT_WHISPER, false);
+ " : ").append(msg),
+ ChatMsgType::ACT_WHISPER,
+ IgnoreRecord_false);
}
}
else
diff --git a/src/enums/simpletypes/ignorerecord.h b/src/enums/simpletypes/ignorerecord.h
new file mode 100644
index 000000000..7ed2566e8
--- /dev/null
+++ b/src/enums/simpletypes/ignorerecord.h
@@ -0,0 +1,28 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2015 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ENUMS_SIMPLETYPES_IGNORERECORD_H
+#define ENUMS_SIMPLETYPES_IGNORERECORD_H
+
+#include "enums/simpletypes/simpledefines.h"
+
+defBoolEnum(IgnoreRecord);
+
+#endif // ENUMS_SIMPLETYPES_IGNORERECORD_H
diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp
index bd3759c65..072ab677e 100644
--- a/src/gui/widgets/tabs/chat/chattab.cpp
+++ b/src/gui/widgets/tabs/chat/chattab.cpp
@@ -106,8 +106,10 @@ ChatTab::~ChatTab()
delete2(mScrollArea);
}
-void ChatTab::chatLog(std::string line, ChatMsgType::Type own,
- const bool ignoreRecord, const bool tryRemoveColors)
+void ChatTab::chatLog(std::string line,
+ ChatMsgType::Type own,
+ const IgnoreRecord ignoreRecord,
+ const bool tryRemoveColors)
{
// Trim whitespace
trim(line);
@@ -359,7 +361,10 @@ void ChatTab::chatLog(const std::string &nick, std::string msg)
? ChatMsgType::BY_PLAYER : ChatMsgType::BY_OTHER);
if (byWho == ChatMsgType::BY_OTHER && config.getBoolValue("removeColors"))
msg = removeColors(msg);
- chatLog(std::string(nick).append(" : ").append(msg), byWho, false, false);
+ chatLog(std::string(nick).append(" : ").append(msg),
+ byWho,
+ IgnoreRecord_false,
+ false);
}
void ChatTab::chatInput(const std::string &message)
diff --git a/src/gui/widgets/tabs/chat/chattab.h b/src/gui/widgets/tabs/chat/chattab.h
index cc694a874..7af3920ef 100644
--- a/src/gui/widgets/tabs/chat/chattab.h
+++ b/src/gui/widgets/tabs/chat/chattab.h
@@ -25,6 +25,7 @@
#include "enums/gui/chatmsgtype.h"
+#include "enums/simpletypes/ignorerecord.h"
#include "enums/simpletypes/online.h"
#include "gui/widgets/browserbox.h"
@@ -79,7 +80,7 @@ class ChatTab notfinal : public Tab
*/
void chatLog(std::string line,
ChatMsgType::Type own = ChatMsgType::BY_SERVER,
- const bool ignoreRecord = false,
+ const IgnoreRecord ignoreRecord = IgnoreRecord_false,
const bool tryRemoveColors = true);
/**
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index ba882b985..44053c50c 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -1114,7 +1114,9 @@ void ChatWindow::addWhisper(const std::string &restrict nick,
else
{
localChatTab->chatLog(std::string(nick).append(
- " : ").append(mes), ChatMsgType::ACT_WHISPER, false);
+ " : ").append(mes),
+ ChatMsgType::ACT_WHISPER,
+ IgnoreRecord_false);
if (localPlayer)
localPlayer->afkRespond(nullptr, nick);
}
@@ -1506,7 +1508,7 @@ std::string ChatWindow::autoCompleteHistory(const std::string &partName) const
bool ChatWindow::resortChatLog(std::string line,
ChatMsgType::Type own,
const std::string &channel,
- const bool ignoreRecord,
+ const IgnoreRecord ignoreRecord,
const bool tryRemoveColors)
{
if (own == ChatMsgType::BY_UNKNOWN)
@@ -1660,7 +1662,7 @@ bool ChatWindow::resortChatLog(std::string line,
}
void ChatWindow::battleChatLog(const std::string &line, ChatMsgType::Type own,
- const bool ignoreRecord,
+ const IgnoreRecord ignoreRecord,
const bool tryRemoveColors)
{
if (own == ChatMsgType::BY_UNKNOWN)
@@ -1674,7 +1676,7 @@ void ChatWindow::battleChatLog(const std::string &line, ChatMsgType::Type own,
void ChatWindow::channelChatLog(const std::string &channel,
const std::string &line,
ChatMsgType::Type own,
- const bool ignoreRecord,
+ const IgnoreRecord ignoreRecord,
const bool tryRemoveColors)
{
std::string tempChannel = channel;
diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h
index 90c743284..766e5161e 100644
--- a/src/gui/windows/chatwindow.h
+++ b/src/gui/windows/chatwindow.h
@@ -25,6 +25,8 @@
#include "enums/gui/chatmsgtype.h"
+#include "enums/simpletypes/ignorerecord.h"
+
#include "gui/widgets/window.h"
#include "gui/widgets/tabs/chat/chattabtype.h"
@@ -221,19 +223,20 @@ class ChatWindow final : public Window,
bool resortChatLog(std::string line, ChatMsgType::Type own,
const std::string &channel,
- const bool ignoreRecord,
+ const IgnoreRecord ignoreRecord,
const bool tryRemoveColors);
static void battleChatLog(const std::string &line,
ChatMsgType::Type own
= ChatMsgType::BY_UNKNOWN,
- const bool ignoreRecord = false,
+ const IgnoreRecord ignoreRecord
+ = IgnoreRecord_false,
const bool tryRemoveColors = true);
void channelChatLog(const std::string &channel,
const std::string &line,
ChatMsgType::Type own,
- const bool ignoreRecord,
+ const IgnoreRecord ignoreRecord,
const bool tryRemoveColors);
void updateOnline(const std::set<std::string> &onlinePlayers) const;
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index 22db67357..76603734c 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -557,7 +557,8 @@ void ChatHandler::processChatContinue(std::string chatMsg,
allow = chatWindow->resortChatLog(chatMsg,
own,
channel,
- false, true);
+ IgnoreRecord_false,
+ true);
}
const size_t pos = chatMsg.find(" : ", 0);
@@ -638,7 +639,9 @@ void ChatHandler::processWhisperResponse(Net::MessageIn &msg)
// TRANSLATORS: chat message
strprintf(_("Message could not be sent, channel "
"%s is not exists."), nick.c_str()),
- ChatMsgType::BY_SERVER, false, false);
+ ChatMsgType::BY_SERVER,
+ IgnoreRecord_false,
+ false);
if (!mSentWhispers.empty())
mSentWhispers.pop();
return;
@@ -782,7 +785,9 @@ void ChatHandler::processJoinChannel(Net::MessageIn &msg)
// TRANSLATORS: chat message
strprintf(_("Can't open channel. Channel "
"%s is not exists."), channel.c_str()),
- ChatMsgType::BY_SERVER, false, false);
+ ChatMsgType::BY_SERVER,
+ IgnoreRecord_false,
+ false);
break;
case 1:
@@ -873,7 +878,10 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg)
{
allow = chatWindow->resortChatLog(
removeColors(sender_name).append(" : ").append(chatMsg),
- ChatMsgType::BY_OTHER, GENERAL_CHANNEL, false, true);
+ ChatMsgType::BY_OTHER,
+ GENERAL_CHANNEL,
+ IgnoreRecord_false,
+ true);
}
if (allow && being && player_relations.hasPermission(sender_name,
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index e870ba563..be04b2964 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -331,8 +331,11 @@ void ChatHandler::processChatContinue(std::string chatMsg,
bool allow(true);
if (chatWindow)
{
- allow = chatWindow->resortChatLog(chatMsg, ChatMsgType::BY_PLAYER,
- channel, false, true);
+ allow = chatWindow->resortChatLog(chatMsg,
+ ChatMsgType::BY_PLAYER,
+ channel,
+ IgnoreRecord_false,
+ true);
}
if (channel.empty())
@@ -399,8 +402,11 @@ void ChatHandler::processGmChat(Net::MessageIn &msg)
bool allow(true);
if (chatWindow)
{
- allow = chatWindow->resortChatLog(chatMsg, ChatMsgType::BY_PLAYER,
- channel, false, true);
+ allow = chatWindow->resortChatLog(chatMsg,
+ ChatMsgType::BY_PLAYER,
+ channel,
+ IgnoreRecord_false,
+ true);
}
if (channel.empty())
@@ -669,7 +675,10 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg)
{
allow = chatWindow->resortChatLog(
removeColors(sender_name).append(" : ").append(chatMsg),
- ChatMsgType::BY_OTHER, channel, false, true);
+ ChatMsgType::BY_OTHER,
+ channel,
+ IgnoreRecord_false,
+ true);
}
if (allow && player_relations.hasPermission(sender_name,