diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index b12ccd1a7..16975d0a4 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -62,6 +62,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * ruby: fix value returned in case of error in functions: config_option_reset, config_color, config_color_default, config_write, config_read, config_reload, buffer_string_replace_local_var, command +* script: fix state of script plugins when list of scripts has not been + downloaded * scripts: reset current script pointer when load of script fails in python/perl/ruby/lua/tcl plugins * scripts: fix return code of function bar_set in diff --git a/src/plugins/script/script-action.c b/src/plugins/script/script-action.c index 8fe766678..032ec223f 100644 --- a/src/plugins/script/script-action.c +++ b/src/plugins/script/script-action.c @@ -1147,6 +1147,8 @@ script_action_run () if (!script_actions) return 0; + script_get_loaded_plugins (); + actions = weechat_string_split (script_actions, "\n", 0, 0, &num_actions); if (actions) { diff --git a/src/plugins/script/script-buffer.c b/src/plugins/script/script-buffer.c index ef01a64a5..08daebc42 100644 --- a/src/plugins/script/script-buffer.c +++ b/src/plugins/script/script-buffer.c @@ -977,7 +977,8 @@ script_buffer_input_cb (void *data, struct t_gui_buffer *buffer, /* refresh buffer */ if (strcmp (input_data, "$") == 0) { - script_get_loaded_plugins_and_scripts (); + script_get_loaded_plugins (); + script_get_scripts (); script_repo_remove_all (); script_repo_file_read (1); script_buffer_refresh (1); diff --git a/src/plugins/script/script-repo.c b/src/plugins/script/script-repo.c index d81e7590e..23db271b2 100644 --- a/src/plugins/script/script-repo.c +++ b/src/plugins/script/script-repo.c @@ -1113,7 +1113,8 @@ script_repo_file_read (int quiet) struct tm tm_script; struct t_hashtable *descriptions; - script_get_loaded_plugins_and_scripts (); + script_get_loaded_plugins (); + script_get_scripts (); script_repo_remove_all (); diff --git a/src/plugins/script/script.c b/src/plugins/script/script.c index fd1ec0dc5..75c4744bd 100644 --- a/src/plugins/script/script.c +++ b/src/plugins/script/script.c @@ -134,19 +134,16 @@ script_build_download_url (const char *url) } /* - * Gets loaded plugins (in array of integers) and scripts (in hashtable). + * Gets loaded plugins (in array of integers). */ void -script_get_loaded_plugins_and_scripts () +script_get_loaded_plugins () { int i, language; - char hdata_name[128], *filename, *ptr_base_name; - const char *ptr_filename; struct t_hdata *hdata; - void *ptr_plugin, *ptr_script; + void *ptr_plugin; - /* get loaded plugins */ for (i = 0; i < SCRIPT_NUM_LANGUAGES; i++) { script_plugin_loaded[i] = 0; @@ -162,8 +159,21 @@ script_get_loaded_plugins_and_scripts () script_plugin_loaded[language] = 1; ptr_plugin = weechat_hdata_move (hdata, ptr_plugin, 1); } +} + +/* + * Gets scripts (in hashtable). + */ + +void +script_get_scripts () +{ + int i; + char hdata_name[128], *filename, *ptr_base_name; + const char *ptr_filename; + struct t_hdata *hdata; + void *ptr_script; - /* get loaded scripts */ if (!script_loaded) { script_loaded = weechat_hashtable_new (32, @@ -242,7 +252,8 @@ script_timer_refresh_cb (void *data, int remaining_calls) /* make C compiler happy */ (void) data; - script_get_loaded_plugins_and_scripts (); + script_get_loaded_plugins (); + script_get_scripts (); script_repo_update_status_all (); script_buffer_refresh (0); diff --git a/src/plugins/script/script.h b/src/plugins/script/script.h index f92162f5b..0c93a7863 100644 --- a/src/plugins/script/script.h +++ b/src/plugins/script/script.h @@ -35,6 +35,7 @@ extern struct t_hashtable *script_loaded; extern int script_language_search (const char *language); extern int script_language_search_by_extension (const char *extension); extern char *script_build_download_url (const char *url); -extern void script_get_loaded_plugins_and_scripts (); +extern void script_get_loaded_plugins (); +extern void script_get_scripts (); #endif /* WEECHAT_SCRIPT_H */