added: Patterns class (in templates)

ezc patterns are managed by this class
added: some work in groupitem plugin (not finished yet)
changed: ConfParser can read a string from memory now
         (need some testing yet)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@757 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2011-08-25 23:53:49 +00:00
parent ee6500ac65
commit 5b8a9c0108
46 changed files with 2896 additions and 1715 deletions

View File

@@ -41,7 +41,7 @@ void NotifyThread::SetNotifyPool(NotifyPool * pool)
// first thread (objects are locked)
void NotifyThread::SetPatterns(TemplatesFunctions::Patterns * pat)
void NotifyThread::SetPatterns(Patterns * pat)
{
pat_global = pat;
}
@@ -163,24 +163,25 @@ void NotifyThread::SendMail()
size_t lang_index = TemplatesNotifyFunctions::notify_user_msg.lang;
size_t template_index = TemplatesNotifyFunctions::notify_msg.template_index;
if( lang_index >= patterns.size() )
return;
Lock();
// 'patterns' object can use logger or other stuff so we use Lock() before
Ezc::Pattern * pat = patterns.Get(template_index, lang_index);
if( template_index >= patterns[lang_index].size() )
if( !pat )
log << log1 << "NotifyThread: I don't have a template with index: " << template_index
<< " and locale index: " << lang_index << logend;
Unlock();
if( pat )
{
Lock();
log << log1 << "NotifyThread: incorrect template index: " << template_index << logend;
Unlock();
return;
generator.RecognizeSpecialChars(true);
generator.TrimWhite(true);
generator.SkipNewLine(true);
generator.Generate(notify_stream, *pat, TemplatesNotifyFunctions::ezc_functions);
SendMail(TemplatesNotifyFunctions::notify_user_msg.email, notify_stream.Str());
}
generator.RecognizeSpecialChars(true);
generator.TrimWhite(true);
generator.SkipNewLine(true);
generator.Generate(notify_stream, patterns[lang_index][template_index],
TemplatesNotifyFunctions::ezc_functions);
SendMail(TemplatesNotifyFunctions::notify_user_msg.email, notify_stream.Str());
}