summaryrefslogtreecommitdiff
path: root/src/plugins/script/script.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/script/script.c')
-rw-r--r--src/plugins/script/script.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/plugins/script/script.c b/src/plugins/script/script.c
index eab823421..9d67ea5f7 100644
--- a/src/plugins/script/script.c
+++ b/src/plugins/script/script.c
@@ -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"
@@ -98,6 +99,29 @@ script_language_search_by_extension (const char *extension)
}
/*
+ * 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).
*
* Note: result must be freed after use.
@@ -394,5 +418,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
script_config_free ();
+ script_action_end ();
+
return WEECHAT_RC_OK;
}