summaryrefslogtreecommitdiff
path: root/src/char_sql/int_mail.c
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-12 08:55:36 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-12 08:55:36 +0000
commit2f6e6453f6296a6335cf6fccbfe0567584ebdbde (patch)
treec1239f5528ea9254381e78aae0f5d520283151f8 /src/char_sql/int_mail.c
parent164c37ba01a9a727a2134ec606f875d6aa770413 (diff)
downloadhercules-2f6e6453f6296a6335cf6fccbfe0567584ebdbde.tar.gz
hercules-2f6e6453f6296a6335cf6fccbfe0567584ebdbde.tar.bz2
hercules-2f6e6453f6296a6335cf6fccbfe0567584ebdbde.tar.xz
hercules-2f6e6453f6296a6335cf6fccbfe0567584ebdbde.zip
- Important fix to Mail System allowing (by a low change) items duple.
- Added picklog to mail. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11721 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql/int_mail.c')
-rw-r--r--src/char_sql/int_mail.c36
1 files changed, 7 insertions, 29 deletions
diff --git a/src/char_sql/int_mail.c b/src/char_sql/int_mail.c
index e3c47583c..1a49f787f 100644
--- a/src/char_sql/int_mail.c
+++ b/src/char_sql/int_mail.c
@@ -384,11 +384,13 @@ static void mapif_parse_Mail_return(int fd)
*------------------------------------------*/
static void mapif_Mail_send(int fd, struct mail_message* msg)
{
- WFIFOHEAD(fd,10);
+ int len = sizeof(struct mail_message) + 4;
+
+ WFIFOHEAD(fd,len);
WFIFOW(fd,0) = 0x384d;
- WFIFOL(fd,2) = msg->send_id;
- WFIFOL(fd,6) = msg->id;
- WFIFOSET(fd,10);
+ WFIFOW(fd,2) = len;
+ memcpy(WFIFOP(fd,4), msg, sizeof(struct mail_message));
+ WFIFOSET(fd,len);
}
static void mapif_parse_Mail_send(int fd)
@@ -419,37 +421,14 @@ static void mapif_parse_Mail_send(int fd)
}
}
Sql_FreeResult(sql_handle);
+ msg.status = MAIL_NEW;
if( msg.dest_id > 0 )
- {
- msg.status = MAIL_UNVERIFIED;
msg.id = mail_savemessage(&msg);
- }
- else
- msg.id = 0;
mapif_Mail_send(fd, &msg);
}
-static void mapif_parse_Mail_confirmation(int fd)
-{
- int mail_id = RFIFOL(fd,2);
- bool fail = RFIFOB(fd,6);
-
- if( fail )
- {
- if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `status` = '%d' WHERE `id` = '%d'", mail_db, MAIL_INVALID, mail_id) )
- Sql_ShowDebug(sql_handle);
- }
- else
- {
- if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `status` = '%d' WHERE `id` = '%d'", mail_db, MAIL_NEW, mail_id) )
- Sql_ShowDebug(sql_handle);
- else
- mapif_Mail_new(mail_id);
- }
-}
-
/*==========================================
* Packets From Map Server
*------------------------------------------*/
@@ -463,7 +442,6 @@ int inter_mail_parse_frommap(int fd)
case 0x304b: mapif_parse_Mail_delete(fd); break;
case 0x304c: mapif_parse_Mail_return(fd); break;
case 0x304d: mapif_parse_Mail_send(fd); break;
- case 0x304e: mapif_parse_Mail_confirmation(fd); break;
default:
return 0;
}