From 9ca0103f281a176af021197496fd2bd6f65ba05b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 7 Sep 2014 20:49:37 +0300 Subject: Move processPartyMessage from ea namespace into eathena and tmwa. --- src/net/tmwa/partyhandler.cpp | 24 ++++++++++++++++++++++++ src/net/tmwa/partyhandler.h | 2 ++ 2 files changed, 26 insertions(+) (limited to 'src/net/tmwa') diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp index c5564c94b..813726b6d 100644 --- a/src/net/tmwa/partyhandler.cpp +++ b/src/net/tmwa/partyhandler.cpp @@ -332,4 +332,28 @@ void PartyHandler::processPartyInfo(Net::MessageIn &msg) const } } +void PartyHandler::processPartyMessage(Net::MessageIn &msg) const +{ + const int msgLength = msg.readInt16() - 8; + if (msgLength <= 0) + return; + + const int id = msg.readInt32(); + const std::string chatMsg = msg.readString(msgLength); + + if (Ea::taParty && Ea::partyTab) + { + const PartyMember *const member = Ea::taParty->getMember(id); + if (member) + { + Ea::partyTab->chatLog(member->getName(), chatMsg); + } + else + { + NotifyManager::notify(NotifyTypes::PARTY_UNKNOWN_USER_MSG, + chatMsg); + } + } +} + } // namespace TmwAthena diff --git a/src/net/tmwa/partyhandler.h b/src/net/tmwa/partyhandler.h index f731fa32a..9ee694775 100644 --- a/src/net/tmwa/partyhandler.h +++ b/src/net/tmwa/partyhandler.h @@ -67,6 +67,8 @@ class PartyHandler final : public MessageHandler, public Ea::PartyHandler void processPartySettings(Net::MessageIn &msg); void processPartyInfo(Net::MessageIn &msg) const; + + void processPartyMessage(Net::MessageIn &msg) const; }; } // namespace TmwAthena -- cgit v1.2.3-70-g09d2