summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2018-04-03 02:22:50 +0200
committerGitHub <noreply@github.com>2018-04-03 02:22:50 +0200
commitff2fe99a614aa23c73f63402c67c08f7a4885c4b (patch)
tree4d5b981fc0c3fa5ac61b0bf7b8e6f3557b542599
parent2bd8bcf86931f2dce4df3d2fef4836657543ca50 (diff)
parentf4fcc01de24e4dc4c59ad1941b7e13ec9015d1d5 (diff)
downloadhercules-ff2fe99a614aa23c73f63402c67c08f7a4885c4b.tar.gz
hercules-ff2fe99a614aa23c73f63402c67c08f7a4885c4b.tar.bz2
hercules-ff2fe99a614aa23c73f63402c67c08f7a4885c4b.tar.xz
hercules-ff2fe99a614aa23c73f63402c67c08f7a4885c4b.zip
Merge pull request #1995 from guilherme-gm/rodex-expire
Fixed wrong rodex loading when mail expire date was manually changed
-rw-r--r--src/char/int_rodex.c8
-rw-r--r--src/map/rodex.c2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/char/int_rodex.c b/src/char/int_rodex.c
index 2001ddc43..0dab66f61 100644
--- a/src/char/int_rodex.c
+++ b/src/char/int_rodex.c
@@ -83,8 +83,8 @@ static int inter_rodex_fromsql(int char_id, int account_id, int8 opentype, int64
if (SQL_ERROR == SQL->StmtPrepare(stmt,
"SELECT `mail_id`, `sender_name`, `sender_id`, `receiver_name`, `receiver_id`, `receiver_accountid`,"
"`title`, `body`, `zeny`, `type`, `is_read`, `sender_read`, `send_date`, `expire_date`, `weight`"
- "FROM `%s` WHERE (`is_read` = 0 AND `sender_id` = '%d' AND `expire_date` <= '%d' AND `send_date` + '%d' > '%d' AND `mail_id` > '%"PRId64"')"
- "ORDER BY `mail_id` ASC", rodex_db, char_id, (int)time(NULL), 2 * RODEX_EXPIRE, (int)time(NULL), mail_id)
+ "FROM `%s` WHERE (`is_read` = 0 AND `sender_id` = '%d' AND `expire_date` <= '%d' AND `expire_date` + '%d' > '%d' AND `mail_id` > '%"PRId64"')"
+ "ORDER BY `mail_id` ASC", rodex_db, char_id, (int)time(NULL), RODEX_EXPIRE, (int)time(NULL), mail_id)
) {
SqlStmt_ShowDebug(stmt);
SQL->StmtFree(stmt);
@@ -98,8 +98,8 @@ static int inter_rodex_fromsql(int char_id, int account_id, int8 opentype, int64
"`title`, `body`, `zeny`, `type`, `is_read`, `sender_read`, `send_date`, `expire_date`, `weight`"
"FROM `%s` WHERE "
"((`expire_date` > '%d' AND (`receiver_id` = '%d' OR `receiver_accountid` = '%d'))"
- "OR (`is_read` = 0 AND `sender_id` = '%d' AND `expire_date` <= '%d' AND `send_date` + '%d' > '%d'))"
- "ORDER BY `mail_id` ASC", rodex_db, (int)time(NULL), char_id, account_id, char_id, (int)time(NULL), 2 * RODEX_EXPIRE, (int)time(NULL))
+ "OR (`is_read` = 0 AND `sender_id` = '%d' AND `expire_date` <= '%d' AND `expire_date` + '%d' > '%d'))"
+ "ORDER BY `mail_id` ASC", rodex_db, (int)time(NULL), char_id, account_id, char_id, (int)time(NULL), RODEX_EXPIRE, (int)time(NULL))
) {
SqlStmt_ShowDebug(stmt);
SQL->StmtFree(stmt);
diff --git a/src/map/rodex.c b/src/map/rodex.c
index 0e9e4ee2a..d1b0191ac 100644
--- a/src/map/rodex.c
+++ b/src/map/rodex.c
@@ -383,7 +383,7 @@ struct rodex_message *rodex_get_mail(struct map_session_data *sd, int64 mail_id)
if ((msg->is_deleted == true)
|| (msg->expire_date < time(NULL) && ((msg->receiver_accountid > 0) || (msg->receiver_id == char_id && msg->sender_id != char_id)))
- || ((msg->send_date + 2 * RODEX_EXPIRE) < time(NULL))
+ || (msg->expire_date + RODEX_EXPIRE < time(NULL))
)
return NULL;