fix to save sender
This commit is contained in:
parent
b9794d13c4
commit
dc27e2b1e1
@ -1,10 +1,11 @@
|
|||||||
#include "mail.h"
|
#include "mail.h"
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
mail::mail(std::string filename, std::string subject) :
|
mail::mail(std::string filename, std::string subject, std::string sender) :
|
||||||
filename(filename),
|
filename(filename),
|
||||||
timestamp(std::time(NULL)),
|
timestamp(std::time(NULL)),
|
||||||
subject(subject),
|
subject(subject),
|
||||||
|
sender(sender),
|
||||||
deleted(false),
|
deleted(false),
|
||||||
m_file()
|
m_file()
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ struct mail {
|
|||||||
|
|
||||||
bool deleted;
|
bool deleted;
|
||||||
|
|
||||||
mail(std::string filename, std::string subject);
|
mail(std::string filename, std::string subject, std::string sender);
|
||||||
mail(std::string filename, int64_t timestamp, std::string subject);
|
mail(std::string filename, int64_t timestamp, std::string subject);
|
||||||
|
|
||||||
bool operator()(const u_int& id) const {
|
bool operator()(const u_int& id) const {
|
||||||
|
|||||||
@ -390,7 +390,7 @@ std::string cmdLOGIN(std::vector<std::string>& received)
|
|||||||
|
|
||||||
std::string cmdSEND(std::vector<std::string>& received)
|
std::string cmdSEND(std::vector<std::string>& received)
|
||||||
{
|
{
|
||||||
// TODO: change sender to be implicit from currently logged in
|
// TODO: change sender to be implicit from currently logged in; replace received.at(1) and move all other received one forward
|
||||||
if (received.at(3).length() > 80)
|
if (received.at(3).length() > 80)
|
||||||
return "ERR\n";
|
return "ERR\n";
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ std::string cmdSEND(std::vector<std::string>& received)
|
|||||||
}
|
}
|
||||||
|
|
||||||
user_handler::getInstance().getOrCreateUser(received.at(2))->addMail(
|
user_handler::getInstance().getOrCreateUser(received.at(2))->addMail(
|
||||||
new struct mail(saveToFile(user_handler::getInstance().getSpoolDir()/"messages", received.at(4)), received.at(3))
|
new struct mail(saveToFile(user_handler::getInstance().getSpoolDir()/"messages", received.at(4)), received.at(3), received.at(1))
|
||||||
);
|
);
|
||||||
|
|
||||||
return "OK\n"; // TODO: error handling
|
return "OK\n"; // TODO: error handling
|
||||||
@ -409,7 +409,7 @@ std::string cmdSEND(std::vector<std::string>& received)
|
|||||||
|
|
||||||
std::string cmdLIST(std::vector<std::string>& received)
|
std::string cmdLIST(std::vector<std::string>& received)
|
||||||
{
|
{
|
||||||
// TODO: change user to be implicit from currently logged in
|
// TODO: change user to be implicit from currently logged in; replace received.at(1)
|
||||||
maillist inbox;
|
maillist inbox;
|
||||||
user* user;
|
user* user;
|
||||||
|
|
||||||
@ -429,7 +429,7 @@ std::string cmdLIST(std::vector<std::string>& received)
|
|||||||
|
|
||||||
std::string cmdREAD(std::vector<std::string>& received)
|
std::string cmdREAD(std::vector<std::string>& received)
|
||||||
{
|
{
|
||||||
// TODO: change user to be implicit from currently logged in
|
// TODO: change user to be implicit from currently logged in; replace received.at(1) and move received.at(2) one forward
|
||||||
std::string response = "OK\n";
|
std::string response = "OK\n";
|
||||||
|
|
||||||
user* user;
|
user* user;
|
||||||
@ -458,7 +458,7 @@ std::string cmdREAD(std::vector<std::string>& received)
|
|||||||
|
|
||||||
std::string cmdDEL(std::vector<std::string>& received)
|
std::string cmdDEL(std::vector<std::string>& received)
|
||||||
{
|
{
|
||||||
// TODO: change user to be implicit from currently logged in
|
// TODO: change user to be implicit from currently logged in; replace received.at(1) and move received.at(2) one forward
|
||||||
user* user;
|
user* user;
|
||||||
|
|
||||||
char* p;
|
char* p;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user