mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
fixed up plugin system to work with v0.6
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7287 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2d2a906ef2
commit
ca6b463a31
7 changed files with 134 additions and 40 deletions
|
@ -40,8 +40,7 @@ std::string RsPluginManager::_local_cache_dir ;
|
|||
std::string RsPluginManager::_remote_cache_dir ;
|
||||
std::vector<std::string> RsPluginManager::_plugin_directories ;
|
||||
|
||||
ftServer *RsPluginManager::_ftserver = NULL ;
|
||||
p3LinkMgr *RsPluginManager::_linkmgr = NULL ;
|
||||
RsServiceControl *RsPluginManager::_service_control = NULL ;
|
||||
|
||||
typedef RsPlugin *(*RetroSharePluginEntry)(void) ;
|
||||
RsPluginHandler *rsPlugins ;
|
||||
|
@ -363,18 +362,6 @@ bool RsPluginManager::loadPlugin(const std::string& plugin_name)
|
|||
return true;
|
||||
}
|
||||
|
||||
p3LinkMgr *RsPluginManager::getLinkMgr() const
|
||||
{
|
||||
assert(_linkmgr != NULL) ;
|
||||
return _linkmgr ;
|
||||
}
|
||||
|
||||
|
||||
ftServer *RsPluginManager::getFileServer() const
|
||||
{
|
||||
assert(_ftserver != NULL) ;
|
||||
return _ftserver ;
|
||||
}
|
||||
const std::string& RsPluginManager::getLocalCacheDir() const
|
||||
{
|
||||
assert(!_local_cache_dir.empty()) ;
|
||||
|
@ -385,6 +372,11 @@ const std::string& RsPluginManager::getRemoteCacheDir() const
|
|||
assert(!_remote_cache_dir.empty()) ;
|
||||
return _remote_cache_dir ;
|
||||
}
|
||||
RsServiceControl *RsPluginManager::getServiceControl() const
|
||||
{
|
||||
assert(_service_control);
|
||||
return _service_control ;
|
||||
}
|
||||
void RsPluginManager::slowTickPlugins(time_t seconds)
|
||||
{
|
||||
for(uint32_t i=0;i<_plugins.size();++i)
|
||||
|
@ -531,13 +523,13 @@ bool RsPluginManager::saveList(bool& cleanup, std::list<RsItem*>& list)
|
|||
return true;
|
||||
}
|
||||
|
||||
RsCacheService::RsCacheService(uint16_t service_type,uint32_t tick_delay, RsPluginHandler* pgHandler)
|
||||
: CacheSource(service_type, true, pgHandler->getFileServer()->getCacheStrapper(), pgHandler->getLocalCacheDir()),
|
||||
CacheStore (service_type, true, pgHandler->getFileServer()->getCacheStrapper(), pgHandler->getFileServer()->getCacheTransfer(), pgHandler->getRemoteCacheDir()),
|
||||
p3Config(),
|
||||
_tick_delay_in_seconds(tick_delay)
|
||||
{
|
||||
}
|
||||
// RsCacheService::RsCacheService(uint16_t service_type,uint32_t tick_delay, RsPluginHandler* pgHandler)
|
||||
// : CacheSource(service_type, true, pgHandler->getFileServer()->getCacheStrapper(), pgHandler->getLocalCacheDir()),
|
||||
// CacheStore (service_type, true, pgHandler->getFileServer()->getCacheStrapper(), pgHandler->getFileServer()->getCacheTransfer(), pgHandler->getRemoteCacheDir()),
|
||||
// p3Config(),
|
||||
// _tick_delay_in_seconds(tick_delay)
|
||||
// {
|
||||
// }
|
||||
|
||||
RsPQIService::RsPQIService(uint16_t service_type,uint32_t /*tick_delay_in_seconds*/, RsPluginHandler* /*pgHandler*/)
|
||||
: p3Service(),p3Config()
|
||||
|
|
|
@ -53,8 +53,7 @@ class RsPluginManager: public RsPluginHandler, public p3Config
|
|||
virtual void slowTickPlugins(time_t sec) ;
|
||||
virtual const std::string& getLocalCacheDir() const ;
|
||||
virtual const std::string& getRemoteCacheDir() const ;
|
||||
virtual ftServer *getFileServer() const ;
|
||||
virtual p3LinkMgr *getLinkMgr() const ;
|
||||
virtual RsServiceControl *getServiceControl() const ;
|
||||
|
||||
virtual void allowAllPlugins(bool b) ;
|
||||
virtual bool getAllowAllPlugins() const ;
|
||||
|
@ -78,8 +77,7 @@ class RsPluginManager: public RsPluginHandler, public p3Config
|
|||
|
||||
static bool acceptablePluginName(const std::string& s) ;
|
||||
static void setCacheDirectories(const std::string& local,const std::string& remote) ;
|
||||
static void setFileServer(ftServer *ft) { _ftserver = ft ; }
|
||||
static void setLinkMgr(p3LinkMgr *cm) { _linkmgr = cm ; }
|
||||
static void setServiceControl(RsServiceControl *cm) { _service_control = cm ; }
|
||||
|
||||
// Normal plugin loading system. Parses through the plugin directories and loads
|
||||
// dso libraries, checks for the hash, and loads/rejects plugins according to
|
||||
|
@ -124,8 +122,8 @@ class RsPluginManager: public RsPluginHandler, public p3Config
|
|||
static std::string _plugin_API_symbol ;
|
||||
static std::string _remote_cache_dir ;
|
||||
static std::string _local_cache_dir ;
|
||||
static ftServer *_ftserver ;
|
||||
static p3LinkMgr *_linkmgr ;
|
||||
|
||||
static RsServiceControl *_service_control ;
|
||||
|
||||
static std::vector<std::string> _plugin_directories ;
|
||||
};
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
#include <dbase/cachestrapper.h>
|
||||
#include "plugins/pluginmanager.h"
|
||||
|
||||
// This code needs to be re-written to work with GXS. For now it is obsolete.
|
||||
//
|
||||
|
||||
// The following class abstracts the construction of a cache service. The user only has to
|
||||
// supply RS with a type ID. If the ID is already in use, RS will complain.
|
||||
//
|
||||
|
@ -23,4 +26,3 @@ class RsCacheService: public CacheSource, public CacheStore, public p3Config
|
|||
private:
|
||||
uint32_t _tick_delay_in_seconds ;
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
class RsPQIService: public p3Service, public p3Config
|
||||
{
|
||||
public:
|
||||
RsPQIService(uint16_t type,uint32_t tick_delay_in_seconds, RsPluginHandler* pgHandler) ;
|
||||
RsPQIService(uint16_t type,uint32_t tick_delay_in_seconds, RsPluginHandler* pgHandler) ;
|
||||
|
||||
uint32_t tickDelay() const { return _tick_delay_in_seconds ; }
|
||||
virtual int tick() = 0 ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue