Fixed returned mails from deleted chars (#7181)

Fixes #7161

Thanks to @Pokye
This commit is contained in:
Lemongrass3110 2022-08-18 00:44:23 +02:00 committed by GitHub
parent df9ef6fa79
commit a88e25a8e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -0,0 +1,7 @@
UPDATE `mail`
SET `send_id`='0'
WHERE `send_id` NOT IN (
select `char_id`
from `char`
)
;

View File

@ -1729,6 +1729,10 @@ enum e_char_del_response char_delete(struct char_session_data* sd, uint32 char_i
if (SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `dest_id`='%d'", schema_config.mail_db, char_id))
Sql_ShowDebug(sql_handle);
/* mark mails as sent from server, if a character gets deleted */
if (SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `send_id`='0' WHERE `send_id`='%d'", schema_config.mail_db, char_id))
Sql_ShowDebug(sql_handle);
#ifdef ENABLE_SC_SAVING
/* status changes */
if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", schema_config.scdata_db, account_id, char_id) )