1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 13:56:37 +02:00

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).
This commit is contained in:
Sébastien Helleu
2015-03-18 07:25:26 +01:00
parent 11debc7cae
commit 6c4b574945
6 changed files with 29 additions and 11 deletions
+2
View File
@@ -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)
{
+2 -1
View File
@@ -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);
+2 -1
View File
@@ -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 ();
+19 -8
View File
@@ -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);
+2 -1
View File
@@ -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 */