moved winix directories to winixdsubdirectory

git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1028 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2016-03-17 08:26:02 +00:00
parent ed5adb3f23
commit 145efe937c
246 changed files with 0 additions and 0 deletions

19
winixd/notify/Makefile Normal file
View File

@@ -0,0 +1,19 @@
include Makefile.o.dep
all: $(o)
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) $<
depend:
makedepend -Y. $(CXXWINIXINCLUDEFLAGS) -f- *.cpp > Makefile.dep
echo -n "o = " > Makefile.o.dep
ls -1 *.cpp | xargs -I foo echo -n foo " " | sed -E "s/([^\.]*)\.cpp[ ]/\1\.o/g" >> Makefile.o.dep
clean:
rm -f *.o
include Makefile.dep

234
winixd/notify/Makefile.dep Normal file
View File

@@ -0,0 +1,234 @@
# DO NOT DELETE
notify.o: notify.h notifypool.h ../../winix/templates/locale.h
notify.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
notify.o: ../../pikotools/textstream/types.h
notify.o: ../../pikotools/textstream/textstream.h
notify.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
notify.o: ../../pikotools/convert/convert.h
notify.o: ../../pikotools/convert/inttostr.h
notify.o: ../../pikotools/membuffer/membuffer.h
notify.o: ../../pikotools/textstream/types.h ../../winix/templates/patterns.h
notify.o: ../../winix/templates/locale.h ../../winix/templates/localefilter.h
notify.o: ../../ezc/src/ezc.h ../../ezc/src/generator.h
notify.o: ../../ezc/src/blocks.h ../../ezc/src/item.h ../../ezc/src/cache.h
notify.o: ../../ezc/src/functions.h ../../pikotools/utf8/utf8.h
notify.o: ../../ezc/src/funinfo.h ../../ezc/src/objects.h
notify.o: ../../ezc/src/pattern.h ../../ezc/src/outstreams.h
notify.o: ../../ezc/src/patternparser.h ../../winix/templates/misc.h
notify.o: ../../winix/templates/htmltextstream.h
notify.o: ../../winix/core/textstream.h notifythread.h
notify.o: ../../winix/core/basethread.h ../../winix/core/synchro.h
notify.o: templatesnotify.h ../../winix/core/config.h
notify.o: ../../winix/core/htmlfilter.h ../../winix/core/users.h
notify.o: ../../winix/core/user.h ../../winix/core/ugcontainer.h
notify.o: ../../winix/core/log.h ../../winix/core/textstream.h
notify.o: ../../winix/core/logmanipulators.h ../../winix/core/slog.h
notify.o: ../../winix/core/cur.h ../../winix/core/request.h
notify.o: ../../winix/core/requesttypes.h ../../winix/core/error.h
notify.o: ../../winix/core/config.h ../../winix/templates/htmltextstream.h
notify.o: ../../pikotools/space/spacetojson.h ../../winix/core/session.h
notify.o: ../../winix/core/plugindata.h ../../winix/core/rebus.h
notify.o: ../../winix/core/ipban.h ../../winix/core/mount.h
notify.o: ../../winix/core/lastcontainer.h ../../winix/db/db.h
notify.o: ../../winix/db/dbbase.h ../../winix/db/dbconn.h
notify.o: ../../winix/db/dbtextstream.h ../../winix/core/error.h
notify.o: ../../winix/db/dbitemquery.h ../../winix/core/item.h
notify.o: ../../winix/db/dbitemcolumns.h ../../winix/core/user.h
notify.o: ../../winix/core/group.h ../../winix/core/dircontainer.h
notify.o: ../../winix/core/ugcontainer.h ../../winix/templates/templates.h
notify.o: ../../winix/templates/patterncacher.h
notify.o: ../../winix/templates/indexpatterns.h
notify.o: ../../winix/templates/patterns.h
notify.o: ../../winix/templates/changepatterns.h ../../winix/core/cur.h
notify.o: ../../winix/core/system.h ../../winix/core/job.h
notify.o: ../../winix/core/basethread.h ../../winix/core/dirs.h
notify.o: ../../winix/core/dircontainer.h ../../winix/notify/notify.h
notify.o: ../../winix/core/mounts.h ../../winix/core/mountparser.h
notify.o: ../../winix/core/crypt.h ../../winix/core/run.h
notify.o: ../../winix/core/users.h ../../winix/core/groups.h
notify.o: ../../winix/core/group.h ../../winix/core/loadavg.h
notify.o: ../../winix/core/image.h ../../winix/core/threadmanager.h
notify.o: ../../winix/core/timezones.h ../../winix/core/timezone.h
notify.o: ../../winix/core/sessionmanager.h
notify.o: ../../winix/core/sessioncontainer.h
notify.o: ../../winix/core/ipbancontainer.h ../../winix/core/system.h
notify.o: ../../winix/core/sessionidmanager.h ../../tito/src/base64.h
notify.o: ../../tito/src/aes.h ../../winix/core/htmlfilter.h
notify.o: ../../winix/core/request.h ../../winix/core/dirs.h
notify.o: ../../winix/core/plugin.h ../../winix/core/pluginmsg.h
notify.o: ../../winix/core/sessionmanager.h ../../winix/functions/functions.h
notify.o: ../../winix/functions/functionbase.h ../../winix/core/synchro.h
notify.o: ../../winix/functions/functionparser.h
notify.o: ../../winix/functions/account.h ../../winix/functions/adduser.h
notify.o: ../../winix/functions/cat.h ../../winix/functions/chmod.h
notify.o: ../../winix/functions/privchanger.h ../../winix/functions/chown.h
notify.o: ../../winix/functions/ckeditor.h ../../winix/functions/cp.h
notify.o: ../../winix/functions/default.h ../../winix/functions/download.h
notify.o: ../../winix/functions/emacs.h ../../winix/functions/env.h
notify.o: ../../winix/functions/imgcrop.h ../../winix/functions/last.h
notify.o: ../../winix/functions/login.h ../../winix/functions/logout.h
notify.o: ../../winix/functions/ln.h ../../winix/functions/ls.h
notify.o: ../../winix/functions/man.h ../../winix/functions/meta.h
notify.o: ../../winix/functions/mkdir.h ../../winix/functions/mv.h
notify.o: ../../winix/functions/nicedit.h ../../winix/functions/node.h
notify.o: ../../winix/functions/passwd.h ../../winix/functions/priv.h
notify.o: ../../winix/functions/pw.h ../../winix/functions/reload.h
notify.o: ../../winix/functions/rm.h ../../winix/functions/rmuser.h
notify.o: ../../winix/functions/sort.h ../../winix/functions/specialdefault.h
notify.o: ../../winix/functions/stat.h ../../winix/functions/subject.h
notify.o: ../../winix/functions/template.h ../../winix/functions/tinymce.h
notify.o: ../../winix/functions/uname.h ../../winix/functions/upload.h
notify.o: ../../winix/functions/uptime.h ../../winix/functions/who.h
notify.o: ../../winix/functions/vim.h
notifypool.o: notifypool.h ../../winix/templates/locale.h
notifypool.o: ../../pikotools/space/spaceparser.h
notifypool.o: ../../pikotools/space/space.h
notifypool.o: ../../pikotools/textstream/types.h
notifypool.o: ../../pikotools/textstream/textstream.h
notifypool.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
notifypool.o: ../../pikotools/convert/convert.h
notifypool.o: ../../pikotools/convert/inttostr.h
notifypool.o: ../../pikotools/membuffer/membuffer.h
notifypool.o: ../../pikotools/textstream/types.h
notifythread.o: notifythread.h ../../winix/core/basethread.h
notifythread.o: ../../winix/core/synchro.h templatesnotify.h
notifythread.o: ../../ezc/src/ezc.h ../../ezc/src/generator.h
notifythread.o: ../../ezc/src/blocks.h ../../ezc/src/item.h
notifythread.o: ../../ezc/src/cache.h ../../ezc/src/functions.h
notifythread.o: ../../pikotools/utf8/utf8.h ../../ezc/src/funinfo.h
notifythread.o: ../../ezc/src/objects.h ../../ezc/src/pattern.h
notifythread.o: ../../ezc/src/outstreams.h ../../ezc/src/patternparser.h
notifythread.o: ../../winix/core/textstream.h ../../winix/templates/misc.h
notifythread.o: ../../winix/templates/localefilter.h
notifythread.o: ../../winix/templates/locale.h
notifythread.o: ../../winix/templates/htmltextstream.h
notifythread.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
notifythread.o: ../../pikotools/textstream/textstream.h
notifythread.o: ../../pikotools/convert/convert.h
notifythread.o: ../../pikotools/convert/inttostr.h
notifythread.o: ../../pikotools/membuffer/membuffer.h
notifythread.o: ../../pikotools/textstream/types.h notifypool.h
notifythread.o: ../../winix/templates/locale.h
notifythread.o: ../../pikotools/space/spaceparser.h
notifythread.o: ../../pikotools/space/space.h
notifythread.o: ../../pikotools/textstream/types.h ../../winix/core/config.h
notifythread.o: ../../winix/core/htmlfilter.h ../../winix/core/users.h
notifythread.o: ../../winix/core/user.h ../../winix/core/ugcontainer.h
notifythread.o: ../../winix/core/log.h ../../winix/core/textstream.h
notifythread.o: ../../winix/core/logmanipulators.h ../../winix/core/slog.h
notifythread.o: ../../winix/core/cur.h ../../winix/core/request.h
notifythread.o: ../../winix/core/requesttypes.h ../../winix/core/error.h
notifythread.o: ../../winix/core/config.h
notifythread.o: ../../winix/templates/htmltextstream.h
notifythread.o: ../../pikotools/space/spacetojson.h
notifythread.o: ../../winix/core/session.h ../../winix/core/plugindata.h
notifythread.o: ../../winix/core/rebus.h ../../winix/core/ipban.h
notifythread.o: ../../winix/core/mount.h ../../winix/core/lastcontainer.h
notifythread.o: ../../winix/db/db.h ../../winix/db/dbbase.h
notifythread.o: ../../winix/db/dbconn.h ../../winix/db/dbtextstream.h
notifythread.o: ../../winix/core/error.h ../../winix/db/dbitemquery.h
notifythread.o: ../../winix/core/item.h ../../winix/db/dbitemcolumns.h
notifythread.o: ../../winix/core/user.h ../../winix/core/group.h
notifythread.o: ../../winix/core/dircontainer.h
notifythread.o: ../../winix/core/ugcontainer.h
notifythread.o: ../../winix/templates/patterns.h
templatesnotify.o: templatesnotify.h ../../ezc/src/ezc.h
templatesnotify.o: ../../ezc/src/generator.h ../../ezc/src/blocks.h
templatesnotify.o: ../../ezc/src/item.h ../../ezc/src/cache.h
templatesnotify.o: ../../ezc/src/functions.h ../../pikotools/utf8/utf8.h
templatesnotify.o: ../../ezc/src/funinfo.h ../../ezc/src/objects.h
templatesnotify.o: ../../ezc/src/pattern.h ../../ezc/src/outstreams.h
templatesnotify.o: ../../ezc/src/patternparser.h
templatesnotify.o: ../../winix/core/textstream.h ../../winix/templates/misc.h
templatesnotify.o: ../../winix/templates/localefilter.h
templatesnotify.o: ../../winix/templates/locale.h
templatesnotify.o: ../../winix/templates/htmltextstream.h
templatesnotify.o: ../../pikotools/space/space.h ../../pikotools/date/date.h
templatesnotify.o: ../../pikotools/textstream/textstream.h
templatesnotify.o: ../../pikotools/convert/convert.h
templatesnotify.o: ../../pikotools/convert/inttostr.h
templatesnotify.o: ../../pikotools/membuffer/membuffer.h
templatesnotify.o: ../../pikotools/textstream/types.h notifypool.h
templatesnotify.o: ../../winix/templates/locale.h
templatesnotify.o: ../../pikotools/space/spaceparser.h
templatesnotify.o: ../../pikotools/space/space.h
templatesnotify.o: ../../pikotools/textstream/types.h
templatesnotify.o: ../../winix/core/plugin.h ../../winix/core/pluginmsg.h
templatesnotify.o: ../../winix/core/log.h ../../winix/core/textstream.h
templatesnotify.o: ../../winix/core/logmanipulators.h ../../winix/core/slog.h
templatesnotify.o: ../../winix/core/cur.h ../../winix/core/request.h
templatesnotify.o: ../../winix/core/requesttypes.h ../../winix/core/error.h
templatesnotify.o: ../../winix/core/config.h
templatesnotify.o: ../../winix/templates/htmltextstream.h
templatesnotify.o: ../../pikotools/space/spacetojson.h
templatesnotify.o: ../../winix/core/session.h ../../winix/core/user.h
templatesnotify.o: ../../winix/core/plugindata.h ../../winix/core/rebus.h
templatesnotify.o: ../../winix/core/ipban.h ../../winix/core/mount.h
templatesnotify.o: ../../winix/core/system.h
templatesnotify.o: ../../winix/core/sessionmanager.h
templatesnotify.o: ../../winix/core/synchro.h
templatesnotify.o: ../../winix/functions/functions.h
templatesnotify.o: ../../winix/functions/functionbase.h
templatesnotify.o: ../../winix/core/item.h ../../winix/db/db.h
templatesnotify.o: ../../winix/db/dbbase.h ../../winix/db/dbconn.h
templatesnotify.o: ../../winix/db/dbtextstream.h ../../winix/core/error.h
templatesnotify.o: ../../winix/db/dbitemquery.h
templatesnotify.o: ../../winix/db/dbitemcolumns.h ../../winix/core/user.h
templatesnotify.o: ../../winix/core/group.h ../../winix/core/dircontainer.h
templatesnotify.o: ../../winix/core/ugcontainer.h ../../winix/core/request.h
templatesnotify.o: ../../winix/core/config.h ../../winix/core/htmlfilter.h
templatesnotify.o: ../../winix/core/system.h ../../winix/core/job.h
templatesnotify.o: ../../winix/core/basethread.h ../../winix/core/dirs.h
templatesnotify.o: ../../winix/core/dircontainer.h
templatesnotify.o: ../../winix/notify/notify.h ../../winix/core/mounts.h
templatesnotify.o: ../../winix/core/mountparser.h ../../winix/core/crypt.h
templatesnotify.o: ../../winix/core/run.h ../../winix/core/users.h
templatesnotify.o: ../../winix/core/groups.h ../../winix/core/group.h
templatesnotify.o: ../../winix/core/ugcontainer.h ../../winix/core/loadavg.h
templatesnotify.o: ../../winix/core/image.h ../../winix/core/threadmanager.h
templatesnotify.o: ../../winix/core/timezones.h ../../winix/core/timezone.h
templatesnotify.o: ../../winix/core/synchro.h
templatesnotify.o: ../../winix/functions/functionparser.h
templatesnotify.o: ../../winix/core/cur.h ../../winix/functions/account.h
templatesnotify.o: ../../winix/functions/adduser.h
templatesnotify.o: ../../winix/functions/cat.h ../../winix/functions/chmod.h
templatesnotify.o: ../../winix/functions/privchanger.h
templatesnotify.o: ../../winix/functions/chown.h
templatesnotify.o: ../../winix/functions/ckeditor.h
templatesnotify.o: ../../winix/functions/cp.h ../../winix/functions/default.h
templatesnotify.o: ../../winix/functions/download.h
templatesnotify.o: ../../winix/functions/emacs.h ../../winix/functions/env.h
templatesnotify.o: ../../winix/functions/imgcrop.h
templatesnotify.o: ../../winix/functions/last.h ../../winix/functions/login.h
templatesnotify.o: ../../winix/functions/logout.h ../../winix/functions/ln.h
templatesnotify.o: ../../winix/functions/ls.h ../../winix/functions/man.h
templatesnotify.o: ../../winix/functions/meta.h ../../winix/functions/mkdir.h
templatesnotify.o: ../../winix/functions/mv.h ../../winix/functions/nicedit.h
templatesnotify.o: ../../winix/functions/node.h
templatesnotify.o: ../../winix/functions/passwd.h
templatesnotify.o: ../../winix/functions/priv.h ../../winix/functions/pw.h
templatesnotify.o: ../../winix/functions/reload.h ../../winix/functions/rm.h
templatesnotify.o: ../../winix/functions/rmuser.h
templatesnotify.o: ../../winix/functions/sort.h
templatesnotify.o: ../../winix/functions/specialdefault.h
templatesnotify.o: ../../winix/functions/stat.h
templatesnotify.o: ../../winix/functions/subject.h
templatesnotify.o: ../../winix/functions/template.h
templatesnotify.o: ../../winix/functions/tinymce.h
templatesnotify.o: ../../winix/functions/uname.h
templatesnotify.o: ../../winix/functions/upload.h
templatesnotify.o: ../../winix/functions/uptime.h ../../winix/functions/who.h
templatesnotify.o: ../../winix/functions/vim.h ../../winix/core/htmlfilter.h
templatesnotify.o: ../../winix/templates/templates.h
templatesnotify.o: ../../winix/templates/patterncacher.h
templatesnotify.o: ../../winix/templates/indexpatterns.h
templatesnotify.o: ../../winix/templates/patterns.h
templatesnotify.o: ../../winix/templates/changepatterns.h
templatesnotify.o: ../../winix/core/sessionmanager.h
templatesnotify.o: ../../winix/core/sessioncontainer.h
templatesnotify.o: ../../winix/core/ipbancontainer.h
templatesnotify.o: ../../winix/core/lastcontainer.h
templatesnotify.o: ../../winix/core/sessionidmanager.h
templatesnotify.o: ../../tito/src/base64.h ../../tito/src/aes.h
templatesnotify.o: ../../winix/core/misc.h ../../winix/core/winix_const.h

View File

@@ -0,0 +1 @@
o = notify.o notifypool.o notifythread.o templatesnotify.o

226
winixd/notify/notify.cpp Normal file
View File

@@ -0,0 +1,226 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2008-2014, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "notify.h"
#include "templates/templates.h"
#include "core/request.h"
#include "core/config.h"
#include "core/users.h"
#include "core/dirs.h"
#include "core/plugin.h"
namespace Winix
{
Notify::Notify()
{
}
void Notify::SetCur(Cur * pcur)
{
cur = pcur;
}
void Notify::SetConfig(Config * pconfig)
{
config = pconfig;
}
void Notify::SetUsers(Users * pusers)
{
users = pusers;
}
void Notify::SetDirs(Dirs * pdirs)
{
dirs = pdirs;
}
void Notify::SetThreadManager(ThreadManager * pmanager)
{
thread_manager = pmanager;
}
void Notify::Init()
{
notify_thread.SetConfig(config);
notify_thread.SetUsers(users);
notify_thread.SetNotifyPool(&notify_pool);
notify_thread.SetPatterns(&patterns);
thread_manager->Add(&notify_thread, L"notifications");
patterns.SetDirectories(config->txt_templates_dir, config->txt_templates_dir_default);
patterns.SetLocale(&TemplatesFunctions::locale);
patterns.SetLocaleFilter(&TemplatesFunctions::locale_filter);
notify_template_cms = AddTemplate(L"notify_email_cms.txt");
notify_template_activate_account = AddTemplate(L"notify_confirm_account.txt");
notify_template_reset_password = AddTemplate(L"notify_reset_password.txt");
plugin.Call((Session*)0, WINIX_NOTIFY_ADD_TEMPLATE);
}
void Notify::ReadTemplates()
{
patterns.Reload();
notify_thread.PatternsChanged();
}
void Notify::ItemChanged(int notify_code, const Item & item)
{
if( notify_code == 0 )
return;
msg.Clear();
msg.code = notify_code;
msg.template_index = notify_template_cms;
CreateItemLink(item, msg.item_link, msg.dir_link);
ItemChanged(msg);
}
// raw form
void Notify::ItemChanged(const NotifyMsg & msg)
{
notify_pool.Add(msg);
notify_thread.WakeUpThread(); // we are in the first locked thread
}
void Notify::ActivateAccount(const std::wstring & name, const std::wstring & email, long code)
{
msg.Clear();
msg.code = WINIX_NOTIFY_CODE_CONFIRM_ACCOUNT;
msg.name = name;
msg.email = email;
msg.lang = config->locale_default_id;
msg.activate_code = code;
msg.template_index = notify_template_activate_account;
CreateActivateLink(name, code, msg.item_link);
notify_pool.Add(msg);
notify_thread.WakeUpThread(); // we are in the first locked thread
}
void Notify::ResetPassword(const std::wstring & name, const std::wstring & email, long code)
{
msg.Clear();
msg.code = WINIX_NOTIFY_CODE_RESET_PASSWORD;
msg.name = name;
msg.email = email;
msg.lang = config->locale_default_id; // !! IMPROVE ME a better language can be chose (the same as the user has)
msg.activate_code = code;
msg.template_index = notify_template_reset_password;
CreateResetPasswordLink(name, code, msg.item_link);
notify_pool.Add(msg);
notify_thread.WakeUpThread(); // we are in the first locked thread
}
size_t Notify::AddTemplate(const std::wstring & file_name)
{
return patterns.Add(file_name, false);
}
void Notify::CreateItemLink(const Item & item, std::wstring & item_link, std::wstring & dir_link)
{
tmp_path.clear();
if( item.type == Item::dir )
{
dirs->MakePath(item.id, tmp_path);
item_link = config->url_proto;
item_link += config->base_url; // !! IMPROVE ME what about subdomains?
item_link += tmp_path;
dir_link = item_link;
}
else
{
dirs->MakePath(item.parent_id, tmp_path);
item_link = config->url_proto;
item_link += config->base_url; // !! IMPROVE ME what about subdomains?
item_link += tmp_path;
dir_link = item_link;
item_link += item.url;
}
}
void Notify::CreateActivateLink(const std::wstring & name, long code, std::wstring & link)
{
wchar_t buff[50];
link = config->url_proto;
link += config->base_url;// !! IMPROVE ME what about subdomains?
link += L"/account/activate/login:";
UrlEncode(name, link, false);
link += L"/code:";
Toa(code, buff, sizeof(buff)/sizeof(wchar_t));
link += buff;
}
void Notify::CreateResetPasswordLink(const std::wstring & name, long code, std::wstring & link)
{
wchar_t buff[50];
link = config->url_proto;
link += config->base_url;// !! IMPROVE ME what about subdomains?
link += L"/passwd/resetpassword/login:";
UrlEncode(name, link, false);
link += L"/code:";
Toa(code, buff, sizeof(buff)/sizeof(wchar_t));
link += buff;
}
} // namespace Winix

106
winixd/notify/notify.h Normal file
View File

@@ -0,0 +1,106 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef headerfile_winix_notify_notify
#define headerfile_winix_notify_notify
#include <vector>
#include <string>
#include "notifypool.h"
#include "templates/patterns.h"
#include "notifythread.h"
namespace Winix
{
struct Request;
class Config;
class Users;
class Dirs;
class ThreadManager;
class Notify
{
public:
Notify();
void SetCur(Cur * pcur);
void SetConfig(Config * pconfig);
void SetUsers(Users * pusers);
void SetDirs(Dirs * pdirs);
void SetThreadManager(ThreadManager * pmanager);
void Init();
size_t AddTemplate(const std::wstring & file_name);
void ReadTemplates();
void ItemChanged(int notify_code, const Item & item);
void ItemChanged(const NotifyMsg & msg);
void ActivateAccount(const std::wstring & name, const std::wstring & email, long code);
void ResetPassword(const std::wstring & name, const std::wstring & email, long code);
private:
Cur * cur;
Config * config;
Dirs * dirs;
Users * users;
ThreadManager * thread_manager;
NotifyThread notify_thread;
NotifyMsg msg;
NotifyPool notify_pool;
std::wstring tmp_path;
size_t notify_template_cms;
size_t notify_template_activate_account;
size_t notify_template_reset_password;
Patterns patterns;
void CreateItemLink(const Item & item, std::wstring & link, std::wstring & dir_link);
void CreateActivateLink(const std::wstring & name, long code, std::wstring & link);
void CreateResetPasswordLink(const std::wstring & name, long code, std::wstring & link);
};
} // namespace Winix
#endif

View File

@@ -0,0 +1,75 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "notifypool.h"
namespace Winix
{
bool NotifyPool::Empty() const
{
return notify_pool.empty();
}
size_t NotifyPool::Size() const
{
return notify_pool.size(); // it has O(n)
}
NotifyMsg & NotifyPool::GetFirst()
{
return *notify_pool.begin();
}
void NotifyPool::DeleteFirst()
{
if( notify_pool.empty() )
return;
notify_pool.erase(notify_pool.begin());
}
void NotifyPool::Add(const NotifyMsg & msg)
{
notify_pool.insert(notify_pool.end(), msg);
}
} // namespace Winix

123
winixd/notify/notifypool.h Normal file
View File

@@ -0,0 +1,123 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2010-2014, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef headerfile_winix_notify_notifypool
#define headerfile_winix_notify_notifypool
#include <list>
#include <string>
#include "templates/locale.h"
namespace Winix
{
#define WINIX_NOTIFY_CODE_ADD 1
#define WINIX_NOTIFY_CODE_EDIT 2
#define WINIX_NOTIFY_CODE_DELETE 4
#define WINIX_NOTIFY_CODE_REPLY 8
#define WINIX_NOTIFY_CODE_CONFIRM_ACCOUNT 16
#define WINIX_NOTIFY_CODE_RESET_PASSWORD 32
// !! IMPROVE ME
// may now we can use PT::Space instead of NotifyMsg?
struct NotifyMsg
{
int code;
std::wstring item_link; // link to a file or a dir (can be the same as dir_link if the item is a directory)
std::wstring dir_link; // link to a dir
size_t template_index;
// used in account activations
// we send one email directly to one user
std::wstring email;
std::wstring name;
size_t lang;
long activate_code;
NotifyMsg()
{
Clear();
}
void Clear()
{
code = -1;
item_link.clear();
dir_link.clear();
template_index = 0;
email.clear();
name.clear();
lang = 0;
activate_code = 0;
}
};
// used by the second thread (and its templates)
struct NotifyUserMsg
{
std::wstring name;
std::wstring email;
size_t lang; // locale id (not an index)
};
class NotifyPool
{
public:
bool Empty() const;
size_t Size() const;
NotifyMsg & GetFirst();
void DeleteFirst();
void Add(const NotifyMsg & msg);
private:
std::list<NotifyMsg> notify_pool;
};
} // namespace Winix
#endif

View File

@@ -0,0 +1,301 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2008-2014, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "notifythread.h"
namespace Winix
{
// first thread (objects are locked)
NotifyThread::NotifyThread()
{
patterns_changed = true;
}
// first thread (objects are locked)
void NotifyThread::SetConfig(Config * pconfig)
{
config = pconfig;
}
// first thread (objects are locked)
void NotifyThread::SetUsers(Users * pusers)
{
users = pusers;
}
// first thread (objects are locked)
void NotifyThread::SetNotifyPool(NotifyPool * pool)
{
notify_pool = pool;
}
// first thread (objects are locked)
void NotifyThread::SetPatterns(Patterns * pat)
{
pat_global = pat;
}
// first thread (objects are locked)
void NotifyThread::PatternsChanged()
{
patterns_changed = true;
}
// first thread (objects are locked)
bool NotifyThread::Init()
{
TemplatesNotifyFunctions::CreateFunctions();
return true;
}
// first thread (objects are locked)
bool NotifyThread::SignalReceived()
{
if( patterns_changed )
{
patterns = *pat_global;
patterns_changed = false;
}
return !notify_pool->Empty();
}
// second thread (objects are not locked)
// return true if there is something to send from the first queue (notify_pool)
bool NotifyThread::AddNextNotify()
{
Users::Iterator i;
bool res = false;
Lock();
if( !notify_pool->Empty() )
{
TemplatesNotifyFunctions::notify_msg = notify_pool->GetFirst();
notify_pool->DeleteFirst();
if( TemplatesNotifyFunctions::notify_msg.code == WINIX_NOTIFY_CODE_CONFIRM_ACCOUNT ||
TemplatesNotifyFunctions::notify_msg.code == WINIX_NOTIFY_CODE_RESET_PASSWORD )
{
msg.email = TemplatesNotifyFunctions::notify_msg.email;
msg.name = TemplatesNotifyFunctions::notify_msg.name;
msg.lang = TemplatesNotifyFunctions::notify_msg.lang;
notify_user.push_back(msg);
res = true;
}
else
{
for(i=users->Begin() ; i != users->End() ; ++i)
{
if( (i->notify & TemplatesNotifyFunctions::notify_msg.code) != 0 )
{
msg.name = i->name;
msg.email = i->email;
msg.lang = config->locale_default_id; // !! IMPROVE ME bedzie osobno dla kazdego uzytkownika
notify_user.push_back(msg);
res = true;
}
}
}
}
Unlock();
return res;
}
// second thread -- here we must use Lock() and Unlock() explicitly
void NotifyThread::Do()
{
NotifyUser::iterator i;
bool queue_end;
while( AddNextNotify() )
{
Lock();
i = notify_user.begin();
queue_end = notify_user.empty();
Unlock();
while( !queue_end )
{
Lock();
TemplatesNotifyFunctions::notify_user_msg = *i;
log << log3 << "NotifyThread: sending notification to: " << i->name << ", email: " << i->email << logend;
Unlock();
SendMail();
Lock();
WaitForSignalSleep(2); // automatically unlock and lock again when returns
bool stop = synchro->was_stop_signal;
Unlock();
if( stop )
return;
Lock();
notify_user.erase(i++);
queue_end = (i == notify_user.end());
Unlock();
}
}
}
// second thread
void NotifyThread::SendMail()
{
notify_stream.Clear();
size_t lang_id = TemplatesNotifyFunctions::notify_user_msg.lang;
size_t template_index = TemplatesNotifyFunctions::notify_msg.template_index;
Lock();
// 'patterns' object can use logger or other stuff so we use Lock() before
Ezc::Pattern * pat = patterns.Get(template_index, lang_id);
if( !pat )
log << log1 << "NotifyThread: I don't have a template with index: " << template_index
<< " and locale id: " << lang_id << logend;
Unlock();
if( pat )
{
generator.RecognizeSpecialChars(true);
generator.TrimWhite(true);
generator.SkipNewLine(true);
generator.SetFunctions(TemplatesNotifyFunctions::ezc_functions);
generator.SetPattern(*pat);
/*
* don't use cache
* 'pat' pattern is stored in 'patterns' object for all templates and by default
* all functions/blocks are cached, but we are in a second thread
* and cannot use such functions without locking
*
* IMPROVE ME
* blocks are parsed to the container from the main thread
* and we cannot just use it here (another thread)
* so may should we have our own 'patterns' object here?
*
*/
generator.CanUseCache(false);
generator.Generate(notify_stream);
SendMail(TemplatesNotifyFunctions::notify_user_msg.email, notify_stream.Str());
}
}
// second thread
void NotifyThread::SendMail(const std::wstring & email, const std::wstring & message)
{
nlog << log1 << PT::Date(std::time(0)) << ' ';
if( !ValidateEmail(email) )
{
nlog << log1 << "NotifyThread: email adress: " << email << " is not correct" << logend;
return;
}
sendmail_command = "sendmail ";
PT::WideToUTF8(email, sendmail_command, false);
FILE * sendmail = popen(sendmail_command.c_str(), "w");
if( !sendmail )
{
nlog << log1 << "NotifyThread: can't run sendmail" << logend;
return;
}
SendMail(sendmail, message);
pclose(sendmail);
nlog << log1 << "NotifyThread: email to: " << email << " has been sent" << logend << logsave;
}
// second thread
void NotifyThread::SendMail(FILE * sendmail, const std::wstring & message)
{
char buf[10];
size_t len;
for(size_t i=0 ; i<message.length() ; ++i)
{
if( message[i] == '\n' )
{
fprintf(sendmail, "\r\n");
}
else
{
len = PT::IntToUTF8(int(message[i]), buf, sizeof(buf) / sizeof(char));
for(size_t a=0 ; a<len ; ++a)
fputc(buf[a], sendmail);
}
}
}
} // namespace Winix

View File

@@ -0,0 +1,93 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2008-2014, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef headerfile_winix_notify_notifythread
#define headerfile_winix_notify_notifythread
#include "core/basethread.h"
#include "templatesnotify.h"
#include "ezc.h"
#include "core/config.h"
#include "core/users.h"
#include "templates/patterns.h"
namespace Winix
{
// 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(Patterns * pat);
void PatternsChanged();
private:
Config * config;
Users * users;
NotifyPool * notify_pool;
Patterns * pat_global;
NotifyUserMsg msg;
typedef std::list<NotifyUserMsg> NotifyUser;
NotifyUser notify_user;
std::string sendmail_command;
bool patterns_changed;
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);
};
} // namespace Winix
#endif

View File

@@ -0,0 +1,150 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2008-2014, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "templatesnotify.h"
#include "core/plugin.h"
#include "core/misc.h"
namespace Winix
{
namespace TemplatesNotifyFunctions
{
Ezc::Functions<NotifyStream> ezc_functions;
// you can use this pointer in template functions (will be always valid)
NotifyUserMsg notify_user_msg;
NotifyMsg notify_msg;
static std::string qencode_tmp;
void fil_qencode(Info & i)
{
// QEncode can be used in other threads
QEncode(i.in.Str(), qencode_tmp);
i.out << qencode_tmp;
}
void notify_add(Info & i)
{
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_ADD) != 0;
}
void notify_edit(Info & i)
{
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_EDIT) != 0;
}
void notify_delete(Info & i)
{
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_DELETE) != 0;
}
void notify_reply(Info & i)
{
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_REPLY) != 0;
}
void notify_to_email(Info & i)
{
i.out << notify_user_msg.email;
}
void notify_to_name(Info & i)
{
i.out << notify_user_msg.name;
}
void notify_item_link(Info & i)
{
i.out << notify_msg.item_link;
}
void notify_dir_link(Info & i)
{
i.out << notify_msg.dir_link;
}
void CreateFunctions()
{
ezc_functions.Clear();
ezc_functions.Insert("fil_qencode", fil_qencode);
/*
* IMPROVE ME
* now we are able to read from a Space struct and these functions can be removed
* and we can use directly a Space struct
* (copy those functions here from normal templates)
*/
ezc_functions.Insert("notify_add", notify_add);
ezc_functions.Insert("notify_edit", notify_edit);
ezc_functions.Insert("notify_delete", notify_delete);
ezc_functions.Insert("notify_reply", notify_reply);
ezc_functions.Insert("notify_to_email", notify_to_email);
ezc_functions.Insert("notify_to_name", notify_to_name);
ezc_functions.Insert("notify_item_link", notify_item_link);
ezc_functions.Insert("notify_dir_link", notify_dir_link);
plugin.Call((Session*)0, WINIX_NOTIFY_TEMPLATES_CREATEFUNCTIONS, &ezc_functions);
}
} // namespace TemplatesNotifyFunctions
} // namespace Winix

View File

@@ -0,0 +1,62 @@
/*
* This file is a part of Winix
* and is distributed under the 2-Clause BSD licence.
* Author: Tomasz Sowa <t.sowa@ttmath.org>
*/
/*
* Copyright (c) 2008-2014, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef headerfile_winix_notify_templatesnotify
#define headerfile_winix_notify_templatesnotify
#include "ezc.h"
#include "core/textstream.h"
#include "notifypool.h"
namespace Winix
{
namespace TemplatesNotifyFunctions
{
typedef TextStream<std::wstring> NotifyStream;
typedef Ezc::FunInfo<NotifyStream> Info;
extern NotifyUserMsg notify_user_msg;
extern NotifyMsg notify_msg;
extern Ezc::Functions<NotifyStream> ezc_functions;
void CreateFunctions();
}
} // namespace Winix
#endif