summaryrefslogtreecommitdiff
path: root/src/commandhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-01-07 20:03:24 +0300
committerAndrei Karas <akaras@inbox.ru>2012-01-07 20:25:47 +0300
commit7048f43f0683b62985e265df09657efd60025e58 (patch)
tree4c98ff3873ad185720a702f550e799f22dda9333 /src/commandhandler.cpp
parent78ef5eee69ace485763ce44267d8d475abf4adc2 (diff)
downloadplus-7048f43f0683b62985e265df09657efd60025e58.tar.gz
plus-7048f43f0683b62985e265df09657efd60025e58.tar.bz2
plus-7048f43f0683b62985e265df09657efd60025e58.tar.xz
plus-7048f43f0683b62985e265df09657efd60025e58.zip
Fix tab for debug messages.
Diffstat (limited to 'src/commandhandler.cpp')
-rw-r--r--src/commandhandler.cpp50
1 files changed, 48 insertions, 2 deletions
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<WhisperTab*>(tab);
+ tab->chatLog(player_node->getName(), str);
+ Net::getChatHandler()->privateMessage(whisper->getNick(), str);
+ break;
+ }
+ default:
+ Net::getChatHandler()->talk(def);
+ break;
+ }
}
#ifdef DEBUG_DUMP_LEAKS