summaryrefslogtreecommitdiff
path: root/src/commands.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-27 02:14:39 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-27 02:14:39 +0300
commita714a339ac461943236eb1992c38dfb16821d0a1 (patch)
treed82615ef2330e1f052af4b21a2d448f751cad579 /src/commands.cpp
parent1b496351f779d4a897cd882a9928a18bab5ba622 (diff)
downloadmanaplus-a714a339ac461943236eb1992c38dfb16821d0a1.tar.gz
manaplus-a714a339ac461943236eb1992c38dfb16821d0a1.tar.bz2
manaplus-a714a339ac461943236eb1992c38dfb16821d0a1.tar.xz
manaplus-a714a339ac461943236eb1992c38dfb16821d0a1.zip
Move chat command /dumpe into actions.
Also move some functions into chatutils.
Diffstat (limited to 'src/commands.cpp')
-rw-r--r--src/commands.cpp67
1 files changed, 1 insertions, 66 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index bb2bbe813..969b73c68 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -83,6 +83,7 @@
#include "resources/db/itemdb.h"
+#include "utils/chatutils.h"
#include "utils/delete2.h"
#include "utils/gettext.h"
#include "utils/process.h"
@@ -99,78 +100,12 @@ extern char **environ;
namespace Commands
{
-static void outStringNormal(ChatTab *const tab,
- const std::string &str,
- const std::string &def)
-{
- if (!localPlayer)
- return;
-
- if (!tab)
- {
- Net::getChatHandler()->talk(str, GENERAL_CHANNEL);
- return;
- }
-
- switch (tab->getType())
- {
- case ChatTabType::PARTY:
- {
- Net::getPartyHandler()->chat(str);
- break;
- }
- case ChatTabType::GUILD:
- {
- const Guild *const guild = localPlayer->getGuild();
- if (guild)
- {
- if (guild->getServerGuild())
- {
- if (tmwServerVersion > 0)
- return;
- Net::getGuildHandler()->chat(guild->getId(), str);
- }
- else if (guildManager)
- {
- guildManager->chat(str);
- }
- }
- break;
- }
- case ChatTabType::WHISPER:
- {
- const WhisperTab *const whisper
- = static_cast<const WhisperTab *const>(tab);
- tab->chatLog(localPlayer->getName(), str);
- Net::getChatHandler()->privateMessage(whisper->getNick(), str);
- break;
- }
- default:
- Net::getChatHandler()->talk(def, GENERAL_CHANNEL);
- break;
- }
-}
-
impHandler(hack)
{
Net::getChatHandler()->sendRaw(event.args);
return true;
}
-impHandler0(dumpEnvironment)
-{
- logger->log1("Start environment variables");
- for (char **env = environ; *env; ++ env)
- logger->log1(*env);
- logger->log1("End environment variables");
- if (debugChatTab)
- {
- // TRANSLATORS: dump environment command
- debugChatTab->chatLog(_("Environment variables dumped"));
- }
- return true;
-}
-
impHandler(dumpTests)
{
const std::string str = config.getStringValue("testInfo");