mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
fix for windows plugin system
uses call back to expose the retroshare interface to plugins git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4633 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2173ee0d2e
commit
c1af9b13ad
14 changed files with 179 additions and 52 deletions
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <dbase/cachestrapper.h>
|
||||
#include "plugins/pluginmanager.h"
|
||||
|
||||
// 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.
|
||||
|
@ -8,7 +9,7 @@
|
|||
class RsCacheService: public CacheSource, public CacheStore, public p3Config
|
||||
{
|
||||
public:
|
||||
RsCacheService(uint16_t type,uint32_t config_type,uint32_t tick_delay_in_seconds) ;
|
||||
RsCacheService(uint16_t type,uint32_t config_type,uint32_t tick_delay_in_seconds, RsPluginHandler* pgHandler) ;
|
||||
|
||||
uint32_t tickDelay() const { return _tick_delay_in_seconds ; }
|
||||
virtual void tick() {}
|
||||
|
|
|
@ -43,6 +43,19 @@ void RsPluginManager::loadConfiguration()
|
|||
p3Config::loadConfiguration(dummyHash);
|
||||
}
|
||||
|
||||
void RsPluginManager::setInterfaces(RsPlugInInterfaces &interfaces)
|
||||
{
|
||||
std::cerr << "RsPluginManager::setInterfaces() " << std::endl;
|
||||
|
||||
for(uint32_t i=0;i<_plugins.size();++i)
|
||||
|
||||
if(_plugins[i].plugin != NULL && _plugins[i].plugin->rs_cache_service() != NULL)
|
||||
{
|
||||
_plugins[i].plugin->setInterfaces(interfaces);
|
||||
std::cerr << " setting iterface for plugin " << _plugins[i].plugin->getPluginName() << ", with RS_ID " << _plugins[i].plugin->rs_service_id() << std::endl ;
|
||||
}
|
||||
}
|
||||
|
||||
void RsPluginManager::setCacheDirectories(const std::string& local_cache, const std::string& remote_cache)
|
||||
{
|
||||
_local_cache_dir = local_cache ;
|
||||
|
@ -134,7 +147,7 @@ void RsPluginManager::getPluginStatus(int i,uint32_t& status,std::string& file_n
|
|||
RsSerialiser *RsPluginManager::setupSerialiser()
|
||||
{
|
||||
RsSerialiser *rss = new RsSerialiser ;
|
||||
rss->addSerialType(new RsPluginSerialiser()) ;
|
||||
rss->addSerialType(new RsPluginSerialiser()) ;
|
||||
|
||||
return rss ;
|
||||
}
|
||||
|
@ -209,6 +222,7 @@ bool RsPluginManager::loadPlugin(const std::string& plugin_name)
|
|||
|
||||
pinfo.status = PLUGIN_STATUS_LOADED ;
|
||||
pinfo.plugin = p ;
|
||||
p->setPlugInHandler(this); // WIN fix, cannot share global space with shared libraries
|
||||
pinfo.info_string = "" ;
|
||||
|
||||
return true;
|
||||
|
@ -220,6 +234,8 @@ p3LinkMgr *RsPluginManager::getLinkMgr() const
|
|||
assert(_linkmgr != NULL) ;
|
||||
return _linkmgr ;
|
||||
}
|
||||
|
||||
|
||||
ftServer *RsPluginManager::getFileServer() const
|
||||
{
|
||||
assert(_ftserver != NULL) ;
|
||||
|
@ -318,9 +334,9 @@ bool RsPluginManager::saveList(bool& cleanup, std::list<RsItem*>& list)
|
|||
return true;
|
||||
}
|
||||
|
||||
RsCacheService::RsCacheService(uint16_t service_type,uint32_t config_type,uint32_t tick_delay)
|
||||
: CacheSource(service_type, true, rsPlugins->getFileServer()->getCacheStrapper(), rsPlugins->getLocalCacheDir()),
|
||||
CacheStore (service_type, true, rsPlugins->getFileServer()->getCacheStrapper(), rsPlugins->getFileServer()->getCacheTransfer(), rsPlugins->getRemoteCacheDir()),
|
||||
RsCacheService::RsCacheService(uint16_t service_type,uint32_t config_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(config_type), // CONFIG_TYPE_RANK_LINK
|
||||
_tick_delay_in_seconds(tick_delay)
|
||||
{
|
||||
|
|
|
@ -51,12 +51,18 @@ class RsPluginManager: public RsPluginHandler, public p3Config
|
|||
virtual void addConfigurations(p3ConfigMgr *cfgMgr) ;
|
||||
virtual void loadConfiguration() ;
|
||||
|
||||
/*!
|
||||
* sets interfaces for all loaded plugins
|
||||
* @param interfaces
|
||||
*/
|
||||
void setInterfaces(RsPlugInInterfaces& interfaces);
|
||||
static void setPluginEntrySymbol(const std::string& s) { _plugin_entry_symbol = s ; }
|
||||
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 ; }
|
||||
|
||||
|
||||
void loadPlugins(const std::vector<std::string>& plugin_directories) ;
|
||||
|
||||
void registerCacheServices() ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue