winix/templatesnotify/templatesnotify.cpp

144 lines
2.3 KiB
C++
Executable File

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#include "templatesnotify.h"
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;
void notify_file_added(Info & i)
{
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_FILE_ADD) != 0;
}
void notify_file_edited(Info & i)
{
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_FILE_EDIT) != 0;
}
void notify_file_deleted(Info & i)
{
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_FILE_DELETE) != 0;
}
void notify_dir_added(Info & i)
{
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_DIR_ADD) != 0;
}
void notify_thread_added(Info & i)
{
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_THREAD_ADD) != 0;
}
void notify_thread_replayed(Info & i)
{
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_THREAD_REPLAYED) != 0;
}
void notify_thread_post_changed(Info & i)
{
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_THREAD_POST_CHANGED) != 0;
}
void notify_to(Info & i)
{
i.out << notify_user_msg.email;
}
/*
void notify_doc_base_url(Info & i)
{
i.out << notify_user_msg.doc_base_url;
}
*/
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("notify_file_added", notify_file_added);
ezc_functions.Insert("notify_file_edited", notify_file_edited);
ezc_functions.Insert("notify_file_deleted", notify_file_deleted);
ezc_functions.Insert("notify_dir_added", notify_dir_added);
ezc_functions.Insert("notify_thread_added", notify_thread_added);
ezc_functions.Insert("notify_thread_replayed", notify_thread_replayed);
ezc_functions.Insert("notify_thread_post_changed", notify_thread_post_changed);
ezc_functions.Insert("notify_to", notify_to);
//ezc_functions.Insert("notify_doc_base_url", notify_doc_base_url);
ezc_functions.Insert("notify_item_link", notify_item_link);
ezc_functions.Insert("notify_dir_link", notify_dir_link);
}
} // namespace TemplatesNotifyFunctions