From 42407f169ac67d375cba959bc553ffc186436cba Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 15 Sep 2014 12:55:46 +0300 Subject: eathena: add packet CMSG_MAIL_SEND 0x0248. --- src/net/eathena/mailhandler.cpp | 16 ++++++++++++++++ src/net/eathena/mailhandler.h | 4 ++++ src/net/eathena/protocol.h | 1 + src/net/mailhandler.h | 6 ++++++ src/net/tmwa/mailhandler.cpp | 6 ++++++ src/net/tmwa/mailhandler.h | 4 ++++ 6 files changed, 37 insertions(+) diff --git a/src/net/eathena/mailhandler.cpp b/src/net/eathena/mailhandler.cpp index 23e959538..af7a07e7b 100644 --- a/src/net/eathena/mailhandler.cpp +++ b/src/net/eathena/mailhandler.cpp @@ -119,4 +119,20 @@ void MailHandler::resetAttach(const int flag) outMsg.writeInt16(static_cast(flag), "flag"); } +void MailHandler::send(const std::string &name, + const std::string &title, + std::string message) +{ + if (message.size() > 255) + message = message.substr(0, 255); + const int sz = static_cast(message.size()); + + MessageOut outMsg(CMSG_MAIL_SEND); + outMsg.writeInt16(69 + sz); + outMsg.writeString(name, 24, "name"); + outMsg.writeString(title, 40, "title"); + outMsg.writeInt8(sz); + outMsg.writeString(message, sz, "message"); +} + } // namespace EAthena diff --git a/src/net/eathena/mailhandler.h b/src/net/eathena/mailhandler.h index 1b4f9f2b5..b6e4090ad 100644 --- a/src/net/eathena/mailhandler.h +++ b/src/net/eathena/mailhandler.h @@ -52,6 +52,10 @@ class MailHandler final : public MessageHandler, public Net::MailHandler void resetAttach(const int flag) override final; + void send(const std::string &name, + const std::string &title, + std::string message) override final; + protected: void processMailOpen(Net::MessageIn &msg) const; }; diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 70ffd74e5..16e5d481c 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -373,6 +373,7 @@ #define CMSG_MAIL_RETURN_MESSAGE 0x0273 #define CMSG_MAIL_SET_ATTACH 0x0247 #define CMSG_MAIL_RESET_ATTACH 0x0246 +#define CMSG_MAIL_SEND 0x0248 #define SMSG_SOLVE_CHAR_NAME 0x0194 #define SMSG_SKILL_CASTING 0x07fb diff --git a/src/net/mailhandler.h b/src/net/mailhandler.h index 3ceb7625f..70b5796b7 100644 --- a/src/net/mailhandler.h +++ b/src/net/mailhandler.h @@ -21,6 +21,8 @@ #ifndef NET_MAILHANDLER_H #define NET_MAILHANDLER_H +#include + #include "localconsts.h" namespace Net @@ -45,6 +47,10 @@ class MailHandler notfinal virtual void setAttach(const int index, const int amount) = 0; virtual void resetAttach(const int flag) = 0; + + virtual void send(const std::string &name, + const std::string &title, + std::string message) = 0; }; } // namespace Net diff --git a/src/net/tmwa/mailhandler.cpp b/src/net/tmwa/mailhandler.cpp index dfd69976d..a80400440 100644 --- a/src/net/tmwa/mailhandler.cpp +++ b/src/net/tmwa/mailhandler.cpp @@ -71,4 +71,10 @@ void MailHandler::resetAttach(const int flag A_UNUSED) { } +void MailHandler::send(const std::string &name A_UNUSED, + const std::string &title A_UNUSED, + std::string message A_UNUSED) +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/mailhandler.h b/src/net/tmwa/mailhandler.h index fb0892211..fb90de199 100644 --- a/src/net/tmwa/mailhandler.h +++ b/src/net/tmwa/mailhandler.h @@ -50,6 +50,10 @@ class MailHandler final : public MessageHandler, public Net::MailHandler void setAttach(const int index, const int amount) override final; void resetAttach(const int flag) override final; + + void send(const std::string &name, + const std::string &title, + std::string message) override final; }; } // namespace TmwAthena -- cgit v1.2.3-60-g2f50