From 47d811c90a4655b69f1846c16150efebbfa4ccfa Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 16 Feb 2015 12:27:52 +0300 Subject: Move processWhisperContinue from ea namespace into eathena and tmwa. --- src/net/eathena/chathandler.cpp | 28 ++++++++++++++++++++++++++++ src/net/eathena/chathandler.h | 3 +++ 2 files changed, 31 insertions(+) (limited to 'src/net/eathena') diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index 3def53afd..5aa12c53a 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -25,11 +25,14 @@ #include "actormanager.h" #include "being/localplayer.h" +#include "being/playerrelations.h" #include "gui/chatconsts.h" #include "gui/windows/chatwindow.h" +#include "gui/widgets/tabs/chat/chattab.h" + #include "net/mercenaryhandler.h" #include "net/serverfeatures.h" @@ -655,4 +658,29 @@ void ChatHandler::partChannel(const std::string &channel) } } +void ChatHandler::processWhisperContinue(const std::string &nick, + std::string chatMsg) +{ + // ignoring future whisper messages + if (chatMsg.find("\302\202G") == 0 || chatMsg.find("\302\202A") == 0) + { + BLOCK_END("ChatHandler::processWhisper") + return; + } + // remove first unicode space if this is may be whisper command. + if (chatMsg.find("\302\202!") == 0) + chatMsg = chatMsg.substr(2); + + if (nick != "Server") + { + if (player_relations.hasPermission(nick, PlayerRelation::WHISPER)) + chatWindow->addWhisper(nick, chatMsg); + } + else if (localChatTab) + { + localChatTab->chatLog(chatMsg, ChatMsgType::BY_SERVER); + } + BLOCK_END("ChatHandler::processWhisper") +} + } // namespace EAthena diff --git a/src/net/eathena/chathandler.h b/src/net/eathena/chathandler.h index e4a588fef..3b38c5a25 100644 --- a/src/net/eathena/chathandler.h +++ b/src/net/eathena/chathandler.h @@ -117,6 +117,9 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler static void processChatLeave(Net::MessageIn &msg); static void processJoinChannel(Net::MessageIn &msg); + + static void processWhisperContinue(const std::string &nick, + std::string chatMsg); }; } // namespace EAthena -- cgit v1.2.3-70-g09d2