'tickets' can use 'threads' now
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@706 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -8,32 +8,42 @@
|
||||
*/
|
||||
|
||||
#include "tdb.h"
|
||||
#include "reply.h"
|
||||
#include "funthread.h"
|
||||
#include "createthread.h"
|
||||
#include "showthreads.h"
|
||||
#include "core/log.h"
|
||||
#include "core/plugin.h"
|
||||
#include "pluginmsg.h"
|
||||
#include "templates.h"
|
||||
|
||||
|
||||
|
||||
extern "C" void Init(PluginInfo &);
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Thread
|
||||
{
|
||||
const wchar_t plugin_name[] = L"thread";
|
||||
|
||||
TDb tdb;
|
||||
ThreadInfo thread_info;
|
||||
TDb tdb;
|
||||
ThreadInfo thread_info;
|
||||
|
||||
Reply fun_reply;
|
||||
FunThread fun_thread;
|
||||
CreateThread fun_create_thread;
|
||||
ShowThreads fun_show_threads;
|
||||
|
||||
|
||||
|
||||
void AddFunctions(PluginInfo & info)
|
||||
{
|
||||
info.functions->Add(fun_reply);
|
||||
info.functions->Add(fun_thread);
|
||||
info.functions->Add(fun_create_thread);
|
||||
info.functions->Add(fun_show_threads);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,87 +63,104 @@ void AddMounts(PluginInfo & info)
|
||||
{
|
||||
Mounts & m = info.system->mounts;
|
||||
|
||||
ticket_info.mount_type_thread = m.AddMountType(L"thread");
|
||||
ticket_info.mount_par_thread_enable = m.AddMountPar(L"thread_enable");
|
||||
thread_info.mount_type_thread = m.AddMountType(L"thread");
|
||||
thread_info.mount_par_thread = m.AddMountPar(L"thread");
|
||||
thread_info.mount_par_thread_dir = m.AddMountPar(L"thread_dir");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ProcessRequest(PluginInfo & info)
|
||||
{
|
||||
if( info.request->function == &info.functions->fun_reload )
|
||||
{
|
||||
if( info.request->IsParam(L"tickets") )
|
||||
ticket_info.ReadTicketConf();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void RemoveThread(PluginInfo & i)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void InitTicket(PluginInfo & info)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void AddNotifyTemplate(PluginInfo & info)
|
||||
{
|
||||
ticket_info.template_index = info.system->notify.AddTemplate(L"notify_email_thread.txt");
|
||||
thread_info.template_index = info.system->notify.AddTemplate(L"notify_email_thread.txt");
|
||||
}
|
||||
|
||||
|
||||
void SetSortTab(PluginInfo & info)
|
||||
{
|
||||
if( !info.p1 )
|
||||
{
|
||||
log << log1 << "Thread: sort_tab pointer is not set" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
typedef std::vector<Item*> SortTab;
|
||||
SortTab * psort_tab = reinterpret_cast<SortTab*>(info.p1);
|
||||
|
||||
thread_info.item_sort_tab = *psort_tab;
|
||||
}
|
||||
|
||||
|
||||
void ReadThreads(PluginInfo & info)
|
||||
{
|
||||
fun_show_threads.ReadThreads();
|
||||
}
|
||||
|
||||
|
||||
void SetSortTabIndex(PluginInfo & info)
|
||||
{
|
||||
thread_sort_tab(info.l1);
|
||||
}
|
||||
|
||||
|
||||
void PrepareThread(PluginInfo & info)
|
||||
{
|
||||
fun_thread.PrepareThread(info.l1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
void AddEzcFunctions(PluginInfo & info);
|
||||
|
||||
} // namespace Thread
|
||||
|
||||
|
||||
|
||||
void Init(PluginInfo & info)
|
||||
{
|
||||
using namespace Ticket;
|
||||
using namespace Thread;
|
||||
|
||||
plugin.Assign(WINIX_CREATE_FUNCTIONS, AddFunctions);
|
||||
plugin.Assign(WINIX_SELECT_DEFAULT_FUNCTION, SelectDefaultFunction);
|
||||
plugin.Assign(WINIX_ADD_MOUNTS, AddMounts);
|
||||
plugin.Assign(WINIX_FILE_REMOVED, RemoveThread);
|
||||
plugin.Assign(WINIX_PLUGIN_INIT, InitTicket);
|
||||
plugin.Assign(WINIX_NOTIFY_ADD_TEMPLATE, AddNotifyTemplate);
|
||||
|
||||
plugin.Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, AddEzcFunctions);
|
||||
plugin.Assign(WINIX_PROCESS_REQUEST, ProcessRequest);
|
||||
|
||||
// for other plugins
|
||||
plugin.Assign(WINIX_PL_THREAD_SET_SORTTAB, SetSortTab);
|
||||
plugin.Assign(WINIX_PL_THREAD_READ_THREADS, ReadThreads);
|
||||
plugin.Assign(WINIX_PL_THREAD_SET_SORTTAB_INDEX, SetSortTabIndex);
|
||||
plugin.Assign(WINIX_PL_THREAD_PREPARE_THREAD, PrepareThread);
|
||||
|
||||
tdb.SetConn(info.db->GetConn());
|
||||
tdb.LogQueries(info.config->log_db_query);
|
||||
|
||||
ticket_info.SetDb(info.db);
|
||||
ticket_info.SetTDb(&tdb);
|
||||
ticket_info.SetConfig(info.config);
|
||||
ticket_info.SetSystem(info.system);
|
||||
ticket_info.SetRequest(info.request);
|
||||
ticket_info.SetFunctions(info.functions);
|
||||
ticket_info.plugin_id = info.plugin_id;
|
||||
// thread_info and fun_show_threads are used in 'ticket' plugins too
|
||||
thread_info.SetSystem(info.system);
|
||||
thread_info.plugin_id = info.plugin_id;
|
||||
|
||||
fun_ticket.SetTDb(&tdb);
|
||||
fun_ticket.SetTicketInfo(&ticket_info);
|
||||
fun_reply.SetTDb(&tdb);
|
||||
fun_reply.SetThreadInfo(&thread_info);
|
||||
|
||||
fun_edit_ticket.SetTDb(&tdb);
|
||||
fun_edit_ticket.SetTicketInfo(&ticket_info);
|
||||
fun_thread.SetTDb(&tdb);
|
||||
fun_thread.SetThreadInfo(&thread_info);
|
||||
|
||||
fun_create_ticket.SetTDb(&tdb);
|
||||
fun_create_ticket.SetTicketInfo(&ticket_info);
|
||||
fun_create_thread.SetTDb(&tdb);
|
||||
fun_create_thread.SetThreadInfo(&thread_info);
|
||||
|
||||
fun_show_tickets.SetTDb(&tdb);
|
||||
fun_show_tickets.SetTicketInfo(&ticket_info);
|
||||
fun_show_threads.SetTDb(&tdb);
|
||||
fun_show_threads.SetThreadInfo(&thread_info);
|
||||
|
||||
info.p1 = (void*)(plugin_name);
|
||||
}
|
||||
|
Reference in New Issue
Block a user