mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
git-subtree-dir: login_server git-subtree-mainline: 09ebb40de21084bb10ee466429d900a5e757d349 git-subtree-split: ca71af1817a801db9a108c205bc298250d498c4b
61 lines
1.2 KiB
C++
61 lines
1.2 KiB
C++
/*!
|
|
*
|
|
* \author: einhornimmond
|
|
*
|
|
* \date: 02.01.19
|
|
*
|
|
* \brief: manage emails, send all emails with only one connection to mail server, on after on
|
|
*/
|
|
|
|
#ifndef GRADIDO_LOGIN_SERVER_SINGLETON_MANAGER_EMAIL_MANAGER_H
|
|
#define GRADIDO_LOGIN_SERVER_SINGLETON_MANAGER_EMAIL_MANAGER_H
|
|
|
|
#include "Poco/AutoPtr.h"
|
|
#include "Poco/Util/LayeredConfiguration.h"
|
|
|
|
#include "../lib/MultithreadQueue.h"
|
|
#include "../tasks/Thread.h"
|
|
#include "../model/email/Email.h"
|
|
|
|
class EmailManager : public UniLib::lib::Thread
|
|
{
|
|
|
|
public:
|
|
~EmailManager();
|
|
|
|
static EmailManager* getInstance();
|
|
|
|
bool init(const Poco::Util::LayeredConfiguration& cfg);
|
|
|
|
inline const std::string& getAdminReceiver() { return mEmailAccount.admin_receiver; }
|
|
|
|
//! \brief call delete on email after sending it
|
|
void addEmail(model::Email* email);
|
|
|
|
protected:
|
|
EmailManager();
|
|
void exit();
|
|
|
|
int ThreadFunction();
|
|
|
|
struct EmailAccount {
|
|
std::string sender;
|
|
std::string admin_receiver;
|
|
std::string username;
|
|
std::string password;
|
|
std::string url;
|
|
int port;
|
|
};
|
|
Poco::Logger& mEmailLog;
|
|
EmailAccount mEmailAccount;
|
|
|
|
bool mInitalized;
|
|
bool mDisableEmail;
|
|
|
|
UniLib::lib::MultithreadQueue<model::Email*> mPendingEmails;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //GRADIDO_LOGIN_SERVER_SINGLETON_MANAGER_EMAIL_MANAGER_H
|