added: winix uses now [filter] statement from ezc
added: notifications to threads (were temporarily disabled) changed: templates in notifications git-svn-id: svn://ttmath.org/publicrep/winix/trunk@712 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -64,8 +64,7 @@ void Notify::Init()
|
||||
notify_thread.SetPatterns(&patterns);
|
||||
notify_thread.SetSynchro(synchro);
|
||||
|
||||
notify_template_cms = AddTemplate(L"notify_email_cms.txt"); // !! do konfiga
|
||||
notify_template_thread = AddTemplate(L"notify_email_thread.txt");
|
||||
notify_template_cms = AddTemplate(L"notify_email_cms.txt");
|
||||
|
||||
plugin.Call(WINIX_NOTIFY_ADD_TEMPLATE);
|
||||
}
|
||||
@@ -109,19 +108,9 @@ void Notify::ItemChanged(int notify_code, const Item & item)
|
||||
return;
|
||||
|
||||
msg.code = notify_code;
|
||||
msg.template_index = notify_template_cms;
|
||||
CreateItemLink(item, msg.item_link, msg.dir_link);
|
||||
|
||||
if( msg.code >=0 && msg.code <= WINIX_NOTIFY_CODE_FILE_DELETE )
|
||||
msg.template_index = notify_template_cms;
|
||||
else
|
||||
if( msg.code >= WINIX_NOTIFY_CODE_THREAD_ADD && msg.code <= WINIX_NOTIFY_CODE_THREAD_DELETE )
|
||||
msg.template_index = notify_template_thread;
|
||||
else
|
||||
{
|
||||
log << log1 << "Notify: don't know what to do with this mount point (skipping)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
ItemChanged(msg);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@ private:
|
||||
NotifyPool notify_pool;
|
||||
|
||||
size_t notify_template_cms;
|
||||
size_t notify_template_thread;
|
||||
|
||||
// templates file names
|
||||
std::vector<std::wstring> templates_names;
|
||||
|
||||
@@ -15,33 +15,16 @@
|
||||
#include "templates/locale.h"
|
||||
|
||||
|
||||
|
||||
#define WINIX_NOTIFY_CODE_DIR_ADD 1
|
||||
#define WINIX_NOTIFY_CODE_DIR_EDIT 2
|
||||
#define WINIX_NOTIFY_CODE_DIR_DELETE 4
|
||||
|
||||
#define WINIX_NOTIFY_CODE_FILE_ADD 8
|
||||
#define WINIX_NOTIFY_CODE_FILE_EDIT 16
|
||||
#define WINIX_NOTIFY_CODE_FILE_DELETE 32
|
||||
|
||||
// new thread has been starded
|
||||
#define WINIX_NOTIFY_CODE_THREAD_ADD 64
|
||||
|
||||
// someone replayed in a thread
|
||||
#define WINIX_NOTIFY_CODE_THREAD_REPLAYED 128
|
||||
|
||||
// someone edited its post
|
||||
#define WINIX_NOTIFY_CODE_THREAD_POST_CHANGED 256
|
||||
|
||||
|
||||
#define WINIX_NOTIFY_CODE_THREAD_DELETE 512
|
||||
#define WINIX_NOTIFY_CODE_ADD 1
|
||||
#define WINIX_NOTIFY_CODE_EDIT 2
|
||||
#define WINIX_NOTIFY_CODE_DELETE 4
|
||||
#define WINIX_NOTIFY_CODE_REPLY 8
|
||||
|
||||
|
||||
|
||||
// additional codes, use it of your own
|
||||
// you should prepare NotifyMsg structure and use it with ItemChanged method of notify object
|
||||
// remember that from this code an appropirate user is selected (db->core->user notify value)
|
||||
// and ezc templates may behave differently
|
||||
/* temporarily not used
|
||||
#define WINIX_NOTIFY_CODE_USER1 1024
|
||||
#define WINIX_NOTIFY_CODE_USER2 2048
|
||||
#define WINIX_NOTIFY_CODE_USER3 4096
|
||||
@@ -50,7 +33,7 @@
|
||||
#define WINIX_NOTIFY_CODE_USER6 32768
|
||||
#define WINIX_NOTIFY_CODE_USER7 65536
|
||||
#define WINIX_NOTIFY_CODE_USER8 131072
|
||||
|
||||
*/
|
||||
|
||||
|
||||
struct NotifyMsg
|
||||
|
||||
@@ -23,56 +23,44 @@ Ezc::Functions<NotifyStream> ezc_functions;
|
||||
NotifyUserMsg notify_user_msg;
|
||||
NotifyMsg notify_msg;
|
||||
|
||||
// name in qencoding
|
||||
static std::string name_q;
|
||||
static std::string qencode_tmp;
|
||||
|
||||
|
||||
void notify_file_added(Info & i)
|
||||
void fil_qencode(Info & i)
|
||||
{
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_FILE_ADD) != 0;
|
||||
// QEncode can be used in other threads
|
||||
QEncode(i.in.Str(), qencode_tmp);
|
||||
i.out << qencode_tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void notify_file_edited(Info & i)
|
||||
void notify_add(Info & i)
|
||||
{
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_FILE_EDIT) != 0;
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_ADD) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void notify_file_deleted(Info & i)
|
||||
void notify_edit(Info & i)
|
||||
{
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_FILE_DELETE) != 0;
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_EDIT) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void notify_dir_added(Info & i)
|
||||
void notify_delete(Info & i)
|
||||
{
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_DIR_ADD) != 0;
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_DELETE) != 0;
|
||||
}
|
||||
|
||||
|
||||
void notify_thread_added(Info & i)
|
||||
void notify_reply(Info & i)
|
||||
{
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_THREAD_ADD) != 0;
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_REPLY) != 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_email(Info & i)
|
||||
{
|
||||
i.out << notify_user_msg.email;
|
||||
@@ -81,8 +69,7 @@ void notify_to_email(Info & i)
|
||||
|
||||
void notify_to_name(Info & i)
|
||||
{
|
||||
QEncode(notify_user_msg.name, name_q);
|
||||
i.out << name_q;
|
||||
i.out << notify_user_msg.name;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,19 +91,17 @@ 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("fil_qencode", fil_qencode);
|
||||
|
||||
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_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);
|
||||
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(WINIX_NOTIFY_TEMPLATES_CREATEFUNCTIONS, &ezc_functions);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user