mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-09-07 07:41:26 +00:00
feat: limit user sent mail so that it can't be spammed
This commit is contained in:
@@ -70,6 +70,16 @@ uint32_t SQLiteDatabase::GetUnreadMailCount(const uint32_t characterId) {
|
||||
return res.getIntField("number_unread");
|
||||
}
|
||||
|
||||
uint32_t SQLiteDatabase::GetMailCount(const uint32_t characterId) {
|
||||
auto [_, res] = ExecuteSelect("SELECT COUNT(*) AS mail_count FROM mail WHERE receiver_id=?;", characterId);
|
||||
|
||||
if (res.eof()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return res.getIntField("mail_count");
|
||||
}
|
||||
|
||||
void SQLiteDatabase::MarkMailRead(const uint64_t mailId) {
|
||||
ExecuteUpdate("UPDATE mail SET was_read=1 WHERE id=?;", mailId);
|
||||
}
|
||||
@@ -81,3 +91,4 @@ void SQLiteDatabase::ClaimMailItem(const uint64_t mailId) {
|
||||
void SQLiteDatabase::DeleteMail(const uint64_t mailId) {
|
||||
ExecuteDelete("DELETE FROM mail WHERE id=?;", mailId);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user