2010-12-02 02:02:02 +01:00
|
|
|
/*
|
|
|
|
* This file is a part of Winix
|
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2011-02-24 18:06:12 +01:00
|
|
|
* Copyright (c) 2008-2011, Tomasz Sowa
|
2010-12-02 02:02:02 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
#ifndef headerfile_winix_notify_notifythread
|
|
|
|
#define headerfile_winix_notify_notifythread
|
2010-12-02 02:02:02 +01:00
|
|
|
|
|
|
|
#include "core/basethread.h"
|
|
|
|
#include "templatesnotify.h"
|
|
|
|
#include "ezc.h"
|
|
|
|
#include "templates/misc.h"
|
|
|
|
#include "core/config.h"
|
|
|
|
#include "core/users.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// we have set following pointers: request, config, system (from BaseThread)
|
|
|
|
|
|
|
|
class NotifyThread : public BaseThread
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
NotifyThread();
|
|
|
|
|
|
|
|
void SetConfig(Config * pconfig);
|
|
|
|
void SetUsers(Users * pusers);
|
|
|
|
void SetNotifyPool(NotifyPool * pool);
|
|
|
|
void SetPatterns(TemplatesFunctions::Patterns * pat);
|
|
|
|
void PatternsChanged();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
Config * config;
|
|
|
|
Users * users;
|
|
|
|
NotifyPool * notify_pool;
|
|
|
|
TemplatesFunctions::Patterns * pat_global;
|
|
|
|
|
|
|
|
NotifyUserMsg msg;
|
|
|
|
typedef std::list<NotifyUserMsg> NotifyUser;
|
|
|
|
NotifyUser notify_user;
|
|
|
|
std::string sendmail_command;
|
|
|
|
bool patterns_changed;
|
|
|
|
TemplatesFunctions::Patterns patterns;
|
|
|
|
TemplatesNotifyFunctions::NotifyStream notify_stream;
|
|
|
|
Ezc::Generator<TemplatesNotifyFunctions::NotifyStream> generator;
|
|
|
|
|
|
|
|
virtual bool Init();
|
|
|
|
virtual bool SignalReceived();
|
|
|
|
bool AddNextNotify();
|
|
|
|
virtual void Do();
|
|
|
|
void SendMail();
|
|
|
|
void SendMail(const std::wstring & email, const std::wstring & message);
|
|
|
|
void SendMail(FILE * sendmail, const std::wstring & message);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|