From a29fd5e8a4bca6b6a11c44bff33c79a5f7b44bd3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 23 Oct 2014 15:34:11 +0300 Subject: In adminhandler add function processKickAck. --- src/net/ea/adminhandler.cpp | 13 +++++++++++++ src/net/ea/adminhandler.h | 8 ++++++++ src/net/eathena/adminhandler.cpp | 5 +---- src/net/tmwa/adminhandler.cpp | 5 +---- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp index 6eb413e7c..4dd8083f3 100644 --- a/src/net/ea/adminhandler.cpp +++ b/src/net/ea/adminhandler.cpp @@ -22,13 +22,18 @@ #include "net/ea/adminhandler.h" +#include "notifymanager.h" + #include "gui/chatconsts.h" #include "net/chathandler.h" +#include "net/messagein.h" #include "net/serverfeatures.h" #include "utils/stringutils.h" +#include "resources/notifytypes.h" + #include #include "debug.h" @@ -86,4 +91,12 @@ void AdminHandler::createItems(const int id, const int color, } } +void AdminHandler::processKickAck(Net::MessageIn &msg) +{ + if (msg.readInt32() == 0) + NotifyManager::notify(NotifyTypes::KICK_FAIL); + else + NotifyManager::notify(NotifyTypes::KICK_SUCCEED); +} + } // namespace Ea diff --git a/src/net/ea/adminhandler.h b/src/net/ea/adminhandler.h index 0228f9bd0..c92b7291c 100644 --- a/src/net/ea/adminhandler.h +++ b/src/net/ea/adminhandler.h @@ -27,6 +27,11 @@ #include "localconsts.h" +namespace Net +{ + class MessageIn; +} + namespace Ea { @@ -57,6 +62,9 @@ class AdminHandler notfinal : public Net::AdminHandler void createItems(const int id, const int color, const int amount) const override final; + + protected: + static void processKickAck(Net::MessageIn &msg); }; } // namespace Ea diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index 3c987cc77..124e09734 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -61,10 +61,7 @@ void AdminHandler::handleMessage(Net::MessageIn &msg) switch (msg.getId()) { case SMSG_ADMIN_KICK_ACK: - if (msg.readInt32() == 0) - NotifyManager::notify(NotifyTypes::KICK_FAIL); - else - NotifyManager::notify(NotifyTypes::KICK_SUCCEED); + processKickAck(msg); break; case SMSG_ADMIN_GET_LOGIN_ACK: processAdminGetLoginAck(msg); diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index a7b3ceb5c..ce81c596c 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -63,10 +63,7 @@ void AdminHandler::handleMessage(Net::MessageIn &msg) switch (msg.getId()) { case SMSG_ADMIN_KICK_ACK: - if (msg.readInt32() == 0) - NotifyManager::notify(NotifyTypes::KICK_FAIL); - else - NotifyManager::notify(NotifyTypes::KICK_SUCCEED); + processKickAck(msg); break; default: -- cgit v1.2.3-70-g09d2