some work on dependency injection

git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1147 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2018-11-21 17:51:15 +00:00
parent a2ffc1e81c
commit 89d303f375
64 changed files with 1734 additions and 1161 deletions

View File

@@ -24,7 +24,6 @@ createthread.o: ../../../../winix/winixd/core/winixbase.h
createthread.o: ../../../../winix/winixd/core/config.h
createthread.o: ../../../../pikotools/space/spaceparser.h
createthread.o: ../../../../pikotools/space/space.h
createthread.o: ../../../../winix/winixd/core/htmlfilter.h
createthread.o: ../../../../winix/winixd/core/log.h
createthread.o: ../../../../winix/winixd/core/textstream.h
createthread.o: ../../../../winix/winixd/core/logmanipulators.h
@@ -179,7 +178,6 @@ funthread.o: ../../../../winix/winixd/core/winixbase.h
funthread.o: ../../../../winix/winixd/core/config.h
funthread.o: ../../../../pikotools/space/spaceparser.h
funthread.o: ../../../../pikotools/space/space.h
funthread.o: ../../../../winix/winixd/core/htmlfilter.h
funthread.o: ../../../../winix/winixd/core/log.h
funthread.o: ../../../../winix/winixd/core/textstream.h
funthread.o: ../../../../winix/winixd/core/logmanipulators.h
@@ -284,7 +282,6 @@ init.o: ../../../../winix/winixd/core/winixbase.h
init.o: ../../../../winix/winixd/core/config.h
init.o: ../../../../pikotools/space/spaceparser.h
init.o: ../../../../pikotools/space/space.h
init.o: ../../../../winix/winixd/core/htmlfilter.h
init.o: ../../../../winix/winixd/core/log.h
init.o: ../../../../winix/winixd/core/textstream.h
init.o: ../../../../winix/winixd/core/logmanipulators.h
@@ -365,10 +362,54 @@ init.o: ../../../../winix/winixd/core/system.h
init.o: ../../../../winix/winixd/core/sessionidmanager.h
init.o: ../../../../tito/src/base64.h ../../../../tito/src/aes.h
init.o: ../../../../winix/winixd/core/slog.h threadinfo.h funthread.h
init.o: createthread.h showthreads.h ../../../../winix/winixd/core/plugin.h
init.o: templates.h
reply.o: ../../../../winix/winixd/core/plugin.h reply.h
reply.o: ../../../../winix/winixd/functions/functionbase.h
init.o: createthread.h showthreads.h templates.h
init.o: ../../../../winix/winixd/core/plugin.h
init.o: ../../../../winix/winixd/functions/functions.h
init.o: ../../../../winix/winixd/functions/functionbase.h
init.o: ../../../../winix/winixd/functions/functionparser.h
init.o: ../../../../winix/winixd/functions/account.h
init.o: ../../../../winix/winixd/functions/adduser.h
init.o: ../../../../winix/winixd/functions/cat.h
init.o: ../../../../winix/winixd/functions/chmod.h
init.o: ../../../../winix/winixd/functions/privchanger.h
init.o: ../../../../winix/winixd/functions/chown.h
init.o: ../../../../winix/winixd/functions/ckeditor.h
init.o: ../../../../winix/winixd/functions/cp.h
init.o: ../../../../winix/winixd/functions/default.h
init.o: ../../../../winix/winixd/functions/download.h
init.o: ../../../../winix/winixd/functions/emacs.h
init.o: ../../../../winix/winixd/functions/env.h
init.o: ../../../../winix/winixd/functions/imgcrop.h
init.o: ../../../../winix/winixd/functions/last.h
init.o: ../../../../winix/winixd/functions/login.h
init.o: ../../../../winix/winixd/functions/logout.h
init.o: ../../../../winix/winixd/functions/ln.h
init.o: ../../../../winix/winixd/functions/ls.h
init.o: ../../../../winix/winixd/functions/man.h
init.o: ../../../../winix/winixd/functions/meta.h
init.o: ../../../../winix/winixd/functions/mkdir.h
init.o: ../../../../winix/winixd/functions/mv.h
init.o: ../../../../winix/winixd/functions/nicedit.h
init.o: ../../../../winix/winixd/functions/node.h
init.o: ../../../../winix/winixd/functions/passwd.h
init.o: ../../../../winix/winixd/functions/priv.h
init.o: ../../../../winix/winixd/functions/pw.h
init.o: ../../../../winix/winixd/functions/reload.h
init.o: ../../../../winix/winixd/functions/rm.h
init.o: ../../../../winix/winixd/functions/rmuser.h
init.o: ../../../../winix/winixd/functions/sort.h
init.o: ../../../../winix/winixd/functions/specialdefault.h
init.o: ../../../../winix/winixd/functions/stat.h
init.o: ../../../../winix/winixd/functions/subject.h
init.o: ../../../../winix/winixd/functions/template.h
init.o: ../../../../winix/winixd/functions/tinymce.h
init.o: ../../../../winix/winixd/functions/uname.h
init.o: ../../../../winix/winixd/functions/upload.h
init.o: ../../../../winix/winixd/functions/uptime.h
init.o: ../../../../winix/winixd/functions/who.h
init.o: ../../../../winix/winixd/functions/vim.h
init.o: ../../../../winix/winixd/core/htmlfilter.h
reply.o: reply.h ../../../../winix/winixd/functions/functionbase.h
reply.o: ../../../../winix/winixd/core/item.h
reply.o: ../../../../pikotools/space/space.h
reply.o: ../../../../pikotools/textstream/types.h
@@ -391,7 +432,6 @@ reply.o: ../../../../winix/winixd/core/winixbase.h
reply.o: ../../../../winix/winixd/core/config.h
reply.o: ../../../../pikotools/space/spaceparser.h
reply.o: ../../../../pikotools/space/space.h
reply.o: ../../../../winix/winixd/core/htmlfilter.h
reply.o: ../../../../winix/winixd/core/log.h
reply.o: ../../../../winix/winixd/core/textstream.h
reply.o: ../../../../winix/winixd/core/logmanipulators.h
@@ -545,7 +585,6 @@ showthreads.o: ../../../../winix/winixd/core/winixbase.h
showthreads.o: ../../../../winix/winixd/core/config.h
showthreads.o: ../../../../pikotools/space/spaceparser.h
showthreads.o: ../../../../pikotools/space/space.h
showthreads.o: ../../../../winix/winixd/core/htmlfilter.h
showthreads.o: ../../../../winix/winixd/core/log.h
showthreads.o: ../../../../winix/winixd/core/textstream.h
showthreads.o: ../../../../winix/winixd/core/logmanipulators.h
@@ -655,7 +694,6 @@ templates.o: ../../../../winix/winixd/core/winixbase.h
templates.o: ../../../../winix/winixd/core/config.h
templates.o: ../../../../pikotools/space/spaceparser.h
templates.o: ../../../../pikotools/space/space.h
templates.o: ../../../../winix/winixd/core/htmlfilter.h
templates.o: ../../../../winix/winixd/core/log.h
templates.o: ../../../../winix/winixd/core/textstream.h
templates.o: ../../../../winix/winixd/core/logmanipulators.h
@@ -815,7 +853,6 @@ threadinfo.o: ../../../../winix/winixd/core/winixbase.h
threadinfo.o: ../../../../winix/winixd/core/config.h
threadinfo.o: ../../../../pikotools/space/spaceparser.h
threadinfo.o: ../../../../pikotools/space/space.h
threadinfo.o: ../../../../winix/winixd/core/htmlfilter.h
threadinfo.o: ../../../../winix/winixd/core/log.h
threadinfo.o: ../../../../winix/winixd/core/textstream.h
threadinfo.o: ../../../../winix/winixd/core/logmanipulators.h
@@ -888,4 +925,3 @@ threadinfo.o: ../../../../winix/winixd/core/winixmodel.h
threadinfo.o: ../../../../winix/winixd/core/timezones.h
threadinfo.o: ../../../../winix/winixd/core/timezone.h thread.h tdb.h
threadinfo.o: ../../../../winix/winixd/db/dbbase.h
threadinfo.o: ../../../../winix/winixd/core/plugin.h

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2014, Tomasz Sowa
* Copyright (c) 2010-2018, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,9 +38,11 @@
#include "createthread.h"
#include "showthreads.h"
#include "core/log.h"
#include "core/plugin.h"
#include "pluginmsg.h"
#include "templates.h"
#include "functions/functions.h"
namespace Winix
{
@@ -124,7 +126,7 @@ void SetSortTab(PluginInfo & info)
{
if( !info.p1 )
{
log << log1 << "Thread: sort_tab pointer is not set" << logend;
info.log << log1 << "Thread: sort_tab pointer is not set" << logend;
return;
}
@@ -168,9 +170,9 @@ void Rescan(PluginInfo & info)
{
if( info.config->Bool(L"thread_rescan", false) == true )
{
log << log1 << "---------- rescanning thread db ------------- " << logend;
info.log << log1 << "---------- rescanning thread db ------------- " << logend;
thread_info.Repair();
log << log1 << "---------- thread db rescanning is finished ------------- " << logend;
info.log << log1 << "---------- thread db rescanning is finished ------------- " << logend;
}
}
@@ -185,27 +187,29 @@ void Init(PluginInfo & info)
{
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_NOTIFY_ADD_TEMPLATE, AddNotifyTemplate);
plugin.Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, AddEzcFunctions);
plugin.Assign(WINIX_END_REQUEST, EndRequest);
info.plugin->Assign(WINIX_CREATE_FUNCTIONS, AddFunctions);
info.plugin->Assign(WINIX_SELECT_DEFAULT_FUNCTION, SelectDefaultFunction);
info.plugin->Assign(WINIX_ADD_MOUNTS, AddMounts);
info.plugin->Assign(WINIX_FILE_REMOVED, RemoveThread);
info.plugin->Assign(WINIX_NOTIFY_ADD_TEMPLATE, AddNotifyTemplate);
info.plugin->Assign(WINIX_TEMPLATES_CREATEFUNCTIONS, AddEzcFunctions);
info.plugin->Assign(WINIX_END_REQUEST, EndRequest);
// 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);
info.plugin->Assign(WINIX_PL_THREAD_SET_SORTTAB, SetSortTab);
info.plugin->Assign(WINIX_PL_THREAD_READ_THREADS, ReadThreads);
info.plugin->Assign(WINIX_PL_THREAD_SET_SORTTAB_INDEX, SetSortTabIndex);
info.plugin->Assign(WINIX_PL_THREAD_PREPARE_THREAD, PrepareThread);
// temporarily
plugin.Assign(WINIX_PLUGIN_INIT, Rescan);
info.plugin->Assign(WINIX_PLUGIN_INIT, Rescan);
tdb.SetConn(info.db->GetConn());
tdb.LogQueries(info.config->log_db_query);
// thread_info and fun_show_threads are used in 'ticket' plugins too
info.set_dependency_for(thread_info);
thread_info.SetDb(info.db);
thread_info.SetTDb(&tdb);
thread_info.SetSystem(info.system);

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2014, Tomasz Sowa
* Copyright (c) 2010-2018, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,11 +32,9 @@
*
*/
#include "core/plugin.h"
#include "reply.h"
#include "functions/functions.h"
#include "core/misc.h"
#include "core/plugin.h"
#include "pluginmsg.h"
namespace Winix
@@ -135,7 +133,7 @@ void Reply::MakePost()
if( functions->CheckAbuse() )
return;
plugin.Call(WINIX_PL_THREAD_PREPARE_TO_REPLY_IN_THREAD, &answer);
plugin->Call(WINIX_PL_THREAD_PREPARE_TO_REPLY_IN_THREAD, &answer);
cur->request->status = system->AddFile(answer);

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2014, Tomasz Sowa
* Copyright (c) 2010-2018, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,9 +33,9 @@
*/
#include "threadinfo.h"
#include "core/plugin.h"
#include "pluginmsg.h"
namespace Winix
{
@@ -74,7 +74,7 @@ void ThreadInfo::Clear()
Item * ThreadInfo::FindThreadDir()
{
Item * plugin_dir = 0;
plugin.Call(WINIX_PL_THREAD_SEARCH_THREAD_DIR, &plugin_dir);
plugin->Call(WINIX_PL_THREAD_SEARCH_THREAD_DIR, &plugin_dir);
if( plugin_dir )
return plugin_dir;
@@ -171,7 +171,7 @@ void ThreadInfo::Repair()
void ThreadInfo::MakeRedirectIfPossible(const Item & item)
{
PluginRes res = plugin.Call(WINIX_PL_THREAD_CAN_MAKE_REDIRECT);
PluginRes res = plugin->Call(WINIX_PL_THREAD_CAN_MAKE_REDIRECT);
if( res.res_false > 0 )
{

View File

@@ -41,6 +41,9 @@
#include "db/db.h"
#include "thread.h"
#include "tdb.h"
#include "core/winixmodel.h"
namespace Winix
{
@@ -49,7 +52,7 @@ namespace Winix
namespace Thread
{
class ThreadInfo
class ThreadInfo : public WinixModel
{
public: