mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-25 17:21:27 -05:00
made RS not to ask for plugin confirmation on first load
This commit is contained in:
parent
345f24eb5f
commit
e8415c4f03
@ -140,6 +140,8 @@ void RsPluginManager::loadPlugins(const std::vector<std::string>& plugin_directo
|
|||||||
|
|
||||||
// 0 - get the list of files to read
|
// 0 - get the list of files to read
|
||||||
|
|
||||||
|
bool first_time = (_accepted_hashes.empty()) && _rejected_hashes.empty() ;
|
||||||
|
|
||||||
for(uint32_t i=0;i<plugin_directories.size();++i)
|
for(uint32_t i=0;i<plugin_directories.size();++i)
|
||||||
{
|
{
|
||||||
librs::util::FolderIterator dirIt(plugin_directories[i],true);
|
librs::util::FolderIterator dirIt(plugin_directories[i],true);
|
||||||
@ -164,7 +166,7 @@ void RsPluginManager::loadPlugins(const std::vector<std::string>& plugin_directo
|
|||||||
std::cerr << "Found plugin " << fullname << std::endl;
|
std::cerr << "Found plugin " << fullname << std::endl;
|
||||||
std::cerr << " Loading plugin..." << std::endl;
|
std::cerr << " Loading plugin..." << std::endl;
|
||||||
|
|
||||||
loadPlugin(fullname) ;
|
loadPlugin(fullname, first_time) ;
|
||||||
}
|
}
|
||||||
dirIt.closedir();
|
dirIt.closedir();
|
||||||
}
|
}
|
||||||
@ -262,7 +264,7 @@ bool RsPluginManager::loadPlugin(RsPlugin *p)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsPluginManager::loadPlugin(const std::string& plugin_name)
|
bool RsPluginManager::loadPlugin(const std::string& plugin_name,bool first_time)
|
||||||
{
|
{
|
||||||
std::cerr << " Loading plugin " << plugin_name << std::endl;
|
std::cerr << " Loading plugin " << plugin_name << std::endl;
|
||||||
|
|
||||||
@ -289,7 +291,7 @@ bool RsPluginManager::loadPlugin(const std::string& plugin_name)
|
|||||||
if(!_allow_all_plugins)
|
if(!_allow_all_plugins)
|
||||||
{
|
{
|
||||||
if(_accepted_hashes.find(pinfo.file_hash) == _accepted_hashes.end() && _rejected_hashes.find(pinfo.file_hash) == _rejected_hashes.end() )
|
if(_accepted_hashes.find(pinfo.file_hash) == _accepted_hashes.end() && _rejected_hashes.find(pinfo.file_hash) == _rejected_hashes.end() )
|
||||||
if(!RsServer::notify()->askForPluginConfirmation(pinfo.file_name,pinfo.file_hash.toStdString()))
|
if(!RsServer::notify()->askForPluginConfirmation(pinfo.file_name,pinfo.file_hash.toStdString(),first_time))
|
||||||
_rejected_hashes.insert(pinfo.file_hash) ; // accepted hashes are treated at the end, for security.
|
_rejected_hashes.insert(pinfo.file_hash) ; // accepted hashes are treated at the end, for security.
|
||||||
|
|
||||||
if(_rejected_hashes.find(pinfo.file_hash) != _rejected_hashes.end() )
|
if(_rejected_hashes.find(pinfo.file_hash) != _rejected_hashes.end() )
|
||||||
|
@ -106,7 +106,7 @@ class RsPluginManager: public RsPluginHandler, public p3Config
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool loadPlugin(RsPlugin *) ;
|
bool loadPlugin(RsPlugin *) ;
|
||||||
bool loadPlugin(const std::string& shared_library_name) ;
|
bool loadPlugin(const std::string& shared_library_name, bool first_time) ;
|
||||||
RsFileHash hashPlugin(const std::string& shared_library_name) ;
|
RsFileHash hashPlugin(const std::string& shared_library_name) ;
|
||||||
|
|
||||||
std::vector<PluginInfo> _plugins ;
|
std::vector<PluginInfo> _plugins ;
|
||||||
|
@ -283,10 +283,10 @@ bool p3Notify::askForPassword (const std::string& title , c
|
|||||||
|
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
bool p3Notify::askForPluginConfirmation (const std::string& plugin_filename, const std::string& plugin_file_hash)
|
bool p3Notify::askForPluginConfirmation (const std::string& plugin_filename, const std::string& plugin_file_hash,bool first_time)
|
||||||
{
|
{
|
||||||
FOR_ALL_NOTIFY_CLIENTS
|
FOR_ALL_NOTIFY_CLIENTS
|
||||||
if( (*it)->askForPluginConfirmation(plugin_filename,plugin_file_hash))
|
if( (*it)->askForPluginConfirmation(plugin_filename,plugin_file_hash,first_time))
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
return false ;
|
return false ;
|
||||||
|
@ -123,7 +123,7 @@ class p3Notify: public RsNotify
|
|||||||
void notifyHistoryChanged (uint32_t /* msgId */, int /* type */) ;
|
void notifyHistoryChanged (uint32_t /* msgId */, int /* type */) ;
|
||||||
|
|
||||||
bool askForPassword (const std::string& title, const std::string& /* key_details */, bool /* prev_is_bad */, std::string&, bool *cancelled /* password */ ) ;
|
bool askForPassword (const std::string& title, const std::string& /* key_details */, bool /* prev_is_bad */, std::string&, bool *cancelled /* password */ ) ;
|
||||||
bool askForPluginConfirmation (const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */) ;
|
bool askForPluginConfirmation (const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */,bool first_time) ;
|
||||||
|
|
||||||
virtual bool cachePgpPassphrase (const std::string& /* pgp_passphrase */) ;
|
virtual bool cachePgpPassphrase (const std::string& /* pgp_passphrase */) ;
|
||||||
virtual bool clearPgpPassphrase () ;
|
virtual bool clearPgpPassphrase () ;
|
||||||
|
@ -244,7 +244,7 @@ class NotifyClient
|
|||||||
virtual void notifyHistoryChanged (uint32_t /* msgId */, int /* type */) {}
|
virtual void notifyHistoryChanged (uint32_t /* msgId */, int /* type */) {}
|
||||||
|
|
||||||
virtual bool askForPassword (const std::string& /* title */, const std::string& /* key_details */, bool /* prev_is_bad */, std::string& /* password */,bool& /* cancelled */ ) { return false ;}
|
virtual bool askForPassword (const std::string& /* title */, const std::string& /* key_details */, bool /* prev_is_bad */, std::string& /* password */,bool& /* cancelled */ ) { return false ;}
|
||||||
virtual bool askForPluginConfirmation (const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */) { return false ;}
|
virtual bool askForPluginConfirmation (const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */,bool /* first_time */) { return false ;}
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -301,8 +301,13 @@ bool NotifyQt::askForPassword(const std::string& title, const std::string& key_d
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool NotifyQt::askForPluginConfirmation(const std::string& plugin_file_name, const std::string& plugin_file_hash)
|
bool NotifyQt::askForPluginConfirmation(const std::string& plugin_file_name, const std::string& plugin_file_hash, bool first_time)
|
||||||
{
|
{
|
||||||
|
// By default, when no information is known about plugins, just dont load them. They will be enabled from the GUI by the user.
|
||||||
|
|
||||||
|
if(first_time)
|
||||||
|
return false ;
|
||||||
|
|
||||||
RsAutoUpdatePage::lockAllEvents() ;
|
RsAutoUpdatePage::lockAllEvents() ;
|
||||||
|
|
||||||
QMessageBox dialog;
|
QMessageBox dialog;
|
||||||
|
@ -69,7 +69,7 @@ class NotifyQt: public QObject, public NotifyClient
|
|||||||
virtual void notifyDownloadComplete(const std::string& fileHash);
|
virtual void notifyDownloadComplete(const std::string& fileHash);
|
||||||
virtual void notifyDownloadCompleteCount(uint32_t count);
|
virtual void notifyDownloadCompleteCount(uint32_t count);
|
||||||
virtual bool askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad, std::string& password, bool &cancelled);
|
virtual bool askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad, std::string& password, bool &cancelled);
|
||||||
virtual bool askForPluginConfirmation(const std::string& plugin_filename, const std::string& plugin_file_hash);
|
virtual bool askForPluginConfirmation(const std::string& plugin_filename, const std::string& plugin_file_hash,bool first_time);
|
||||||
|
|
||||||
// Queues the signature event so that it canhappen in the main GUI thread (to ask for passwd).
|
// Queues the signature event so that it canhappen in the main GUI thread (to ask for passwd).
|
||||||
// To use this function: call is multiple times as soon as it returns true.
|
// To use this function: call is multiple times as soon as it returns true.
|
||||||
|
@ -84,7 +84,7 @@ void NotifyTxt::notifyChat()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NotifyTxt::askForPluginConfirmation(const std::string& plugin_file_name, const std::string& plugin_file_hash)
|
bool NotifyTxt::askForPluginConfirmation(const std::string& plugin_file_name, const std::string& plugin_file_hash, bool /* first_time */)
|
||||||
{
|
{
|
||||||
std::cerr << "The following plugin is not registered as accepted or denied. You probably upgraded the main executable or the plugin itself." << std::endl;
|
std::cerr << "The following plugin is not registered as accepted or denied. You probably upgraded the main executable or the plugin itself." << std::endl;
|
||||||
std::cerr << " Hash: " << plugin_file_hash << std::endl;
|
std::cerr << " Hash: " << plugin_file_hash << std::endl;
|
||||||
|
@ -42,7 +42,7 @@ class NotifyTxt: public NotifyClient
|
|||||||
virtual void notifyErrorMsg(int list, int sev, std::string msg);
|
virtual void notifyErrorMsg(int list, int sev, std::string msg);
|
||||||
virtual void notifyChat();
|
virtual void notifyChat();
|
||||||
virtual bool askForPassword(const std::string& title, const std::string& question, bool prev_is_bad, std::string& password,bool& cancel);
|
virtual bool askForPassword(const std::string& title, const std::string& question, bool prev_is_bad, std::string& password,bool& cancel);
|
||||||
virtual bool askForPluginConfirmation(const std::string& plugin_file, const std::string& plugin_hash);
|
virtual bool askForPluginConfirmation(const std::string& plugin_file, const std::string& plugin_hash,bool first_time);
|
||||||
|
|
||||||
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& found_files);
|
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& found_files);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user