diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2015-03-18 07:25:26 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2015-03-18 07:25:26 +0100 |
commit | 6c4b5749451f40cc961389704e8b45b23e21fbab (patch) | |
tree | 6992b38fb8175659bdcf99b43af75b97b7506a6e /src | |
parent | 11debc7cae0c4b2bf0bd36c17a880a48bcbded53 (diff) | |
download | weechat-6c4b5749451f40cc961389704e8b45b23e21fbab.zip |
script: fix state of script plugins when list of scripts has not been downloaded
The problem happened when doing "/script load script.py" if the scripts list
has not been downloaded (with "/script update"): WeeChat displays that python
plugin is not loaded (which is wrong).
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/script/script-action.c | 2 | ||||
-rw-r--r-- | src/plugins/script/script-buffer.c | 3 | ||||
-rw-r--r-- | src/plugins/script/script-repo.c | 3 | ||||
-rw-r--r-- | src/plugins/script/script.c | 27 | ||||
-rw-r--r-- | src/plugins/script/script.h | 3 |
5 files changed, 27 insertions, 11 deletions
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 */ |