diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-08-26 15:02:51 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-08-26 15:02:51 +0300 |
commit | 6fd6deb1ba87ddf74bff15055421f2b434b96f85 (patch) | |
tree | cbcfc33f0bfac42d3ce8d9721d8a250e17675966 | |
parent | 9eea292d5035c8a592ba8b69b1a1c3f78cd08406 (diff) | |
download | plus-6fd6deb1ba87ddf74bff15055421f2b434b96f85.tar.gz plus-6fd6deb1ba87ddf74bff15055421f2b434b96f85.tar.bz2 plus-6fd6deb1ba87ddf74bff15055421f2b434b96f85.tar.xz plus-6fd6deb1ba87ddf74bff15055421f2b434b96f85.zip |
Move receive code from friendshandler into separate file.
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/net/eathena/friendshandler.cpp | 55 | ||||
-rw-r--r-- | src/net/eathena/friendshandler.h | 11 | ||||
-rw-r--r-- | src/net/eathena/friendsrecv.cpp | 77 | ||||
-rw-r--r-- | src/net/eathena/friendsrecv.h | 43 |
6 files changed, 130 insertions, 60 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1933083e0..ed491f599 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1581,6 +1581,8 @@ SET(SRCS_EATHENA net/eathena/familyrecv.h net/eathena/friendshandler.cpp net/eathena/friendshandler.h + net/eathena/friendsrecv.cpp + net/eathena/friendsrecv.h net/eathena/gamehandler.cpp net/eathena/gamehandler.h net/eathena/generalhandler.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 2d4883359..81a25b7e5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1427,6 +1427,8 @@ manaplus_SOURCES += gui/windows/bankwindow.cpp \ net/eathena/familyrecv.h \ net/eathena/friendshandler.cpp \ net/eathena/friendshandler.h \ + net/eathena/friendsrecv.cpp \ + net/eathena/friendsrecv.h \ net/eathena/gamehandler.cpp \ net/eathena/gamehandler.h \ net/eathena/generalhandler.cpp \ diff --git a/src/net/eathena/friendshandler.cpp b/src/net/eathena/friendshandler.cpp index 43634d9fc..a2e01bc79 100644 --- a/src/net/eathena/friendshandler.cpp +++ b/src/net/eathena/friendshandler.cpp @@ -22,6 +22,7 @@ #include "logger.h" +#include "net/eathena/friendsrecv.h" #include "net/eathena/messageout.h" #include "net/eathena/protocol.h" @@ -53,23 +54,23 @@ void FriendsHandler::handleMessage(Net::MessageIn &msg) switch (msg.getId()) { case SMSG_FRIENDS_PLAYER_ONLINE: - processPlayerOnline(msg); + FriendsRecv::processPlayerOnline(msg); break; case SMSG_FRIENDS_LIST: - processFriendsList(msg); + FriendsRecv::processFriendsList(msg); break; case SMSG_FRIENDS_REQUEST_ACK: - processRequestAck(msg); + FriendsRecv::processRequestAck(msg); break; case SMSG_FRIENDS_REQUEST: - processRequest(msg); + FriendsRecv::processRequest(msg); break; case SMSG_FRIENDS_DELETE_PLAYER: - processDeletePlayer(msg); + FriendsRecv::processDeletePlayer(msg); break; default: @@ -77,43 +78,6 @@ void FriendsHandler::handleMessage(Net::MessageIn &msg) } } -void FriendsHandler::processPlayerOnline(Net::MessageIn &msg) -{ - UNIMPLIMENTEDPACKET; - msg.readBeingId("account id"); - msg.readInt32("char id"); - msg.readUInt8("flag"); // 0 - online, 1 - offline -} - -void FriendsHandler::processFriendsList(Net::MessageIn &msg) -{ - UNIMPLIMENTEDPACKET; - const int count = (msg.readInt16("size") - 4) / 32; - for (int f = 0; f < count; f ++) - { - msg.readBeingId("account id"); - msg.readInt32("char id"); - msg.readString(24, "name"); - } -} - -void FriendsHandler::processRequestAck(Net::MessageIn &msg) -{ - UNIMPLIMENTEDPACKET; - msg.readInt16("type"); - msg.readBeingId("account id"); - msg.readInt32("char id"); - msg.readString(24, "name"); -} - -void FriendsHandler::processRequest(Net::MessageIn &msg) -{ - UNIMPLIMENTEDPACKET; - msg.readBeingId("account id"); - msg.readInt32("char id"); - msg.readString(24, "name"); -} - void FriendsHandler::invite(const std::string &name) const { createOutPacket(CMSG_FRIENDS_ADD_PLAYER); @@ -137,11 +101,4 @@ void FriendsHandler::remove(const int accountId, const int charId) const outMsg.writeInt32(charId, "char id"); } -void FriendsHandler::processDeletePlayer(Net::MessageIn &msg) -{ - UNIMPLIMENTEDPACKET; - msg.readBeingId("account id"); - msg.readInt32("char id"); -} - } // namespace EAthena diff --git a/src/net/eathena/friendshandler.h b/src/net/eathena/friendshandler.h index 27d64f39d..9f63487e9 100644 --- a/src/net/eathena/friendshandler.h +++ b/src/net/eathena/friendshandler.h @@ -47,17 +47,6 @@ class FriendsHandler final : public MessageHandler, void remove(const int accountId, const int charId) const override final; - - protected: - static void processPlayerOnline(Net::MessageIn &msg); - - static void processFriendsList(Net::MessageIn &msg); - - static void processRequestAck(Net::MessageIn &msg); - - static void processRequest(Net::MessageIn &msg); - - static void processDeletePlayer(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/net/eathena/friendsrecv.cpp b/src/net/eathena/friendsrecv.cpp new file mode 100644 index 000000000..41994dd15 --- /dev/null +++ b/src/net/eathena/friendsrecv.cpp @@ -0,0 +1,77 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011-2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "net/eathena/friendsrecv.h" + +#include "logger.h" + +#include "net/eathena/messageout.h" +#include "net/eathena/protocol.h" + +#include "debug.h" + +namespace EAthena +{ + +void FriendsRecv::processPlayerOnline(Net::MessageIn &msg) +{ + UNIMPLIMENTEDPACKET; + msg.readBeingId("account id"); + msg.readInt32("char id"); + msg.readUInt8("flag"); // 0 - online, 1 - offline +} + +void FriendsRecv::processFriendsList(Net::MessageIn &msg) +{ + UNIMPLIMENTEDPACKET; + const int count = (msg.readInt16("size") - 4) / 32; + for (int f = 0; f < count; f ++) + { + msg.readBeingId("account id"); + msg.readInt32("char id"); + msg.readString(24, "name"); + } +} + +void FriendsRecv::processRequestAck(Net::MessageIn &msg) +{ + UNIMPLIMENTEDPACKET; + msg.readInt16("type"); + msg.readBeingId("account id"); + msg.readInt32("char id"); + msg.readString(24, "name"); +} + +void FriendsRecv::processRequest(Net::MessageIn &msg) +{ + UNIMPLIMENTEDPACKET; + msg.readBeingId("account id"); + msg.readInt32("char id"); + msg.readString(24, "name"); +} + +void FriendsRecv::processDeletePlayer(Net::MessageIn &msg) +{ + UNIMPLIMENTEDPACKET; + msg.readBeingId("account id"); + msg.readInt32("char id"); +} + +} // namespace EAthena diff --git a/src/net/eathena/friendsrecv.h b/src/net/eathena/friendsrecv.h new file mode 100644 index 000000000..d502343da --- /dev/null +++ b/src/net/eathena/friendsrecv.h @@ -0,0 +1,43 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011-2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef NET_EATHENA_FRIENDSRECV_H +#define NET_EATHENA_FRIENDSRECV_H + +#ifdef EATHENA_SUPPORT + +#include "net/friendshandler.h" + +#include "net/eathena/messagehandler.h" + +namespace EAthena +{ + namespace FriendsRecv + { + void processPlayerOnline(Net::MessageIn &msg); + void processFriendsList(Net::MessageIn &msg); + void processRequestAck(Net::MessageIn &msg); + void processRequest(Net::MessageIn &msg); + void processDeletePlayer(Net::MessageIn &msg); + } // namespace FriendsRecv +} // namespace EAthena + +#endif // EATHENA_SUPPORT +#endif // NET_EATHENA_FRIENDSRECV_H |