mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 08:05:18 -04:00
Improvement of the plugin system:
- Added configuration saving for plugin manager and serialization methods - added a list of accepted plugin hashes - added plugin widget for each plugin in settings, to allow enabling/disabling plugins - updated LinkCloud plugin to new rsPlugin class - put the addconfiguration for plugin manager in rsinit.cc a bit earlier to allow to load the list of accepted hashes early enough - added icon for disabled plugins git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4393 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
de87a89437
commit
ccfbfa9984
21 changed files with 965 additions and 103 deletions
|
@ -1,31 +1,56 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <retroshare/rsplugin.h>
|
||||
#include <pqi/p3cfgmgr.h>
|
||||
|
||||
class p3ConfigMgr ;
|
||||
class p3ServiceServer ;
|
||||
class p3ConnectMgr ;
|
||||
|
||||
class RsPluginManager: public RsPluginHandler
|
||||
struct PluginInfo
|
||||
{
|
||||
RsPlugin *plugin ;
|
||||
std::string info_string ;
|
||||
std::string file_hash ;
|
||||
std::string file_name ;
|
||||
uint32_t status ;
|
||||
};
|
||||
|
||||
class RsPluginManager: public RsPluginHandler, public p3Config
|
||||
{
|
||||
public:
|
||||
RsPluginManager() {}
|
||||
RsPluginManager() ;
|
||||
virtual ~RsPluginManager() {}
|
||||
|
||||
// ------------ Derived from RsPluginHandler ----------------//
|
||||
//
|
||||
virtual int nbPlugins() const { return _plugins.size() ; }
|
||||
virtual RsPlugin *plugin(int i) { return _plugins[i] ; }
|
||||
virtual RsPlugin *plugin(int i) { return _plugins[i].plugin ; }
|
||||
virtual const std::vector<std::string>& getPluginDirectories() const { return _plugin_directories ; }
|
||||
|
||||
virtual void getPluginStatus(int i, uint32_t& status,std::string& file_name, std::string& hash,std::string& error_string) const ;
|
||||
virtual void enablePlugin(const std::string& hash) ;
|
||||
virtual void disablePlugin(const std::string& hash) ;
|
||||
|
||||
virtual void slowTickPlugins(time_t sec) ;
|
||||
virtual void addConfigurations(p3ConfigMgr *cfgMgr) ;
|
||||
virtual const std::string& getLocalCacheDir() const ;
|
||||
virtual const std::string& getRemoteCacheDir() const ;
|
||||
virtual ftServer *getFileServer() const ;
|
||||
virtual p3ConnectMgr *getConnectMgr() const ;
|
||||
|
||||
// ---------------- Derived from p3Config -------------------//
|
||||
//
|
||||
bool saveList(bool& cleanup, std::list<RsItem*>& list) ;
|
||||
bool loadList(std::list<RsItem*>& list) ;
|
||||
virtual RsSerialiser* setupSerialiser() ;
|
||||
|
||||
// -------------------- Own members -------------------------//
|
||||
//
|
||||
virtual void addConfigurations(p3ConfigMgr *cfgMgr) ;
|
||||
virtual void loadConfiguration() ;
|
||||
|
||||
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) ;
|
||||
|
@ -38,8 +63,10 @@ class RsPluginManager: public RsPluginHandler
|
|||
void registerClientServices(p3ServiceServer *pqih) ;
|
||||
private:
|
||||
bool loadPlugin(const std::string& shared_library_name) ;
|
||||
std::string hashPlugin(const std::string& shared_library_name) ;
|
||||
|
||||
std::vector<RsPlugin *> _plugins ;
|
||||
std::vector<PluginInfo> _plugins ;
|
||||
std::set<std::string> _accepted_hashes ;
|
||||
|
||||
static std::string _plugin_entry_symbol ;
|
||||
static std::string _remote_cache_dir ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue