mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-29 02:51:45 -04:00
Improved plugin system:
- the user is asked at start wether to load or deny unregistered plugins, but can make it mind later in config->plugins - added API and SVN numbers into required external plugin symbols - user-defined plugin rules are dropped when a plugin changes (hash changes) or when the main executable changes. - added new status flags (Plugin denied, missing API/SVN numbers) - modified saveList()/loadList() to allow saving a list of rejected plugins as well. - added methods in notifyBase and inherited classes to ask for plugin confirmation. - adapted VOIP plugin to follow these new rules (API+SVN numbers). Other plugins should be adapted as well by addign the missing symbols (RETROSHARE_PLUGIN_api and RETROSHARE_PLUGIN_revision). git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5529 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d57a75fbbd
commit
24a3fb58d4
13 changed files with 334 additions and 147 deletions
|
@ -167,6 +167,33 @@ bool NotifyQt::askForPassword(const std::string& key_details, bool prev_is_bad,
|
|||
|
||||
return false;
|
||||
}
|
||||
bool NotifyQt::askForPluginConfirmation(const std::string& plugin_file_name, const std::string& plugin_file_hash)
|
||||
{
|
||||
RsAutoUpdatePage::lockAllEvents() ;
|
||||
|
||||
QMessageBox dialog;
|
||||
dialog.setWindowTitle(tr("Unregistered plugin/executable"));
|
||||
|
||||
QString text ;
|
||||
text += tr( "RetroShare has detected an unregistered plugin. This happens in two cases:<UL><LI>Your RetroShare executable has changed.</LI><LI>The plugin has changed</LI></UL>Click on Yes to authorize this plugin, or No to deny it. You can change your mind later in Options -> Plugins, then restart." ) ;
|
||||
text += "<UL>" ;
|
||||
text += "<LI>Hash:\t" + QString::fromStdString(plugin_file_hash) + "</LI>" ;
|
||||
text += "<LI>File:\t" + QString::fromStdString(plugin_file_name) + "</LI>";
|
||||
text += "</UL>" ;
|
||||
|
||||
dialog.setText(text) ;
|
||||
dialog.setWindowIcon(QIcon(":/images/rstray3.png"));
|
||||
dialog.setStandardButtons(QMessageBox::Yes | QMessageBox::No) ;
|
||||
|
||||
int ret = dialog.exec();
|
||||
|
||||
RsAutoUpdatePage::unlockAllEvents() ;
|
||||
|
||||
if (ret == QMessageBox::Yes)
|
||||
return true ;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void NotifyQt::notifyDiscInfoChanged()
|
||||
{
|
||||
|
|
|
@ -59,6 +59,7 @@ class NotifyQt: public QObject, public NotifyBase
|
|||
virtual void notifyDownloadComplete(const std::string& fileHash);
|
||||
virtual void notifyDownloadCompleteCount(uint32_t count);
|
||||
virtual bool askForPassword(const std::string& key_details, bool prev_is_bad, std::string& password);
|
||||
virtual bool askForPluginConfirmation(const std::string& plugin_filename, const std::string& plugin_file_hash);
|
||||
|
||||
/* Notify from GUI */
|
||||
void notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
|
||||
|
|
|
@ -57,16 +57,26 @@ PluginsPage::PluginsPage(QWidget * parent, Qt::WFlags flags)
|
|||
|
||||
switch(status)
|
||||
{
|
||||
case PLUGIN_STATUS_UNKNOWN_HASH: status_string = tr("SVN revision number ")+QString::number(svn_revision)+tr(" does not match current. Please manually enable the plugin at your own risk.") ;
|
||||
break ;
|
||||
case PLUGIN_STATUS_DLOPEN_ERROR: status_string = tr("Loading error.") ;
|
||||
break ;
|
||||
case PLUGIN_STATUS_MISSING_SYMBOL: status_string = tr("Missing symbol. Wrong version?") ;
|
||||
break ;
|
||||
case PLUGIN_STATUS_NULL_PLUGIN: status_string = tr("No plugin object") ;
|
||||
break ;
|
||||
case PLUGIN_STATUS_LOADED: status_string = tr("Plugins is loaded.") ;
|
||||
break ;
|
||||
case PLUGIN_STATUS_REJECTED_HASH: status_string = tr("Hash rejected. Enable it manually and restart, if you need.") ;
|
||||
break ;
|
||||
|
||||
case PLUGIN_STATUS_MISSING_API: status_string = tr("No API number supplied. Please read plugin development manual.") ;
|
||||
break ;
|
||||
|
||||
case PLUGIN_STATUS_MISSING_SVN: status_string = tr("No SVN number supplied. Please read plugin development manual.") ;
|
||||
break ;
|
||||
|
||||
case PLUGIN_STATUS_DLOPEN_ERROR: status_string = tr("Loading error.") ;
|
||||
break ;
|
||||
|
||||
case PLUGIN_STATUS_MISSING_SYMBOL:status_string = tr("Missing symbol. Wrong version?") ;
|
||||
break ;
|
||||
|
||||
case PLUGIN_STATUS_NULL_PLUGIN: status_string = tr("No plugin object") ;
|
||||
break ;
|
||||
|
||||
case PLUGIN_STATUS_LOADED: status_string = tr("Plugins is loaded.") ;
|
||||
break ;
|
||||
default:
|
||||
status_string = tr("Unknown status.") ;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue