133 lines
1.9 KiB
C++
Executable File
133 lines
1.9 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2008-2012, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#include "templatesnotify.h"
|
|
#include "core/plugin.h"
|
|
#include "core/misc.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;
|
|
|
|
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);
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|