summaryrefslogtreecommitdiffstats
path: root/src/game-server/accountconnection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game-server/accountconnection.cpp')
-rw-r--r--src/game-server/accountconnection.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/game-server/accountconnection.cpp b/src/game-server/accountconnection.cpp
index 80e6573..c5da8e2 100644
--- a/src/game-server/accountconnection.cpp
+++ b/src/game-server/accountconnection.cpp
@@ -131,7 +131,7 @@ void AccountConnection::processMessage(MessageIn &msg)
while (msg.getUnreadLength())
{
// write the sender
- out.writeLong(msg.readLong());
+ out.writeString(msg.readString());
// write the contents
out.writeString(msg.readString());
@@ -155,6 +155,12 @@ void AccountConnection::processMessage(MessageIn &msg)
// get character
Character *character = postMan->getCharacter(msg.readLong());
+ // check character is valid
+ if (!character)
+ {
+ break;
+ }
+
// create message and put error inside
MessageOut out(GPMSG_SEND_POST_RESPONSE);
out.writeByte(msg.readByte());
@@ -251,6 +257,7 @@ void AccountConnection::sendPost(Character *c, MessageIn &msg)
{
// send message to account server with id of sending player,
// the id of receiving player, the letter contents, and attachments
+ LOG_DEBUG("Sending GCMSG_STORE_POST.");
MessageOut out(GCMSG_STORE_POST);
out.writeLong(c->getDatabaseID());
out.writeString(msg.readString());
@@ -261,11 +268,13 @@ void AccountConnection::sendPost(Character *c, MessageIn &msg)
out.writeLong(msg.readShort());
out.writeLong(msg.readShort());
}
+ send(out);
}
void AccountConnection::getPost(Character *c)
{
// send message to account server with id of retrieving player
+ LOG_DEBUG("Sending GCMSG_REQUEST_POST");
MessageOut out(GCMSG_REQUEST_POST);
out.writeLong(c->getDatabaseID());
send(out);