Skip to content

Commit

Permalink
feat(DB/Account): Delete account_muted when deleting an account
Browse files Browse the repository at this point in the history
* When you delete an account with .acc delete it will also delete the account_muted history for the account
  • Loading branch information
vhiperdev authored May 16, 2020
1 parent f0cb997 commit d3d9ad7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/common/Database/Implementation/LoginDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_SEL_AUTOBROADCAST, "SELECT id, weight, text FROM autobroadcast WHERE realmid = ? OR realmid = -1", CONNECTION_SYNCH);
PrepareStatement(LOGIN_INS_ACCOUNT_MUTE, "INSERT INTO account_muted VALUES (?, UNIX_TIMESTAMP(), ?, ?, ?)", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_ACCOUNT_MUTE_INFO, "SELECT mutedate, mutetime, mutereason, mutedby FROM account_muted WHERE guid = ? ORDER BY mutedate ASC", CONNECTION_SYNCH);
PrepareStatement(LOGIN_DEL_ACCOUNT_MUTEDEL, "DELETE FROM account_muted WHERE guid = ?", CONNECTION_ASYNC);
// 0: uint32, 1: uint32, 2: uint8, 3: uint32, 4: string // Complete name: "Login_Insert_AccountLoginDeLete_IP_Logging"
PrepareStatement(LOGIN_INS_ALDL_IP_LOGGING, "INSERT INTO logs_ip_actions (account_id,character_guid,type,ip,systemnote,unixtime,time) VALUES (?, ?, ?, (SELECT last_ip FROM account WHERE id = ?), ?, unix_timestamp(NOW()), NOW())", CONNECTION_ASYNC);
// 0: uint32, 1: uint32, 2: uint8, 3: uint32, 4: string // Complete name: "Login_Insert_FailedAccountLogin_IP_Logging"
Expand Down
1 change: 1 addition & 0 deletions src/common/Database/Implementation/LoginDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ enum LoginDatabaseStatements

LOGIN_INS_ACCOUNT_MUTE,
LOGIN_SEL_ACCOUNT_MUTE_INFO,
LOGIN_DEL_ACCOUNT_MUTEDEL,

MAX_LOGINDATABASE_STATEMENTS
};
Expand Down
4 changes: 4 additions & 0 deletions src/server/game/Accounts/AccountMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ namespace AccountMgr
stmt->setUInt32(0, accountId);
trans->Append(stmt);

stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_MUTEDEL);
stmt->setUInt32(0, accountId);
trans->Append(stmt);

LoginDatabase.CommitTransaction(trans);

return AOR_OK;
Expand Down

0 comments on commit d3d9ad7

Please sign in to comment.