1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 05:16:38 +02:00

script: add option script.scripts.download_enabled (closes #1548)

This commit is contained in:
Sébastien Helleu
2020-09-06 19:15:15 +02:00
parent 9ccf62979f
commit 3c987f3a1c
29 changed files with 417 additions and 95 deletions
+26
View File
@@ -27,6 +27,7 @@
#include "../weechat-plugin.h"
#include "script.h"
#include "script-action.h"
#include "script-buffer.h"
#include "script-command.h"
#include "script-completion.h"
@@ -97,6 +98,29 @@ script_language_search_by_extension (const char *extension)
return -1;
}
/*
* Checks if download of scripts is enabled.
*
* Returns:
* 0: download NOT enabled (an error is displayed)
* 1: download enabled
*/
int
script_download_enabled ()
{
if (weechat_config_boolean (script_config_scripts_download_enabled))
return 1;
/* download not enabled: display an error */
weechat_printf (NULL,
_("%s%s: download of scripts is disabled by default; "
"see /help script.scripts.download_enabled"),
weechat_prefix ("error"),
SCRIPT_PLUGIN_NAME);
return 0;
}
/*
* Builds download URL (to use with hook_process or hook_process_hashtable).
*
@@ -394,5 +418,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
script_config_free ();
script_action_end ();
return WEECHAT_RC_OK;
}