mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-13 08:29:32 -05:00
added manual entry for plugins
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4734 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ea09fbf9b2
commit
43be20c0ed
@ -152,6 +152,33 @@ RsSerialiser *RsPluginManager::setupSerialiser()
|
||||
return rss ;
|
||||
}
|
||||
|
||||
void RsPluginManager::loadPlugins(const std::vector<RsPlugin *>& plugins)
|
||||
{
|
||||
for(uint32_t i=0;i<plugins.size();++i)
|
||||
loadPlugin(plugins[i]) ;
|
||||
}
|
||||
|
||||
bool RsPluginManager::loadPlugin(RsPlugin *p)
|
||||
{
|
||||
std::cerr << " Loading programmatically inserted plugin " << std::endl;
|
||||
|
||||
PluginInfo pinfo ;
|
||||
pinfo.plugin = p ;
|
||||
pinfo.file_name = "No file" ;
|
||||
pinfo.file_hash = "No hash" ;
|
||||
pinfo.info_string = "" ;
|
||||
|
||||
p->setPlugInHandler(this); // WIN fix, cannot share global space with shared libraries
|
||||
|
||||
// The following choice is conservative by forcing RS to resolve all dependencies at
|
||||
// the time of loading the plugin.
|
||||
|
||||
pinfo.status = PLUGIN_STATUS_LOADED ;
|
||||
|
||||
_plugins.push_back(pinfo) ;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RsPluginManager::loadPlugin(const std::string& plugin_name)
|
||||
{
|
||||
std::cerr << " Loading plugin " << plugin_name << std::endl;
|
||||
|
@ -62,12 +62,23 @@ class RsPluginManager: public RsPluginHandler, public p3Config
|
||||
static void setFileServer(ftServer *ft) { _ftserver = ft ; }
|
||||
static void setLinkMgr(p3LinkMgr *cm) { _linkmgr = cm ; }
|
||||
|
||||
|
||||
// Normal plugin loading system. Parses through the plugin directories and loads
|
||||
// dso libraries, checks for the hash, and loads/rejects plugins according to
|
||||
// the user's choice.
|
||||
//
|
||||
void loadPlugins(const std::vector<std::string>& plugin_directories) ;
|
||||
|
||||
// Explicit function to load a plugin programatically.
|
||||
// No hash-checking is performed (there's no DSO file to hash!)
|
||||
// Mostly convenient for insering plugins in development.
|
||||
//
|
||||
void loadPlugins(const std::vector<RsPlugin*>& explicit_plugin_entries) ;
|
||||
|
||||
void registerCacheServices() ;
|
||||
void registerClientServices(p3ServiceServer *pqih) ;
|
||||
|
||||
private:
|
||||
bool loadPlugin(RsPlugin *) ;
|
||||
bool loadPlugin(const std::string& shared_library_name) ;
|
||||
std::string hashPlugin(const std::string& shared_library_name) ;
|
||||
|
||||
|
@ -2060,11 +2060,22 @@ int RsServer::StartupRetroShare()
|
||||
//
|
||||
mPluginsManager->loadPlugins(plugins_directories) ;
|
||||
|
||||
// set interfaces for plugins
|
||||
RsPlugInInterfaces interfaces;
|
||||
interfaces.mFiles = rsFiles;
|
||||
interfaces.mPeers = rsPeers;
|
||||
mPluginsManager->setInterfaces(interfaces);
|
||||
// Also load some plugins explicitly. This is helpful for
|
||||
// - developping plugins
|
||||
//
|
||||
std::vector<RsPlugin *> programatically_inserted_plugins ;
|
||||
|
||||
// Push your own plugins into this list, before the call:
|
||||
//
|
||||
// programatically_inserted_plugins.push_back(myCoolPlugin) ;
|
||||
//
|
||||
mPluginsManager->loadPlugins(programatically_inserted_plugins) ;
|
||||
|
||||
// set interfaces for plugins
|
||||
RsPlugInInterfaces interfaces;
|
||||
interfaces.mFiles = rsFiles;
|
||||
interfaces.mPeers = rsPeers;
|
||||
mPluginsManager->setInterfaces(interfaces);
|
||||
|
||||
/* create Services */
|
||||
ad = new p3disc(mPeerMgr, mLinkMgr, mNetMgr, pqih);
|
||||
|
Loading…
Reference in New Issue
Block a user