142 lines
2.7 KiB
C++
Executable File
142 lines
2.7 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2010, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#include "tdb.h"
|
|
#include "funthread.h"
|
|
#include "createthread.h"
|
|
#include "showthreads.h"
|
|
#include "core/log.h"
|
|
#include "core/plugin.h"
|
|
|
|
|
|
extern "C" void Init(PluginInfo &);
|
|
|
|
|
|
namespace Thread
|
|
{
|
|
const wchar_t plugin_name[] = L"thread";
|
|
|
|
TDb tdb;
|
|
ThreadInfo thread_info;
|
|
|
|
FunThread fun_thread;
|
|
CreateThread fun_create_thread;
|
|
ShowThreads fun_show_threads;
|
|
|
|
|
|
void AddFunctions(PluginInfo & info)
|
|
{
|
|
info.functions->Add(fun_thread);
|
|
info.functions->Add(fun_create_thread);
|
|
}
|
|
|
|
|
|
void SelectDefaultFunction(PluginInfo & info)
|
|
{
|
|
if( info.system->mounts.pmount->type == thread_info.mount_type_thread )
|
|
{
|
|
if( info.request->is_item )
|
|
info.request->function = &fun_thread;
|
|
else
|
|
info.request->function = &fun_show_threads;
|
|
}
|
|
}
|
|
|
|
|
|
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");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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");
|
|
}
|
|
|
|
|
|
|
|
|
|
void AddEzcFunctions(PluginInfo & info);
|
|
|
|
} // namespace Thread
|
|
|
|
|
|
|
|
void Init(PluginInfo & info)
|
|
{
|
|
using namespace Ticket;
|
|
|
|
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);
|
|
|
|
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;
|
|
|
|
fun_ticket.SetTDb(&tdb);
|
|
fun_ticket.SetTicketInfo(&ticket_info);
|
|
|
|
fun_edit_ticket.SetTDb(&tdb);
|
|
fun_edit_ticket.SetTicketInfo(&ticket_info);
|
|
|
|
fun_create_ticket.SetTDb(&tdb);
|
|
fun_create_ticket.SetTicketInfo(&ticket_info);
|
|
|
|
fun_show_tickets.SetTDb(&tdb);
|
|
fun_show_tickets.SetTicketInfo(&ticket_info);
|
|
|
|
info.p1 = (void*)(plugin_name);
|
|
}
|
|
|
|
|