ManaPlus
Public Member Functions
EAthena::MailHandler Class Reference

#include <mailhandler.h>

Inheritance diagram for EAthena::MailHandler:
Net::MailHandler

Public Member Functions

 MailHandler ()
 
 ~MailHandler ()
 
void refresh () const
 
void readMessage (const int msgId) const
 
void getAttach (const int msgId) const
 
void deleteMessage (const int msgId) const
 
void returnMessage (const int msgId) const
 
void setAttach (const int index, const int amount) const
 
void setAttachMoney (const int money) const
 
void resetAttach (const int flag) const
 
void send (const std::string &name, const std::string &title, std::string message) const
 
- Public Member Functions inherited from Net::MailHandler
 MailHandler ()
 

Detailed Description

Definition at line 30 of file mailhandler.h.

Constructor & Destructor Documentation

◆ MailHandler()

EAthena::MailHandler::MailHandler ( )

Definition at line 34 of file mailhandler.cpp.

35 {
36  mailHandler = this;
37 }
Net::MailHandler * mailHandler
Definition: net.cpp:114

References mailHandler.

◆ ~MailHandler()

EAthena::MailHandler::~MailHandler ( )
virtual

Reimplemented from Net::MailHandler.

Definition at line 39 of file mailhandler.cpp.

40 {
41  mailHandler = nullptr;
42 }

References mailHandler.

Member Function Documentation

◆ deleteMessage()

void EAthena::MailHandler::deleteMessage ( const int  msgId) const
virtual

Implements Net::MailHandler.

Definition at line 61 of file mailhandler.cpp.

62 {
63  createOutPacket(CMSG_MAIL_DELETE_MESSAGE);
64  outMsg.writeInt32(msgId, "message id");
65 }
#define createOutPacket(name)
Definition: messageout.h:37

References createOutPacket.

◆ getAttach()

void EAthena::MailHandler::getAttach ( const int  msgId) const
virtual

Implements Net::MailHandler.

Definition at line 55 of file mailhandler.cpp.

56 {
57  createOutPacket(CMSG_MAIL_GET_ATTACH);
58  outMsg.writeInt32(msgId, "message id");
59 }

References createOutPacket.

◆ readMessage()

void EAthena::MailHandler::readMessage ( const int  msgId) const
virtual

Implements Net::MailHandler.

Definition at line 49 of file mailhandler.cpp.

50 {
51  createOutPacket(CMSG_MAIL_READ_MESSAGE);
52  outMsg.writeInt32(msgId, "message id");
53 }

References createOutPacket.

◆ refresh()

void EAthena::MailHandler::refresh ( ) const
virtual

Implements Net::MailHandler.

Definition at line 44 of file mailhandler.cpp.

45 {
46  createOutPacket(CMSG_MAIL_REFRESH_INBOX);
47 }

References createOutPacket.

◆ resetAttach()

void EAthena::MailHandler::resetAttach ( const int  flag) const
virtual

Implements Net::MailHandler.

Definition at line 88 of file mailhandler.cpp.

89 {
90  createOutPacket(CMSG_MAIL_RESET_ATTACH);
91  outMsg.writeInt16(CAST_S16(flag), "flag");
92 }
#define CAST_S16
Definition: cast.h:28

References CAST_S16, and createOutPacket.

◆ returnMessage()

void EAthena::MailHandler::returnMessage ( const int  msgId) const
virtual

Implements Net::MailHandler.

Definition at line 67 of file mailhandler.cpp.

68 {
69  createOutPacket(CMSG_MAIL_RETURN_MESSAGE);
70  outMsg.writeInt32(msgId, "message id");
71  outMsg.writeString("", 24, "unused");
72 }

References createOutPacket.

◆ send()

void EAthena::MailHandler::send ( const std::string &  name,
const std::string &  title,
std::string  message 
) const
virtual

Implements Net::MailHandler.

Definition at line 94 of file mailhandler.cpp.

97 {
98  if (message.size() > 255)
99  message = message.substr(0, 255);
100  const int sz = CAST_S32(message.size());
101 
102  createOutPacket(CMSG_MAIL_SEND);
103  outMsg.writeInt16(CAST_S16(69 + sz), "len");
104  outMsg.writeString(name, 24, "name");
105  outMsg.writeString(title, 40, "title");
106  outMsg.writeInt8(CAST_S8(sz), "message size");
107  outMsg.writeString(message, sz, "message");
108 }
#define CAST_S8
Definition: cast.h:26
#define CAST_S32
Definition: cast.h:30

References CAST_S16, CAST_S32, CAST_S8, and createOutPacket.

◆ setAttach()

void EAthena::MailHandler::setAttach ( const int  index,
const int  amount 
) const
virtual

Implements Net::MailHandler.

Definition at line 74 of file mailhandler.cpp.

75 {
76  createOutPacket(CMSG_MAIL_SET_ATTACH);
77  outMsg.writeInt16(CAST_S16(index + INVENTORY_OFFSET), "index");
78  outMsg.writeInt32(amount, "amount");
79 }
static const int INVENTORY_OFFSET
Definition: inventory.h:27

References CAST_S16, createOutPacket, and INVENTORY_OFFSET.

◆ setAttachMoney()

void EAthena::MailHandler::setAttachMoney ( const int  money) const
virtual

Implements Net::MailHandler.

Definition at line 81 of file mailhandler.cpp.

82 {
83  createOutPacket(CMSG_MAIL_SET_ATTACH);
84  outMsg.writeInt16(CAST_S16(0), "index");
85  outMsg.writeInt32(money, "money");
86 }

References CAST_S16, and createOutPacket.


The documentation for this class was generated from the following files: