From 7da1fab7ee72517bf2359a184d544734e92be6a9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 24 May 2015 22:31:47 +0300 Subject: From ChatTab::chatLog removed default parameter for message owner type. --- src/actions/actions.cpp | 73 +++++++++++++++++++++++----------- src/actions/chat.cpp | 14 +++++-- src/actormanager.cpp | 16 +++++--- src/gui/widgets/tabs/chat/chattab.cpp | 6 ++- src/gui/widgets/tabs/chat/chattab.h | 4 +- src/gui/widgets/tabs/chat/partytab.cpp | 6 ++- src/gui/windows/chatwindow.cpp | 14 ++++--- src/gui/windows/socialwindow.cpp | 24 +++++++---- src/net/ea/guildhandler.cpp | 2 +- src/net/tmwa/chathandler.cpp | 2 +- src/net/tmwa/guildmanager.cpp | 4 +- 11 files changed, 108 insertions(+), 57 deletions(-) diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 2fa4aad48..eb05e5811 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -895,21 +895,29 @@ impHandler0(ipcToggle) { IPC::stop(); if (!ipc) - debugChatTab->chatLog("IPC service stopped."); + { + debugChatTab->chatLog("IPC service stopped.", + ChatMsgType::BY_SERVER); + } else - debugChatTab->chatLog("Unable to stop IPC service."); + { + debugChatTab->chatLog("Unable to stop IPC service.", + ChatMsgType::BY_SERVER); + } } else { IPC::start(); if (ipc) { - debugChatTab->chatLog(strprintf("IPC service available on port %d", - ipc->getPort())); + debugChatTab->chatLog( + strprintf("IPC service available on port %d", ipc->getPort()), + ChatMsgType::BY_SERVER); } else { - debugChatTab->chatLog("Unable to start IPC service"); + debugChatTab->chatLog("Unable to start IPC service", + ChatMsgType::BY_SERVER); } } return true; @@ -941,7 +949,8 @@ impHandler0(cleanGraphics) if (debugChatTab) { // TRANSLATORS: clear graphics command message - debugChatTab->chatLog(_("Cache cleaned")); + debugChatTab->chatLog(_("Cache cleaned"), + ChatMsgType::BY_SERVER); } return true; } @@ -953,7 +962,8 @@ impHandler0(cleanFonts) if (debugChatTab) { // TRANSLATORS: clear fonts cache message - debugChatTab->chatLog(_("Cache cleaned")); + debugChatTab->chatLog(_("Cache cleaned"), + ChatMsgType::BY_SERVER); } return true; } @@ -1012,7 +1022,7 @@ impHandler0(cacheInfo) return; unsigned int all = 0; - debugChatTab->chatLog(_("font cache size")); + debugChatTab->chatLog(_("font cache size"), ChatMsgType::BY_SERVER); std::string str; for (int f = 0; f < 256; f ++) { @@ -1023,14 +1033,17 @@ impHandler0(cacheInfo) str.append(strprintf("%d: %u, ", f, sz)); } } - debugChatTab->chatLog(str); - debugChatTab->chatLog(strprintf("%s %d", _("Cache size:"), all)); + debugChatTab->chatLog(str, ChatMsgType::BY_SERVER); + debugChatTab->chatLog(strprintf("%s %d", _("Cache size:"), all), + ChatMsgType::BY_SERVER); #ifdef DEBUG_FONT_COUNTERS - debugChatTab->chatLog(""); + debugChatTab->chatLog("", ChatMsgType::BY_SERVER); debugChatTab->chatLog(strprintf("%s %d", - _("Created:"), font->getCreateCounter())); + _("Created:"), font->getCreateCounter()), + ChatMsgType::BY_SERVER); debugChatTab->chatLog(strprintf("%s %d", - _("Deleted:"), font->getDeleteCounter())); + _("Deleted:"), font->getDeleteCounter()), + ChatMsgType::BY_SERVER); #endif */ return true; @@ -1063,13 +1076,17 @@ impHandler0(dirs) return false; debugChatTab->chatLog("config directory: " - + settings.configDir); + + settings.configDir, + ChatMsgType::BY_SERVER); debugChatTab->chatLog("logs directory: " - + settings.localDataDir); + + settings.localDataDir, + ChatMsgType::BY_SERVER); debugChatTab->chatLog("screenshots directory: " - + settings.screenshotDir); + + settings.screenshotDir, + ChatMsgType::BY_SERVER); debugChatTab->chatLog("temp directory: " - + settings.tempDir); + + settings.tempDir, + ChatMsgType::BY_SERVER); return true; } @@ -1081,7 +1098,8 @@ impHandler0(uptime) if (cur_time < start_time) { // TRANSLATORS: uptime command - debugChatTab->chatLog(strprintf(_("Client uptime: %s"), "unknown")); + debugChatTab->chatLog(strprintf(_("Client uptime: %s"), "unknown"), + ChatMsgType::BY_SERVER); } else { @@ -1137,7 +1155,8 @@ impHandler0(uptime) timeDiff), timeDiff)); } // TRANSLATORS: uptime command - debugChatTab->chatLog(strprintf(_("Client uptime: %s"), str.c_str())); + debugChatTab->chatLog(strprintf(_("Client uptime: %s"), str.c_str()), + ChatMsgType::BY_SERVER); } return true; } @@ -1150,7 +1169,7 @@ static void showRes(std::string str, ResourceManager::Resources *res) str.append(toString(res->size())); if (debugChatTab) - debugChatTab->chatLog(str); + debugChatTab->chatLog(str, ChatMsgType::BY_SERVER); logger->log(str); ResourceManager::ResourceIterator iter = res->begin(); const ResourceManager::ResourceIterator iter_end = res->end(); @@ -1203,11 +1222,13 @@ impHandler(dump) { ResourceManager::Resources *res = resman->getResources(); // TRANSLATORS: dump command - debugChatTab->chatLog(_("Resource images:") + toString(res->size())); + debugChatTab->chatLog(_("Resource images:") + toString(res->size()), + ChatMsgType::BY_SERVER); res = resman->getOrphanedResources(); // TRANSLATORS: dump command debugChatTab->chatLog(_("Resource orphaned images:") - + toString(res->size())); + + toString(res->size()), + ChatMsgType::BY_SERVER); } return true; } @@ -1294,7 +1315,8 @@ impHandler0(dumpEnvironment) if (debugChatTab) { // TRANSLATORS: dump environment command - debugChatTab->chatLog(_("Environment variables dumped")); + debugChatTab->chatLog(_("Environment variables dumped"), + ChatMsgType::BY_SERVER); } return true; } @@ -1374,7 +1396,10 @@ impHandler0(testSdlFont) time1.tv_sec) * 1000000000LL + static_cast( time1.tv_nsec)) / 100000; if (debugChatTab) - debugChatTab->chatLog("sdlfont time: " + toString(diff)); + { + debugChatTab->chatLog("sdlfont time: " + toString(diff), + ChatMsgType::BY_SERVER); + } return true; } #endif diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp index 974cc057f..125a9b94c 100644 --- a/src/actions/chat.cpp +++ b/src/actions/chat.cpp @@ -408,7 +408,8 @@ impHandler(toggle) { // TRANSLATORS: message from toggle chat command event.tab->chatLog(chatWindow->getReturnTogglesChat() ? - _("Return toggles chat.") : _("Message closes chat.")); + _("Return toggles chat.") : _("Message closes chat."), + ChatMsgType::BY_SERVER); } return true; } @@ -419,7 +420,8 @@ impHandler(toggle) if (event.tab) { // TRANSLATORS: message from toggle chat command - event.tab->chatLog(_("Return now toggles chat.")); + event.tab->chatLog(_("Return now toggles chat."), + ChatMsgType::BY_SERVER); } if (chatWindow) chatWindow->setReturnTogglesChat(true); @@ -428,14 +430,18 @@ impHandler(toggle) if (event.tab) { // TRANSLATORS: message from toggle chat command - event.tab->chatLog(_("Message now closes chat.")); + event.tab->chatLog(_("Message now closes chat."), + ChatMsgType::BY_SERVER); } if (chatWindow) chatWindow->setReturnTogglesChat(false); return true; case -1: if (event.tab) - event.tab->chatLog(strprintf(BOOLEAN_OPTIONS, "toggle")); + { + event.tab->chatLog(strprintf(BOOLEAN_OPTIONS, "toggle"), + ChatMsgType::BY_SERVER); + } return true; default: return true; diff --git a/src/actormanager.cpp b/src/actormanager.cpp index 90c2877f4..fb1217e87 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -1364,8 +1364,9 @@ void ActorManager::printBeingsToChat(const ActorSprites &beings, if (!debugChatTab) return; - debugChatTab->chatLog("---------------------------------------"); - debugChatTab->chatLog(header); + debugChatTab->chatLog("---------------------------------------", + ChatMsgType::BY_SERVER); + debugChatTab->chatLog(header, ChatMsgType::BY_SERVER); FOR_EACH (std::set::const_iterator, it, beings) { if (!*it) @@ -1380,7 +1381,8 @@ void ActorManager::printBeingsToChat(const ActorSprites &beings, being->getName().c_str(), being->getTileX(), being->getTileY(), being->getSubType()), ChatMsgType::BY_SERVER); } - debugChatTab->chatLog("---------------------------------------"); + debugChatTab->chatLog("---------------------------------------", + ChatMsgType::BY_SERVER); } void ActorManager::printBeingsToChat(const std::vector &beings, @@ -1389,8 +1391,9 @@ void ActorManager::printBeingsToChat(const std::vector &beings, if (!debugChatTab) return; - debugChatTab->chatLog("---------------------------------------"); - debugChatTab->chatLog(header); + debugChatTab->chatLog("---------------------------------------", + ChatMsgType::BY_SERVER); + debugChatTab->chatLog(header, ChatMsgType::BY_SERVER); FOR_EACH (std::vector::const_iterator, i, beings) { @@ -1403,7 +1406,8 @@ void ActorManager::printBeingsToChat(const std::vector &beings, being->getName().c_str(), being->getTileX(), being->getTileY(), being->getSubType()), ChatMsgType::BY_SERVER); } - debugChatTab->chatLog("---------------------------------------"); + debugChatTab->chatLog("---------------------------------------", + ChatMsgType::BY_SERVER); } void ActorManager::getPlayerNames(StringVect &names, diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp index dd2ff9a54..58f8ec019 100644 --- a/src/gui/widgets/tabs/chat/chattab.cpp +++ b/src/gui/widgets/tabs/chat/chattab.cpp @@ -562,11 +562,13 @@ void ChatTab::showOnline(const std::string &nick, if (online == Online_true) { // TRANSLATORS: chat message - chatLog(strprintf(_("%s is now Online."), nick.c_str())); + chatLog(strprintf(_("%s is now Online."), nick.c_str()), + ChatMsgType::BY_SERVER); } else { // TRANSLATORS: chat message - chatLog(strprintf(_("%s is now Offline."), nick.c_str())); + chatLog(strprintf(_("%s is now Offline."), nick.c_str()), + ChatMsgType::BY_SERVER); } } diff --git a/src/gui/widgets/tabs/chat/chattab.h b/src/gui/widgets/tabs/chat/chattab.h index 6eee19b9d..df3c7913f 100644 --- a/src/gui/widgets/tabs/chat/chattab.h +++ b/src/gui/widgets/tabs/chat/chattab.h @@ -41,7 +41,7 @@ class ScrollArea; #define debugMsg(str) \ if (debugChatTab) \ - debugChatTab->chatLog(str); + debugChatTab->chatLog(str, ChatMsgType::BY_SERVER); #define setTabColors(name) \ setTabColor(&getThemeColor(name), \ @@ -80,7 +80,7 @@ class ChatTab notfinal : public Tab * @param removeColors try remove color if configured */ void chatLog(std::string line, - ChatMsgType::Type own = ChatMsgType::BY_SERVER, + ChatMsgType::Type own, const IgnoreRecord ignoreRecord = IgnoreRecord_false, const TryRemoveColors tryRemoveColors = TryRemoveColors_true); diff --git a/src/gui/widgets/tabs/chat/partytab.cpp b/src/gui/widgets/tabs/chat/partytab.cpp index 093549139..45f420703 100644 --- a/src/gui/widgets/tabs/chat/partytab.cpp +++ b/src/gui/widgets/tabs/chat/partytab.cpp @@ -131,7 +131,8 @@ bool PartyTab::handleCommand(const std::string &restrict type, Net::PartyShare::NO); break; case -1: - chatLog(strprintf(BOOLEAN_OPTIONS, "item")); + chatLog(strprintf(BOOLEAN_OPTIONS, "item"), + ChatMsgType::BY_SERVER); break; default: break; @@ -181,7 +182,8 @@ bool PartyTab::handleCommand(const std::string &restrict type, Net::PartyShare::NO); break; case -1: - chatLog(strprintf(BOOLEAN_OPTIONS, "exp")); + chatLog(strprintf(BOOLEAN_OPTIONS, "exp"), + ChatMsgType::BY_SERVER); break; default: break; diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 178f41c7e..f4641670d 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -963,7 +963,8 @@ void ChatWindow::statChanged(const int id, if (change != 0) { battleChatLog(std::string("+").append(toString( - change)).append(" job")); + change)).append(" job"), + ChatMsgType::BY_SERVER); } } @@ -983,12 +984,14 @@ void ChatWindow::attributeChanged(const int id, if (change != 0) { battleChatLog(std::string("+").append(toString( - change)).append(" xp")); + change)).append(" xp"), + ChatMsgType::BY_SERVER); } break; } case Attributes::LEVEL: - battleChatLog(std::string("Level: ").append(toString(newVal))); + battleChatLog(std::string("Level: ").append(toString(newVal)), + ChatMsgType::BY_SERVER); break; default: break; @@ -1068,7 +1071,7 @@ void ChatWindow::addWhisper(const std::string &restrict nick, } else if (own == ChatMsgType::BY_SERVER) { - tab->chatLog(mes); + tab->chatLog(mes, ChatMsgType::BY_SERVER); } else { @@ -1109,7 +1112,8 @@ void ChatWindow::addWhisper(const std::string &restrict nick, // TRANSLATORS: chat message localChatTab->chatLog(strprintf(_("Whispering to %s: %s"), - nick.c_str(), mes.c_str()), ChatMsgType::BY_PLAYER); + nick.c_str(), mes.c_str()), + ChatMsgType::BY_PLAYER); } else { diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index 83935ed49..4f453e576 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -269,7 +269,8 @@ void SocialWindow::action(const ActionEvent &event) localChatTab->chatLog( // TRANSLATORS: chat message strprintf(_("Accepted party invite from %s."), - mPartyInviter.c_str())); + mPartyInviter.c_str()), + ChatMsgType::BY_SERVER); } partyHandler->inviteResponse(mPartyInviter, mPartyId, true); } @@ -280,7 +281,8 @@ void SocialWindow::action(const ActionEvent &event) localChatTab->chatLog( // TRANSLATORS: chat message strprintf(_("Rejected party invite from %s."), - mPartyInviter.c_str())); + mPartyInviter.c_str()), + ChatMsgType::BY_SERVER); } partyHandler->inviteResponse(mPartyInviter, mPartyId, false); } @@ -297,7 +299,8 @@ void SocialWindow::action(const ActionEvent &event) localChatTab->chatLog( // TRANSLATORS: chat message strprintf(_("Accepted guild invite from %s."), - mPartyInviter.c_str())); + mPartyInviter.c_str()), + ChatMsgType::BY_SERVER); } #ifdef TMWA_SUPPORT if (!guildManager || !GuildManager::getEnableGuildBot()) @@ -315,7 +318,8 @@ void SocialWindow::action(const ActionEvent &event) localChatTab->chatLog( // TRANSLATORS: chat message strprintf(_("Rejected guild invite from %s."), - mPartyInviter.c_str())); + mPartyInviter.c_str()), + ChatMsgType::BY_SERVER); } #ifdef TMWA_SUPPORT if (!guildManager || !GuildManager::getEnableGuildBot()) @@ -359,7 +363,8 @@ void SocialWindow::action(const ActionEvent &event) { // TRANSLATORS: chat message localChatTab->chatLog(strprintf(_("Creating guild called %s."), - name.c_str()), ChatMsgType::BY_SERVER); + name.c_str()), + ChatMsgType::BY_SERVER); } mGuildCreateDialog = nullptr; @@ -380,7 +385,8 @@ void SocialWindow::action(const ActionEvent &event) { // TRANSLATORS: chat message localChatTab->chatLog(strprintf(_("Creating party called %s."), - name.c_str()), ChatMsgType::BY_SERVER); + name.c_str()), + ChatMsgType::BY_SERVER); } mPartyCreateDialog = nullptr; @@ -413,7 +419,8 @@ void SocialWindow::showGuildInvite(const std::string &restrict guildName, { // TRANSLATORS: chat message localChatTab->chatLog(_("Received guild request, but one already " - "exists."), ChatMsgType::BY_SERVER); + "exists."), + ChatMsgType::BY_SERVER); } return; } @@ -445,7 +452,8 @@ void SocialWindow::showPartyInvite(const std::string &restrict partyName, { // TRANSLATORS: chat message localChatTab->chatLog(_("Received party request, but one already " - "exists."), ChatMsgType::BY_SERVER); + "exists."), + ChatMsgType::BY_SERVER); } return; } diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp index d0beb4881..13317699b 100644 --- a/src/net/ea/guildhandler.cpp +++ b/src/net/ea/guildhandler.cpp @@ -455,7 +455,7 @@ void GuildHandler::processGuildMessage(Net::MessageIn &msg) } else { - guildTab->chatLog(chatMsg); + guildTab->chatLog(chatMsg, ChatMsgType::BY_SERVER); } } } diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 98f6b2c18..ab8036c8c 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -591,7 +591,7 @@ void ChatHandler::processWhisperContinue(const std::string &nick, const size_t pos = chatMsg.find(": ", 0); if (pos == std::string::npos) { - gmChatTab->chatLog(chatMsg); + gmChatTab->chatLog(chatMsg, ChatMsgType::BY_SERVER); } else { diff --git a/src/net/tmwa/guildmanager.cpp b/src/net/tmwa/guildmanager.cpp index 8bc3c2a18..7931087a9 100644 --- a/src/net/tmwa/guildmanager.cpp +++ b/src/net/tmwa/guildmanager.cpp @@ -457,7 +457,7 @@ bool GuildManager::process(std::string msg) const std::string sender_name = msg.substr(0, pos); if (!guild->getMember(sender_name)) { - mTab->chatLog(msg); + mTab->chatLog(msg, ChatMsgType::BY_SERVER); return true; } @@ -470,7 +470,7 @@ bool GuildManager::process(std::string msg) } else { - mTab->chatLog(msg); + mTab->chatLog(msg, ChatMsgType::BY_SERVER); } return true; } -- cgit v1.2.3-60-g2f50