summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-28 15:12:54 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-28 15:12:54 +0000
commit190793600675c03e76b527f12142d33f119d4f92 (patch)
tree5766125f522e4dfe7009ffc4f9e26e0cce2c9e14
parent86c9547726dcc3592a4ecccac0622c49b2da68d8 (diff)
downloadhercules-190793600675c03e76b527f12142d33f119d4f92.tar.gz
hercules-190793600675c03e76b527f12142d33f119d4f92.tar.bz2
hercules-190793600675c03e76b527f12142d33f119d4f92.tar.xz
hercules-190793600675c03e76b527f12142d33f119d4f92.zip
- Fixed a bug on the Attachment [Mail System]
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11593 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/clif.c13
-rw-r--r--src/map/mail.c4
3 files changed, 13 insertions, 6 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 3f841bf17..3f22d3dea 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,8 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+2007/10/28
+ * Fixed a bug sending on the attachment message [Zephyrus]
2007/10/27
* Fixed a typo in r11505 messing up the 'npcmove' command
* Removed 'petid', a command from r284 to look up pet ids by name
diff --git a/src/map/clif.c b/src/map/clif.c
index 7dc99a493..c020d5760 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -11453,8 +11453,8 @@ void clif_Mail_read(struct map_session_data *sd, int mail_id)
WFIFOW(fd,0) = 0x242;
WFIFOW(fd,2) = len;
WFIFOL(fd,4) = msg->id;
- memcpy(WFIFOP(fd, 8), msg->title, MAIL_TITLE_LENGTH);
- memcpy(WFIFOP(fd,48), msg->send_name, NAME_LENGTH);
+ safestrncpy((char*)WFIFOP(fd,8), msg->title, MAIL_TITLE_LENGTH + 1);
+ safestrncpy((char*)WFIFOP(fd,48), msg->send_name, NAME_LENGTH + 1);
WFIFOL(fd,72) = 0;
WFIFOL(fd,76) = msg->zeny;
@@ -11475,7 +11475,7 @@ void clif_Mail_read(struct map_session_data *sd, int mail_id)
memset(WFIFOP(fd,80), 0x00, 19);
WFIFOB(fd,99) = (unsigned char)msg_len;
- safestrncpy((char*)WFIFOP(fd,100), msg->body, msg_len);
+ safestrncpy((char*)WFIFOP(fd,100), msg->body, msg_len + 1);
WFIFOSET(fd,len);
if (msg->status == MAIL_UNREAD) {
@@ -11577,7 +11577,9 @@ void clif_parse_Mail_setattach(int fd, struct map_session_data *sd)
return;
flag = mail_setitem(sd, idx, amount);
- clif_Mail_attachment(fd,flag);
+
+ if (idx > 0)
+ clif_Mail_attachment(fd,flag);
}
/*------------------------------------------
@@ -11633,6 +11635,7 @@ void clif_parse_Mail_send(int fd, struct map_session_data *sd)
return;
}
+ msg.id = 0; // id will be assigned by charserver
msg.send_id = sd->status.char_id;
msg.dest_id = 0; // will attempt to resolve name
safestrncpy(msg.send_name, sd->status.name, NAME_LENGTH);
@@ -11640,7 +11643,7 @@ void clif_parse_Mail_send(int fd, struct map_session_data *sd)
safestrncpy(msg.title, (char*)RFIFOP(fd,28), MAIL_TITLE_LENGTH);
if (body_len)
- safestrncpy(msg.body, (char*)RFIFOP(fd,69), body_len+1);
+ safestrncpy(msg.body, (char*)RFIFOP(fd,69), body_len + 1);
else
memset(msg.body, 0x00, MAIL_BODY_LENGTH);
diff --git a/src/map/mail.c b/src/map/mail.c
index c95d6fbfa..e1c006a0a 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -55,7 +55,7 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount)
if (idx == 0)
{ // Zeny Transfer
if (amount < 0)
- return 2; //FIXME: totally wrong value
+ return 0;
if (amount > sd->status.zeny)
amount = sd->status.zeny;
@@ -105,6 +105,8 @@ bool mail_getattach(struct map_session_data *sd, struct mail_message *msg)
memcpy(&msg->item, &sd->status.inventory[n], sizeof(struct item));
msg->item.amount = sd->mail.amount;
}
+ else
+ memset(&msg->item, 0x00, sizeof(struct item));
msg->zeny = sd->mail.zeny;