start working on 0.7.x branch

- added FileLog which stores content to the file log
- now Log is only a wrapper - it puts messages to the local buffer and when logsave is used then the buffer is put to FileLog
- new base classes:
  WinixBase (Log, Config*, Synchro*)
  WinixModel : public WinixBase (morm::ModelConnector*, Plugin*)
  WinixSystem : public WinixModel (System*)
  WinixRequest : public WinixSystem (SLog, Cur*)
- singletons: log, slog, plugin are depracated - now references to them are in base classses (WinixBase, WinixModel)
- DbBase,  DbConn and Db are depracated - now we are using Morm project (in WinixModel there is a model_connector pointer)
  each thread will have its own ModelConnector





git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1146 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2018-11-21 11:03:53 +00:00
parent a7c47140ae
commit a2ffc1e81c
121 changed files with 7832 additions and 6662 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2014, Tomasz Sowa
* Copyright (c) 2008-2018, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -47,10 +47,10 @@ NotifyThread::NotifyThread()
// first thread (objects are locked)
void NotifyThread::SetConfig(Config * pconfig)
{
config = pconfig;
}
//void NotifyThread::SetConfig(Config * pconfig)
//{
// config = pconfig;
//}
@@ -83,10 +83,18 @@ void NotifyThread::PatternsChanged()
}
//void NotifyThread::SetFileLog(FileLog * file_log)
//{
// log.SetFileLog(file_log);
// log.Init(config->log_level, false, 1);
//}
// first thread (objects are locked)
bool NotifyThread::Init()
{
TemplatesNotifyFunctions::CreateFunctions();
plugin->Call((Session*)0, WINIX_NOTIFY_TEMPLATES_CREATEFUNCTIONS, &TemplatesNotifyFunctions::ezc_functions);
return true;
}
@@ -192,6 +200,8 @@ bool queue_end;
queue_end = (i == notify_user.end());
Unlock();
}
log << logsave;
}
}
@@ -248,11 +258,11 @@ void NotifyThread::SendMail()
// second thread
void NotifyThread::SendMail(const std::wstring & email, const std::wstring & message)
{
nlog << log1 << PT::Date(std::time(0)) << ' ';
log << log1 << PT::Date(std::time(0)) << ' ';
if( !ValidateEmail(email) )
{
nlog << log1 << "NotifyThread: email adress: " << email << " is not correct" << logend;
log << log1 << "NotifyThread: email adress: " << email << " is not correct" << logend;
return;
}
@@ -262,14 +272,14 @@ void NotifyThread::SendMail(const std::wstring & email, const std::wstring & mes
if( !sendmail )
{
nlog << log1 << "NotifyThread: can't run sendmail" << logend;
log << log1 << "NotifyThread: can't run sendmail" << logend;
return;
}
SendMail(sendmail, message);
pclose(sendmail);
nlog << log1 << "NotifyThread: email to: " << email << " has been sent" << logend << logsave;
log << log1 << "NotifyThread: email to: " << email << " has been sent" << logend << logsave;
}