changed: rename cmslu to winix
changed: html templates are a part of winix now and the user can provide special html templates for its site added: locales added: html templates are using HtmlFilter now (locales) changed: now we have html templates for each language git-svn-id: svn://ttmath.org/publicrep/winix/trunk@560 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -28,15 +28,15 @@ Notify * Notify::obj;
|
||||
|
||||
|
||||
/*
|
||||
methods for second thread
|
||||
methods for the second thread
|
||||
|
||||
second thread can reference to 'this' by using 'obj' pointer
|
||||
the thread can reference to 'this' by using 'obj' pointer
|
||||
*/
|
||||
|
||||
void * Notify::ThreadRoutine(void * arg)
|
||||
{
|
||||
obj = (Notify*)arg;
|
||||
obj->templates_notify.Read(obj->templates_dir);
|
||||
|
||||
|
||||
|
||||
while( true )
|
||||
@@ -70,7 +70,10 @@ void Notify::SendEmail(NotifyMsg & n)
|
||||
{
|
||||
TemplatesNotifyFunctions::notify_msg = &n;
|
||||
|
||||
obj->templates_notify.Generate();
|
||||
obj->Lock(); // templates can be reloaded from the first thread
|
||||
obj->templates_notify.Generate(n.lang);
|
||||
obj->Unlock();
|
||||
|
||||
SendEmail(n.email, obj->templates_notify.notify_str.str());
|
||||
}
|
||||
|
||||
@@ -91,7 +94,6 @@ void Notify::SendEmail(const std::string & email, const std::string & message)
|
||||
|
||||
if( !sendmail )
|
||||
{
|
||||
|
||||
nlog << "Notify: can't run sendmail" << logend;
|
||||
return;
|
||||
}
|
||||
@@ -133,11 +135,20 @@ Notify::~Notify()
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Notify::Init(const std::string & tdir)
|
||||
void Notify::ReadTemplates()
|
||||
{
|
||||
templates_dir = tdir;
|
||||
|
||||
Lock();
|
||||
templates_notify.Read();
|
||||
Unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Notify::Init()
|
||||
{
|
||||
templates_notify.CreateFunctions();
|
||||
|
||||
|
||||
int t = pthread_create(&thread, 0, ThreadRoutine, (void*)this);
|
||||
|
||||
if( t != 0 )
|
||||
@@ -229,6 +240,7 @@ Users::Iterator i;
|
||||
if( sending )
|
||||
{
|
||||
n.email = i->email;
|
||||
n.lang = data.locale.GetLang(); // !! bedzie osobno dla kazdego uzytkownika
|
||||
notify_pool.insert(notify_pool.end(), n);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user