2009-10-01 00:31:20 +02:00
|
|
|
/*
|
2010-02-28 01:08:10 +01:00
|
|
|
* This file is a part of Winix
|
2009-10-01 00:31:20 +02:00
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2012-02-28 22:09:44 +01:00
|
|
|
* Copyright (c) 2008-2012, Tomasz Sowa
|
2009-10-01 00:31:20 +02:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "templatesnotify.h"
|
2010-12-06 01:25:46 +01:00
|
|
|
#include "core/plugin.h"
|
2011-01-25 12:54:46 +01:00
|
|
|
#include "core/misc.h"
|
2009-10-01 00:31:20 +02:00
|
|
|
|
|
|
|
|
2010-09-13 01:33:27 +02:00
|
|
|
|
2009-10-01 00:31:20 +02:00
|
|
|
namespace TemplatesNotifyFunctions
|
|
|
|
{
|
2010-12-02 02:02:02 +01:00
|
|
|
Ezc::Functions<NotifyStream> ezc_functions;
|
2010-01-28 16:39:01 +01:00
|
|
|
|
2009-10-01 00:31:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
// you can use this pointer in template functions (will be always valid)
|
2010-12-02 02:02:02 +01:00
|
|
|
NotifyUserMsg notify_user_msg;
|
|
|
|
NotifyMsg notify_msg;
|
2009-10-01 00:31:20 +02:00
|
|
|
|
2011-01-26 13:45:38 +01:00
|
|
|
static std::string qencode_tmp;
|
2009-10-01 00:31:20 +02:00
|
|
|
|
|
|
|
|
2011-01-26 13:45:38 +01:00
|
|
|
void fil_qencode(Info & i)
|
2010-08-10 18:12:50 +02:00
|
|
|
{
|
2011-01-26 13:45:38 +01:00
|
|
|
// QEncode can be used in other threads
|
|
|
|
QEncode(i.in.Str(), qencode_tmp);
|
|
|
|
i.out << qencode_tmp;
|
2010-08-10 18:12:50 +02:00
|
|
|
}
|
|
|
|
|
2010-12-02 02:02:02 +01:00
|
|
|
|
|
|
|
|
2011-01-26 13:45:38 +01:00
|
|
|
void notify_add(Info & i)
|
2010-09-13 01:33:27 +02:00
|
|
|
{
|
2011-01-26 13:45:38 +01:00
|
|
|
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_ADD) != 0;
|
2010-09-13 01:33:27 +02:00
|
|
|
}
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2009-10-01 00:31:20 +02:00
|
|
|
|
|
|
|
|
2011-01-26 13:45:38 +01:00
|
|
|
void notify_edit(Info & i)
|
2009-10-01 00:31:20 +02:00
|
|
|
{
|
2011-01-26 13:45:38 +01:00
|
|
|
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_EDIT) != 0;
|
2010-12-02 02:02:02 +01:00
|
|
|
}
|
|
|
|
|
2010-09-13 01:33:27 +02:00
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2011-01-26 13:45:38 +01:00
|
|
|
void notify_delete(Info & i)
|
2010-12-02 02:02:02 +01:00
|
|
|
{
|
2011-01-26 13:45:38 +01:00
|
|
|
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_DELETE) != 0;
|
2009-10-01 00:31:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-26 13:45:38 +01:00
|
|
|
void notify_reply(Info & i)
|
2010-12-02 02:02:02 +01:00
|
|
|
{
|
2011-01-26 13:45:38 +01:00
|
|
|
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_REPLY) != 0;
|
2010-12-02 02:02:02 +01:00
|
|
|
}
|
2009-10-01 00:31:20 +02:00
|
|
|
|
|
|
|
|
2011-01-25 12:54:46 +01:00
|
|
|
void notify_to_email(Info & i)
|
2009-10-01 00:31:20 +02:00
|
|
|
{
|
2010-12-02 02:02:02 +01:00
|
|
|
i.out << notify_user_msg.email;
|
|
|
|
}
|
2009-10-01 00:31:20 +02:00
|
|
|
|
2010-01-28 16:39:01 +01:00
|
|
|
|
2011-01-25 12:54:46 +01:00
|
|
|
void notify_to_name(Info & i)
|
2010-12-02 02:02:02 +01:00
|
|
|
{
|
2011-01-26 13:45:38 +01:00
|
|
|
i.out << notify_user_msg.name;
|
2009-10-01 00:31:20 +02:00
|
|
|
}
|
2010-12-02 02:02:02 +01:00
|
|
|
|
2009-10-01 00:31:20 +02:00
|
|
|
|
2010-12-02 02:02:02 +01:00
|
|
|
void notify_item_link(Info & i)
|
|
|
|
{
|
|
|
|
i.out << notify_msg.item_link;
|
|
|
|
}
|
2009-10-01 00:31:20 +02:00
|
|
|
|
|
|
|
|
2010-12-02 02:02:02 +01:00
|
|
|
void notify_dir_link(Info & i)
|
2009-10-01 00:31:20 +02:00
|
|
|
{
|
2010-12-02 02:02:02 +01:00
|
|
|
i.out << notify_msg.dir_link;
|
2009-10-01 00:31:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-25 12:54:46 +01:00
|
|
|
|
|
|
|
|
2010-12-02 02:02:02 +01:00
|
|
|
void CreateFunctions()
|
2010-01-28 16:39:01 +01:00
|
|
|
{
|
2010-12-02 02:02:02 +01:00
|
|
|
ezc_functions.Clear();
|
|
|
|
|
2011-01-26 13:45:38 +01:00
|
|
|
ezc_functions.Insert("fil_qencode", fil_qencode);
|
2010-12-02 02:02:02 +01:00
|
|
|
|
2011-01-26 13:45:38 +01:00
|
|
|
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);
|
2010-12-02 02:02:02 +01:00
|
|
|
|
2011-01-26 13:45:38 +01:00
|
|
|
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);
|
2010-12-06 01:25:46 +01:00
|
|
|
|
2012-03-17 06:11:23 +01:00
|
|
|
plugin.Call((Session*)0, WINIX_NOTIFY_TEMPLATES_CREATEFUNCTIONS, &ezc_functions);
|
2010-01-28 16:39:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-12-02 02:02:02 +01:00
|
|
|
} // namespace TemplatesNotifyFunctions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-28 16:39:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|