diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-10-23 00:25:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-10-23 00:25:26 +0300 |
commit | f1beb8d910253a31b9dd239071effa2d518ceee0 (patch) | |
tree | a350b4c4fb4aa720911aa21d7956200ddb904481 | |
parent | 2fcfbc4b1136265cbd463b9d3b721ce0cad52fe0 (diff) | |
download | mv-f1beb8d910253a31b9dd239071effa2d518ceee0.tar.gz mv-f1beb8d910253a31b9dd239071effa2d518ceee0.tar.bz2 mv-f1beb8d910253a31b9dd239071effa2d518ceee0.tar.xz mv-f1beb8d910253a31b9dd239071effa2d518ceee0.zip |
Add chat commands for using server side ignore for all whispers.
Commands: /serverignoreall and /serverunignoreall
-rw-r--r-- | src/commandhandler.cpp | 17 | ||||
-rw-r--r-- | src/commandhandler.h | 6 | ||||
-rw-r--r-- | src/gui/chatwindow.cpp | 2 | ||||
-rw-r--r-- | src/net/chathandler.h | 4 | ||||
-rw-r--r-- | src/net/ea/chathandler.cpp | 45 | ||||
-rw-r--r-- | src/net/ea/chathandler.h | 2 | ||||
-rw-r--r-- | src/net/manaserv/chathandler.h | 4 | ||||
-rw-r--r-- | src/net/tmwa/chathandler.cpp | 17 | ||||
-rw-r--r-- | src/net/tmwa/chathandler.h | 4 | ||||
-rw-r--r-- | src/net/tmwa/protocol.h | 2 |
10 files changed, 102 insertions, 1 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index f1b7518c5..7a4773d81 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -190,6 +190,10 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab) handleAddIgnoreAttack(args, tab); else if (type == "dump") handleDump(args, tab); + else if (type == "serverignoreall") + handleServerIgnoreAll(args, tab); + else if (type == "serverunignoreall") + handleServerUnIgnoreAll(args, tab); else if (tab->handleCommand(type, args)) ; else if (type == "hack") @@ -1020,6 +1024,18 @@ void CommandHandler::handleCacheInfo(const std::string &args A_UNUSED, #endif } +void CommandHandler::handleServerIgnoreAll(const std::string &args, + ChatTab *tab A_UNUSED) +{ + Net::getChatHandler()->ignoreAll(); +} + +void CommandHandler::handleServerUnIgnoreAll(const std::string &args, + ChatTab *tab A_UNUSED) +{ + Net::getChatHandler()->unIgnoreAll(); +} + #ifdef DEBUG_DUMP_LEAKS void showRes(std::string str, ResourceManager::Resources *res); @@ -1076,6 +1092,7 @@ void CommandHandler::handleDump(const std::string &args, + toString(res->size())); } } + #elif defined ENABLE_MEM_DEBUG void CommandHandler::handleDump(const std::string &args A_UNUSED, ChatTab *tab A_UNUSED) diff --git a/src/commandhandler.h b/src/commandhandler.h index 52080dfcd..a082f950e 100644 --- a/src/commandhandler.h +++ b/src/commandhandler.h @@ -290,6 +290,12 @@ class CommandHandler void handleAddIgnoreAttack(const std::string &args, ChatTab *tab A_UNUSED); + void handleServerIgnoreAll(const std::string &args, + ChatTab *tab A_UNUSED); + + void handleServerUnIgnoreAll(const std::string &args, + ChatTab *tab A_UNUSED); + void handleDump(const std::string &args, ChatTab *tab); void handleCacheInfo(const std::string &args, ChatTab *tab A_UNUSED); diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 59bd173bd..d8bc7f3c4 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -294,6 +294,8 @@ void ChatWindow::fillCommands() mCommands.push_back("/removeattack "); mCommands.push_back("/addignoreattack "); mCommands.push_back("/blacklist "); + mCommands.push_back("/serverignoreall"); + mCommands.push_back("/serverunignoreall"); } void ChatWindow::resetToDefaultSize() diff --git a/src/net/chathandler.h b/src/net/chathandler.h index a0e232027..fc6c10376 100644 --- a/src/net/chathandler.h +++ b/src/net/chathandler.h @@ -64,6 +64,10 @@ class ChatHandler virtual void who() = 0; virtual void sendRaw(const std::string &args) = 0; + + virtual void ignoreAll() = 0; + + virtual void unIgnoreAll() = 0; }; } diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index 60af645be..35e8597f0 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -353,4 +353,49 @@ void ChatHandler::processMVP(Net::MessageIn &msg) } } +void ChatHandler::processIgnoreAllResponse(Net::MessageIn &msg) +{ + int action = msg.readInt8(); + int fail = msg.readInt8(); + if (!localChatTab) + return; + + switch (action) + { + case 0: + { + switch (fail) + { + case 0: + localChatTab->chatLog(_("All whispers ignored."), + BY_SERVER); + break; + default: + localChatTab->chatLog(_("All whispers ignore failed."), + BY_SERVER); + break; + } + break; + } + case 1: + { + switch (fail) + { + case 0: + localChatTab->chatLog(_("All whispers unignored."), + BY_SERVER); + break; + default: + localChatTab->chatLog(_("All whispers unignore failed."), + BY_SERVER); + break; + } + break; + } + default: + // unknown result + break; + } +} + } // namespace Ea diff --git a/src/net/ea/chathandler.h b/src/net/ea/chathandler.h index d000b673d..cff9bf589 100644 --- a/src/net/ea/chathandler.h +++ b/src/net/ea/chathandler.h @@ -84,6 +84,8 @@ class ChatHandler : public Net::ChatHandler virtual void processMVP(Net::MessageIn &msg); + virtual void processIgnoreAllResponse(Net::MessageIn &msg); + protected: typedef std::queue<std::string> WhisperQueue; WhisperQueue mSentWhispers; diff --git a/src/net/manaserv/chathandler.h b/src/net/manaserv/chathandler.h index 5eb2a0ff4..beea40423 100644 --- a/src/net/manaserv/chathandler.h +++ b/src/net/manaserv/chathandler.h @@ -133,6 +133,10 @@ class ChatHandler : public MessageHandler, public Net::ChatHandler * Handle who responses. */ void handleWhoResponse(Net::MessageIn &msg); + + void ignoreAll() + + void unIgnoreAll() }; } // namespace ManaServ diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 4e4318595..fe6592d93 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -60,6 +60,7 @@ ChatHandler::ChatHandler() SMSG_WHISPER_RESPONSE, SMSG_GM_CHAT, SMSG_MVP, // MVP + SMSG_IGNORE_ALL_RESPONSE, 0 }; handledMessages = _messages; @@ -96,6 +97,9 @@ void ChatHandler::handleMessage(Net::MessageIn &msg) processMVP(msg); break; + case SMSG_IGNORE_ALL_RESPONSE: + processIgnoreAllResponse(msg); + default: break; } @@ -249,5 +253,16 @@ void ChatHandler::processRaw(MessageOut &outMsg, std::string &line) } } -} // namespace TmwAthena +void ChatHandler::ignoreAll() +{ + MessageOut outMsg(CMSG_IGNORE_ALL); + outMsg.writeInt8(0); +} +void ChatHandler::unIgnoreAll() +{ + MessageOut outMsg(CMSG_IGNORE_ALL); + outMsg.writeInt8(1); +} + +} // namespace TmwAthena diff --git a/src/net/tmwa/chathandler.h b/src/net/tmwa/chathandler.h index d9e927e03..197ba12b3 100644 --- a/src/net/tmwa/chathandler.h +++ b/src/net/tmwa/chathandler.h @@ -57,6 +57,10 @@ class ChatHandler : public MessageHandler, public Ea::ChatHandler void sendRaw(const std::string &args); + void ignoreAll(); + + void unIgnoreAll(); + void processRaw(MessageOut &outMsg, std::string &line); }; diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h index 3a753e351..caf3c8e53 100644 --- a/src/net/tmwa/protocol.h +++ b/src/net/tmwa/protocol.h @@ -331,5 +331,7 @@ enum #define SMSG_BEING_IP_RESPONSE 0x020c #define SMSG_PVP_MAP_MODE 0x0199 #define SMSG_PVP_SET 0x019a +#define CMSG_IGNORE_ALL 0x00d0 +#define SMSG_IGNORE_ALL_RESPONSE 0x00d2 #endif |