Fixed some bugs
This commit is contained in:
parent
7d4df36049
commit
58aa7fe9bc
@ -79,7 +79,7 @@ shared_ptr<Letter> LetterManager::getFullLetter(LetterId letter) {
|
|||||||
if(strcmp(columns[index], "sender") == 0)
|
if(strcmp(columns[index], "sender") == 0)
|
||||||
letter->sender = values[index];
|
letter->sender = values[index];
|
||||||
else if(strcmp(columns[index], "created") == 0)
|
else if(strcmp(columns[index], "created") == 0)
|
||||||
letter->created = system_clock::now() + milliseconds(stoull(values[index]));
|
letter->created = system_clock::now() + std::chrono::seconds{stoull(values[index])};
|
||||||
else if(strcmp(columns[index], "letterId") == 0)
|
else if(strcmp(columns[index], "letterId") == 0)
|
||||||
letter->id = static_cast<LetterId>(stoull(values[index]));
|
letter->id = static_cast<LetterId>(stoull(values[index]));
|
||||||
else if(strcmp(columns[index], "subject") == 0)
|
else if(strcmp(columns[index], "subject") == 0)
|
||||||
@ -96,12 +96,12 @@ shared_ptr<Letter> LetterManager::getFullLetter(LetterId letter) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LetterManager::createLetter(ClientUid sender, ClientUid reciver, std::string subject, std::string message) {
|
void LetterManager::createLetter(const ClientUid& sender, const ClientUid& reciver, const std::string& subject, const std::string& message) {
|
||||||
sql::command(this->server->getSql(), "INSERT INTO `letters` (`serverId`, `sender`, `receiver`, `created`, `subject`, `message`, `read`) VALUES (:sid, :sender, :receiver, :created, :subject, :message, :read)",
|
sql::command(this->server->getSql(), "INSERT INTO `letters` (`serverId`, `sender`, `receiver`, `created`, `subject`, `message`, `read`) VALUES (:sid, :sender, :receiver, :created, :subject, :message, :read)",
|
||||||
variable{":sid", this->server->getServerId()},
|
variable{":sid", this->server->getServerId()},
|
||||||
variable{":sender", sender},
|
variable{":sender", sender},
|
||||||
variable{":receiver", reciver},
|
variable{":receiver", reciver},
|
||||||
variable{":created", duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count()},
|
variable{":created", std::chrono::floor<std::chrono::seconds>(system_clock::now().time_since_epoch()).count()},
|
||||||
variable{":subject", subject},
|
variable{":subject", subject},
|
||||||
variable{":message", message},
|
variable{":message", message},
|
||||||
variable{":read", false})
|
variable{":read", false})
|
||||||
|
@ -37,7 +37,7 @@ namespace ts {
|
|||||||
void updateReadFlag(LetterId, bool);
|
void updateReadFlag(LetterId, bool);
|
||||||
void deleteLetter(LetterId);
|
void deleteLetter(LetterId);
|
||||||
|
|
||||||
void createLetter(ClientUid sender, ClientUid reciver, std::string subject, std::string message);
|
void createLetter(const ClientUid& sender, const ClientUid& reciver, const std::string& subject, const std::string& message);
|
||||||
private:
|
private:
|
||||||
server::VirtualServer* server;
|
server::VirtualServer* server;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user