mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-25 08:32:25 +00:00
SetMessageStatus converted to QueryDatabase
This commit is contained in:
parent
8529384b00
commit
c9bd662b57
@ -428,11 +428,8 @@ void Database::SendBody(Client *client, int messageNumber) {
|
|||||||
bool Database::SendMail(std::string recipient, std::string from, std::string subject, std::string body, std::string recipientsString) {
|
bool Database::SendMail(std::string recipient, std::string from, std::string subject, std::string body, std::string recipientsString) {
|
||||||
|
|
||||||
int characterID;
|
int characterID;
|
||||||
|
|
||||||
std::string characterName;
|
std::string characterName;
|
||||||
|
|
||||||
//printf("Database::SendMail(%s, %s, %s)\n", Recipient.c_str(), From.c_str(), Subject.c_str());
|
|
||||||
|
|
||||||
auto lastPeriod = recipient.find_last_of(".");
|
auto lastPeriod = recipient.find_last_of(".");
|
||||||
|
|
||||||
if(lastPeriod == std::string::npos)
|
if(lastPeriod == std::string::npos)
|
||||||
@ -488,22 +485,21 @@ bool Database::SendMail(std::string recipient, std::string from, std::string sub
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::SetMessageStatus(int MessageNumber, int Status) {
|
void Database::SetMessageStatus(int messageNumber, int status) {
|
||||||
|
|
||||||
_log(UCS__TRACE, "SetMessageStatus %i %i", MessageNumber, Status);
|
_log(UCS__TRACE, "SetMessageStatus %i %i", messageNumber, status);
|
||||||
|
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
if(status == 0) {
|
||||||
char *query = 0;
|
std::string query = StringFormat("DELETE FROM `mail` WHERE `msgid` = %i", messageNumber);
|
||||||
|
auto results = QueryDatabase(query);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(Status == 0)
|
std::string query = StringFormat("UPDATE `mail` SET `status` = %i WHERE `msgid`=%i", status, messageNumber);
|
||||||
RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `msgid`=%i", MessageNumber), errbuf);
|
auto results = QueryDatabase(query);
|
||||||
else if (!RunQuery(query, MakeAnyLenString(&query, "update `mail` set `status`=%i where `msgid`=%i", Status, MessageNumber), errbuf)) {
|
if (!results.Success())
|
||||||
|
_log(UCS__ERROR, "Error updating status %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
|
|
||||||
_log(UCS__ERROR, "Error updating status %s, %s", query, errbuf);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
safe_delete_array(query);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::ExpireMail() {
|
void Database::ExpireMail() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user