summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-25 13:09:04 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-25 13:09:04 +0300
commit90a652e5c672b9a11b165ee939889f406b852ee1 (patch)
tree4841dff5271783feb53cd2d5164aea4c2ebf69b7 /src/net
parenta306ecf96736779b08d1de7ec994d3d741d5dc61 (diff)
downloadplus-90a652e5c672b9a11b165ee939889f406b852ee1.tar.gz
plus-90a652e5c672b9a11b165ee939889f406b852ee1.tar.bz2
plus-90a652e5c672b9a11b165ee939889f406b852ee1.tar.xz
plus-90a652e5c672b9a11b165ee939889f406b852ee1.zip
improve adminhandler class.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/adminhandler.h15
-rw-r--r--src/net/ea/adminhandler.cpp12
-rw-r--r--src/net/ea/adminhandler.h10
-rw-r--r--src/net/eathena/adminhandler.cpp8
-rw-r--r--src/net/eathena/adminhandler.h4
-rw-r--r--src/net/tmwa/adminhandler.cpp8
-rw-r--r--src/net/tmwa/adminhandler.h4
7 files changed, 30 insertions, 31 deletions
diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h
index ed8a0bf7e..6b6aac078 100644
--- a/src/net/adminhandler.h
+++ b/src/net/adminhandler.h
@@ -39,24 +39,25 @@ class AdminHandler
virtual void localAnnounce(const std::string &text) = 0;
- virtual void hide(bool hide) = 0;
+ virtual void hide(const bool hide) = 0;
- virtual void kick(int playerId) = 0;
+ virtual void kick(const int playerId) = 0;
virtual void kickName(const std::string &name) = 0;
- virtual void ban(int playerId) = 0;
+ virtual void ban(const int playerId) = 0;
virtual void banName(const std::string &name) = 0;
- virtual void unban(int playerId) = 0;
+ virtual void unban(const int playerId) = 0;
virtual void unbanName(const std::string &name) = 0;
- virtual void mute(int playerId, int type, int limit) = 0;
+ virtual void mute(const int playerId, const int type,
+ const int limit) = 0;
- virtual void warp(std::string map, int x, int y) = 0;
- // TODO
+ virtual void warp(const std::string &map,
+ const int x, const int y) = 0;
};
} // namespace Net
diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp
index 56b6dfe90..7a07cb4a2 100644
--- a/src/net/ea/adminhandler.cpp
+++ b/src/net/ea/adminhandler.cpp
@@ -38,7 +38,7 @@ void AdminHandler::kickName(const std::string &name)
Net::getChatHandler()->talk("@kick " + name, GENERAL_CHANNEL);
}
-void AdminHandler::ban(int playerId A_UNUSED)
+void AdminHandler::ban(const int playerId A_UNUSED)
{
// Not supported
}
@@ -48,7 +48,7 @@ void AdminHandler::banName(const std::string &name)
Net::getChatHandler()->talk("@ban " + name, GENERAL_CHANNEL);
}
-void AdminHandler::unban(int playerId A_UNUSED)
+void AdminHandler::unban(const int playerId A_UNUSED)
{
// Not supported
}
@@ -58,13 +58,13 @@ void AdminHandler::unbanName(const std::string &name)
Net::getChatHandler()->talk("@unban " + name, GENERAL_CHANNEL);
}
-void AdminHandler::mute(int playerId A_UNUSED, int type A_UNUSED,
- int limit A_UNUSED)
+void AdminHandler::mute(const int playerId A_UNUSED, const int type A_UNUSED,
+ const int limit A_UNUSED)
{
- return; // Still looking into this
+ return;
}
-void AdminHandler::warp(std::string map, int x, int y)
+void AdminHandler::warp(const std::string &map, const int x, const int y)
{
Net::getChatHandler()->talk(strprintf(
"@warp %s %d %d", map.c_str(), x, y), GENERAL_CHANNEL);
diff --git a/src/net/ea/adminhandler.h b/src/net/ea/adminhandler.h
index 45b0af0f1..68b7c303e 100644
--- a/src/net/ea/adminhandler.h
+++ b/src/net/ea/adminhandler.h
@@ -42,17 +42,19 @@ class AdminHandler : public Net::AdminHandler
virtual void kickName(const std::string &name);
- virtual void ban(int playerId);
+ virtual void ban(const int playerId);
virtual void banName(const std::string &name);
- virtual void unban(int playerId);
+ virtual void unban(const int playerId);
virtual void unbanName(const std::string &name);
- virtual void mute(int playerId, int type, int limit);
+ virtual void mute(const int playerId, const int type,
+ const int limit);
- virtual void warp(std::string map, int x, int y);
+ virtual void warp(const std::string &map,
+ const int x, const int y);
};
} // namespace Ea
diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp
index 23909bef1..0b2d91063 100644
--- a/src/net/eathena/adminhandler.cpp
+++ b/src/net/eathena/adminhandler.cpp
@@ -55,12 +55,10 @@ AdminHandler::AdminHandler() :
void AdminHandler::handleMessage(Net::MessageIn &msg)
{
- int id;
switch (msg.getId())
{
case SMSG_ADMIN_KICK_ACK:
- id = msg.readInt32();
- if (id == 0)
+ if (msg.readInt32() == 0)
NotifyManager::notify(NotifyManager::KICK_FAIL);
else
NotifyManager::notify(NotifyManager::KICK_SUCCEED);
@@ -83,13 +81,13 @@ void AdminHandler::localAnnounce(const std::string &text)
outMsg.writeString(text, static_cast<int>(text.length()));
}
-void AdminHandler::hide(bool h A_UNUSED)
+void AdminHandler::hide(const bool h A_UNUSED)
{
MessageOut outMsg(CMSG_ADMIN_HIDE);
outMsg.writeInt32(0); //unused
}
-void AdminHandler::kick(int playerId)
+void AdminHandler::kick(const int playerId)
{
MessageOut outMsg(CMSG_ADMIN_KICK);
outMsg.writeInt32(playerId);
diff --git a/src/net/eathena/adminhandler.h b/src/net/eathena/adminhandler.h
index bcd193fb1..e6ba376f3 100644
--- a/src/net/eathena/adminhandler.h
+++ b/src/net/eathena/adminhandler.h
@@ -46,9 +46,9 @@ class AdminHandler final : public MessageHandler, public Ea::AdminHandler
void localAnnounce(const std::string &text);
- void hide(bool h);
+ void hide(const bool h);
- void kick(int playerId);
+ void kick(const int playerId);
};
} // namespace EAthena
diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp
index dcb29e247..f5a8b7d05 100644
--- a/src/net/tmwa/adminhandler.cpp
+++ b/src/net/tmwa/adminhandler.cpp
@@ -55,12 +55,10 @@ AdminHandler::AdminHandler() :
void AdminHandler::handleMessage(Net::MessageIn &msg)
{
BLOCK_START("AdminHandler::handleMessage")
- int id;
switch (msg.getId())
{
case SMSG_ADMIN_KICK_ACK:
- id = msg.readInt32();
- if (id == 0)
+ if (msg.readInt32() == 0)
NotifyManager::notify(NotifyManager::KICK_FAIL);
else
NotifyManager::notify(NotifyManager::KICK_SUCCEED);
@@ -84,13 +82,13 @@ void AdminHandler::localAnnounce(const std::string &text)
outMsg.writeString(text, static_cast<int>(text.length()));
}
-void AdminHandler::hide(bool h A_UNUSED)
+void AdminHandler::hide(const bool h A_UNUSED)
{
MessageOut outMsg(CMSG_ADMIN_HIDE);
outMsg.writeInt32(0); //unused
}
-void AdminHandler::kick(int playerId)
+void AdminHandler::kick(const int playerId)
{
MessageOut outMsg(CMSG_ADMIN_KICK);
outMsg.writeInt32(playerId);
diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h
index 8df5cd5ca..f322cf4bf 100644
--- a/src/net/tmwa/adminhandler.h
+++ b/src/net/tmwa/adminhandler.h
@@ -46,9 +46,9 @@ class AdminHandler final : public MessageHandler, public Ea::AdminHandler
void localAnnounce(const std::string &text);
- void hide(bool h);
+ void hide(const bool h);
- void kick(int playerId);
+ void kick(const int playerId);
};
} // namespace TmwAthena