From 7048f43f0683b62985e265df09657efd60025e58 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 7 Jan 2012 20:03:24 +0300 Subject: Fix tab for debug messages. --- src/commandhandler.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) (limited to 'src/commandhandler.cpp') diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 6f2c2867d..0f8df546c 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -1124,14 +1124,60 @@ void CommandHandler::handleDumpGraphics(const std::string &args A_UNUSED, str += config.getBoolValue("particleeffects") ? "1" : "0"; str += strprintf(",%d-%d", fps, config.getIntValue("fpslimit")); - outString(tab, str, str); + outStringNormal(tab, str, str); } void CommandHandler::handleDumpTests(const std::string &args A_UNUSED, ChatTab *tab) { std::string str = config.getStringValue("testInfo"); - outString(tab, str, str); + outStringNormal(tab, str, str); +} + +void CommandHandler::outStringNormal(ChatTab *tab, const std::string &str, + const std::string &def) +{ + if (!player_node) + return; + + if (!tab) + { + Net::getChatHandler()->talk(str); + return; + } + + switch (tab->getType()) + { + case ChatTab::TAB_PARTY: + { + Net::getPartyHandler()->chat(str); + break; + } + case ChatTab::TAB_GUILD: + { + if (!player_node) + return; + const Guild *guild = player_node->getGuild(); + if (guild) + { + if (guild->getServerGuild()) + Net::getGuildHandler()->chat(guild->getId(), str); + else if (guildManager) + guildManager->chat(str); + } + break; + } + case ChatTab::TAB_WHISPER: + { + WhisperTab *whisper = static_cast(tab); + tab->chatLog(player_node->getName(), str); + Net::getChatHandler()->privateMessage(whisper->getNick(), str); + break; + } + default: + Net::getChatHandler()->talk(def); + break; + } } #ifdef DEBUG_DUMP_LEAKS -- cgit v1.2.3-70-g09d2