From 3b22410e42be27ac30fc63f020243241d1eea737 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 22 Dec 2017 04:36:26 +0300 Subject: Remove default parameters from chatwindow.h --- src/gui/windows/chatwindow.cpp | 8 ++++-- src/gui/windows/chatwindow.h | 20 ++++++------- src/gui/windows/statuswindow.cpp | 3 +- src/gui/windows/whoisonline.cpp | 5 ++-- src/net/ea/chatrecv.cpp | 4 +-- src/net/eathena/chatrecv.cpp | 6 +++- src/net/tmwa/chatrecv.cpp | 50 +++++++++++++++++++++++++-------- src/progs/manaplus/actions/actions.cpp | 3 +- src/progs/manaplus/actions/chat.cpp | 7 +++-- src/progs/manaplus/actions/commands.cpp | 2 +- 10 files changed, 71 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 2afbe7caf..9eb01a3ad 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1062,7 +1062,8 @@ void ChatWindow::attributeChanged(const AttributesT id, PRAGMA45(GCC diagnostic pop) } -void ChatWindow::addInputText(const std::string &text, const bool space) +void ChatWindow::addInputText(const std::string &text, + const bool space) { const int caretPos = mChatInput->getCaretPosition(); const std::string &inputText = mChatInput->getText(); @@ -1083,7 +1084,8 @@ void ChatWindow::addItemText(const std::string &item) { std::ostringstream text; text << "[" << item << "]"; - addInputText(text.str()); + addInputText(text.str(), + true); } void ChatWindow::setVisible(Visible visible) @@ -1122,7 +1124,7 @@ void ChatWindow::addWhisper(const std::string &restrict nick, } else if (config.getBoolValue("whispertab")) { - tab = addWhisperTab(nick, nick); + tab = addWhisperTab(nick, nick, false); if (tab != nullptr) saveState(); } diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h index 7d02e0fd3..051d89288 100644 --- a/src/gui/windows/chatwindow.h +++ b/src/gui/windows/chatwindow.h @@ -145,7 +145,8 @@ class ChatWindow final : public Window, void setInputText(const std::string &text); /** Add the given text to the chat input. */ - void addInputText(const std::string &text, const bool space = true); + void addInputText(const std::string &text, + const bool space); /** Called to add item to chat */ void addItemText(const std::string &item); @@ -189,19 +190,19 @@ class ChatWindow final : public Window, void addWhisper(const std::string &restrict nick, const std::string &restrict mes, - const ChatMsgTypeT own = ChatMsgType::BY_OTHER); + const ChatMsgTypeT own); WhisperTab *addWhisperTab(const std::string &caption, const std::string &nick, - const bool switchTo = false) A_WARN_UNUSED; + const bool switchTo) A_WARN_UNUSED; WhisperTab *getWhisperTab(const std::string &nick) const A_WARN_UNUSED; ChatTab *addChannelTab(const std::string &name, - const bool switchTo = false); + const bool switchTo); ChatTab *addSpecialChannelTab(const std::string &name, - const bool switchTo = false); + const bool switchTo); ChatTab *addChatTab(const std::string &name, const bool switchTo, @@ -221,12 +222,9 @@ class ChatWindow final : public Window, const TryRemoveColors tryRemoveColors); static void battleChatLog(const std::string &line, - ChatMsgTypeT own - = ChatMsgType::BY_UNKNOWN, - const IgnoreRecord ignoreRecord - = IgnoreRecord_false, - const TryRemoveColors tryRemoveColors - = TryRemoveColors_true); + ChatMsgTypeT own, + const IgnoreRecord ignoreRecord, + const TryRemoveColors tryRemoveColors); void channelChatLog(const std::string &channel, const std::string &line, diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index c144fdc57..deddf397e 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -650,6 +650,7 @@ void StatusWindow::action(const ActionEvent &event) if (event.getId() == "copy") { - chatWindow->addInputText(mBasicStatsPage->getStatsStr()); + chatWindow->addInputText(mBasicStatsPage->getStatsStr(), + true); } } diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index 5be4fa590..41738180a 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -202,8 +202,9 @@ void WhoIsOnline::handleLink(const std::string& link, MouseEvent *event) } else { - chatWindow->addInputText(std::string("/w \"").append( - text).append("\" ")); + chatWindow->addInputText( + std::string("/w \"").append(text).append("\" "), + true); } } } diff --git a/src/net/ea/chatrecv.cpp b/src/net/ea/chatrecv.cpp index 87db3fa98..5b3ec562a 100644 --- a/src/net/ea/chatrecv.cpp +++ b/src/net/ea/chatrecv.cpp @@ -92,8 +92,8 @@ void ChatRecv::processWhisperResponseContinue(Net::MessageIn &msg, chatWindow->addWhisper(nick, // TRANSLATORS: chat message strprintf(_("Whisper could not be sent, %s is offline."), - nick.c_str()), - ChatMsgType::BY_SERVER); + nick.c_str()), + ChatMsgType::BY_SERVER); } break; case 0x02: diff --git a/src/net/eathena/chatrecv.cpp b/src/net/eathena/chatrecv.cpp index 60033bf55..6d125aad6 100644 --- a/src/net/eathena/chatrecv.cpp +++ b/src/net/eathena/chatrecv.cpp @@ -494,7 +494,11 @@ void ChatRecv::processWhisperContinue(const std::string &nick, if (nick != "Server") { if (playerRelations.hasPermission(nick, PlayerRelation::WHISPER)) - chatWindow->addWhisper(nick, chatMsg); + { + chatWindow->addWhisper(nick, + chatMsg, + ChatMsgType::BY_OTHER); + } } else if (localChatTab != nullptr) { diff --git a/src/net/tmwa/chatrecv.cpp b/src/net/tmwa/chatrecv.cpp index 42cac06f4..480527a82 100644 --- a/src/net/tmwa/chatrecv.cpp +++ b/src/net/tmwa/chatrecv.cpp @@ -195,7 +195,11 @@ void ChatRecv::processWhisperContinue(const std::string &nick, if (tradeBot) { if (showMsg && (chatWindow != nullptr)) - chatWindow->addWhisper(nick, chatMsg); + { + chatWindow->addWhisper(nick, + chatMsg, + ChatMsgType::BY_OTHER); + } shopWindow->giveList(nick, ShopWindow::SELL); } } @@ -203,15 +207,23 @@ void ChatRecv::processWhisperContinue(const std::string &nick, { if (tradeBot) { - if (showMsg && (chatWindow != nullptr)) - chatWindow->addWhisper(nick, chatMsg); + if (showMsg && chatWindow != nullptr) + { + chatWindow->addWhisper(nick, + chatMsg, + ChatMsgType::BY_OTHER); + } shopWindow->giveList(nick, ShopWindow::BUY); } } else if (chatMsg.find("!buyitem ") == 0) { - if (showMsg && (chatWindow != nullptr)) - chatWindow->addWhisper(nick, chatMsg); + if (showMsg && chatWindow != nullptr) + { + chatWindow->addWhisper(nick, + chatMsg, + ChatMsgType::BY_OTHER); + } if (tradeBot) { shopWindow->processRequest(nick, chatMsg, @@ -220,8 +232,12 @@ void ChatRecv::processWhisperContinue(const std::string &nick, } else if (chatMsg.find("!sellitem ") == 0) { - if (showMsg && (chatWindow != nullptr)) - chatWindow->addWhisper(nick, chatMsg); + if (showMsg && chatWindow != nullptr) + { + chatWindow->addWhisper(nick, + chatMsg, + ChatMsgType::BY_OTHER); + } if (tradeBot) { shopWindow->processRequest(nick, chatMsg, @@ -232,19 +248,27 @@ void ChatRecv::processWhisperContinue(const std::string &nick, && chatMsg.find("\302\202") == 0) { chatMsg = chatMsg.erase(0, 2); - if (showMsg && (chatWindow != nullptr)) - chatWindow->addWhisper(nick, chatMsg); + if (showMsg && chatWindow != nullptr) + { + chatWindow->addWhisper(nick, + chatMsg, + ChatMsgType::BY_OTHER); + } if (chatMsg.find("B1") == 0 || chatMsg.find("S1") == 0) ShopWindow::showList(nick, chatMsg); } else if (chatWindow != nullptr) { - chatWindow->addWhisper(nick, chatMsg); + chatWindow->addWhisper(nick, + chatMsg, + ChatMsgType::BY_OTHER); } } else if (chatWindow != nullptr) { - chatWindow->addWhisper(nick, chatMsg); + chatWindow->addWhisper(nick, + chatMsg, + ChatMsgType::BY_OTHER); } } else @@ -254,7 +278,9 @@ void ChatRecv::processWhisperContinue(const std::string &nick, (chatMsg.find("!selllist") != 0 && chatMsg.find("!buylist") != 0))) { - chatWindow->addWhisper(nick, chatMsg); + chatWindow->addWhisper(nick, + chatMsg, + ChatMsgType::BY_OTHER); } } } diff --git a/src/progs/manaplus/actions/actions.cpp b/src/progs/manaplus/actions/actions.cpp index 1a3543aba..f74cc681a 100644 --- a/src/progs/manaplus/actions/actions.cpp +++ b/src/progs/manaplus/actions/actions.cpp @@ -1883,7 +1883,8 @@ impHandler(barToChat) { if (chatWindow != nullptr) { - chatWindow->addInputText(event.args); + chatWindow->addInputText(event.args, + true); return true; } return false; diff --git a/src/progs/manaplus/actions/chat.cpp b/src/progs/manaplus/actions/chat.cpp index 2440af9af..5e74b1a36 100644 --- a/src/progs/manaplus/actions/chat.cpp +++ b/src/progs/manaplus/actions/chat.cpp @@ -291,8 +291,9 @@ impHandler(msgText) } else { - chatWindow->addInputText(std::string("/w \"").append( - event.args).append("\" ")); + chatWindow->addInputText( + std::string("/w \"").append(event.args).append("\" "), + true); } return true; } @@ -574,7 +575,7 @@ impHandler(kickGuild) impHandler(addText) { if (chatWindow != nullptr) - chatWindow->addInputText(event.args); + chatWindow->addInputText(event.args, true); return true; } diff --git a/src/progs/manaplus/actions/commands.cpp b/src/progs/manaplus/actions/commands.cpp index 54b8c28bd..65a2b00c7 100644 --- a/src/progs/manaplus/actions/commands.cpp +++ b/src/progs/manaplus/actions/commands.cpp @@ -2009,7 +2009,7 @@ impHandler0(outfitToChat) const std::string str = outfitWindow->getOutfitString(); if (!str.empty()) - chatWindow->addInputText(str); + chatWindow->addInputText(str, true); return true; } -- cgit v1.2.3-70-g09d2