summaryrefslogtreecommitdiff
path: root/src/map/intif.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-27 09:48:27 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-27 09:48:27 +0000
commitc5887c263b96f9a3bf128b3b53e63d68ff6b9392 (patch)
treea767807a4b7a4bf5878523bb8f196d6fb6a32d94 /src/map/intif.c
parent4ecca0e292aafef33fe168d59c1a4e013cc0cda6 (diff)
downloadhercules-c5887c263b96f9a3bf128b3b53e63d68ff6b9392.tar.gz
hercules-c5887c263b96f9a3bf128b3b53e63d68ff6b9392.tar.bz2
hercules-c5887c263b96f9a3bf128b3b53e63d68ff6b9392.tar.xz
hercules-c5887c263b96f9a3bf128b3b53e63d68ff6b9392.zip
Followup fixes to r11583:
* fixed wrong sql upgrade file name, added svn:eol-style native * made 'status' variable directly use the mail_status enum * replaced some hardcoded numbers in mail queries with references to the enum * fixed a query which still used 'read_flag' * fixed all new mails being displayed as 'already read' * removed sd nullpo checks from parse_ functions as that can never happen * fixed mapserver sending (and charserver saving) junk item fields when there is no item attached to a mail * fixed wrong mail send packet interpretation saving random memory after message body ('body_len' doesn't include the terminating zero) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11584 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/intif.c')
-rw-r--r--src/map/intif.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/src/map/intif.c b/src/map/intif.c
index 211edfe2d..629f1f5d1 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -1690,54 +1690,49 @@ int intif_Mail_send(int account_id, struct mail_message *msg)
return 0;
}
-int intif_parse_Mail_send(int fd)
+static void intif_parse_Mail_send(int fd)
{
struct map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
int mail_id = RFIFOL(fd,6);
bool fail = false;
- if( mail_id > 0 )
+ if( mail_id == 0 )
+ fail = true;
+ else
{
if( sd == NULL )
fail = true;
if( !mail_checkattach(sd) )
{
- fail = true;
-
mail_removeitem(sd, 0);
mail_removezeny(sd, 0);
+ fail = true;
}
+ // confirmation message
WFIFOHEAD(inter_fd,7);
WFIFOW(inter_fd,0) = 0x304e;
WFIFOL(inter_fd,2) = mail_id;
WFIFOB(inter_fd,6) = fail;
WFIFOSET(inter_fd,7);
-
- clif_Mail_send(sd->fd, fail);
}
- else
- clif_Mail_send(sd->fd, true);
-
- return 0;
+
+ clif_Mail_send(sd->fd, fail);
}
-int intif_parse_Mail_new(int fd)
+static void intif_parse_Mail_new(int fd)
{
struct map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
- if( sd != NULL )
- {
- char sender_name[NAME_LENGTH], title[MAIL_TITLE_LENGTH];
- int mail_id = RFIFOL(fd,6);
-
- safestrncpy(sender_name, RFIFOP(fd,10), NAME_LENGTH);
- safestrncpy(title, RFIFOP(fd,34), MAIL_TITLE_LENGTH);
+ int mail_id = RFIFOL(fd,6);
+ const char* sender_name = (char*)RFIFOP(fd,10);
+ const char* title = (char*)RFIFOP(fd,34);
- clif_Mail_new(sd, mail_id, sender_name, title);
- }
+ if( sd == NULL )
+ return;
- return 0;
+ sd->mail.inbox.changed = true;
+ clif_Mail_new(sd->fd, mail_id, sender_name, title);
}
#endif