summaryrefslogtreecommitdiff
path: root/src/char_sql
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/char_sql
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/char_sql')
-rw-r--r--src/char_sql/int_mail.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/char_sql/int_mail.c b/src/char_sql/int_mail.c
index c38be689b..e3c47583c 100644
--- a/src/char_sql/int_mail.c
+++ b/src/char_sql/int_mail.c
@@ -38,8 +38,8 @@ static int mail_fromsql(int char_id, struct mail_data* md)
"`zeny`,`amount`,`nameid`,`refine`,`attribute`,`identify`");
for (i = 0; i < MAX_SLOTS; i++)
StringBuf_Printf(&buf, ",`card%d`", i);
- StringBuf_Printf(&buf, " FROM `%s` WHERE `dest_id`='%d' AND `status` > -1 AND `status` < 3 "
- "ORDER BY `id` LIMIT %d", mail_db, char_id, MAIL_MAX_INBOX + 1);
+ StringBuf_Printf(&buf, " FROM `%s` WHERE `dest_id`='%d' AND `status` >= %d AND `status` <= %d "
+ "ORDER BY `id` LIMIT %d", mail_db, char_id, MAIL_NEW, MAIL_READ, MAIL_MAX_INBOX + 1);
if( SQL_ERROR == Sql_Query(sql_handle, StringBuf_Value(&buf)) )
Sql_ShowDebug(sql_handle);
@@ -217,12 +217,12 @@ static void mapif_parse_Mail_requestinbox(int fd)
}
/*==========================================
- * 'Mail read' Mark
+ * Mark mail as 'Read'
*------------------------------------------*/
static void mapif_parse_Mail_read(int fd)
{
int mail_id = RFIFOL(fd,2);
- if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `read_flag` = '%d' WHERE `id` = '%d'", mail_db, MAIL_READED, mail_id) )
+ if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `status` = '%d' WHERE `id` = '%d'", mail_db, MAIL_READ, mail_id) )
Sql_ShowDebug(sql_handle);
}
@@ -262,7 +262,7 @@ static void mapif_Mail_getattach(int fd, int char_id, int mail_id)
if( msg.dest_id != char_id )
return;
- if( msg.status != MAIL_READED )
+ if( msg.status != MAIL_READ )
return;
if( (msg.item.nameid < 1 || msg.item.amount < 1) && msg.zeny < 1 )