diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2018-08-17 19:44:41 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2018-08-17 19:44:41 +0200 |
commit | 466dbbe75b0fe32b9e647adebc7de06ea1b835fe (patch) | |
tree | 47040e77a3764a4f2063d938e1f7ffa12150ad3e /src/plugins | |
parent | 822270cccaec9f76b6fb952aca0e31005a6d7217 (diff) | |
download | weechat-466dbbe75b0fe32b9e647adebc7de06ea1b835fe.zip |
core: add option "-P" (or "--plugins") to customize the plugins to load at startup
If given, the option replaces the option weechat.plugin.autoload.
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/plugin.c | 29 | ||||
-rw-r--r-- | src/plugins/plugin.h | 8 |
2 files changed, 20 insertions, 17 deletions
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index e99c5a189..eb96db103 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -998,12 +998,14 @@ plugin_arraylist_cmp_cb (void *data, */ void -plugin_auto_load (int argc, char **argv, +plugin_auto_load (char *force_plugin_autoload, int load_from_plugin_path, int load_from_extra_lib_dir, - int load_from_lib_dir) + int load_from_lib_dir, + int argc, char **argv) { char *dir_name, *plugin_path, *plugin_path2, *extra_libdir; + const char *ptr_plugin_autoload; struct t_weechat_plugin *ptr_plugin; struct t_plugin_args plugin_args; struct t_arraylist *arraylist; @@ -1015,10 +1017,12 @@ plugin_auto_load (int argc, char **argv, plugin_autoload_array = NULL; plugin_autoload_count = 0; - if (CONFIG_STRING(config_plugin_autoload) - && CONFIG_STRING(config_plugin_autoload)[0]) + ptr_plugin_autoload = (force_plugin_autoload) ? + force_plugin_autoload : CONFIG_STRING(config_plugin_autoload); + + if (ptr_plugin_autoload && ptr_plugin_autoload[0]) { - plugin_autoload_array = string_split (CONFIG_STRING(config_plugin_autoload), + plugin_autoload_array = string_split (ptr_plugin_autoload, ",", 0, 0, &plugin_autoload_count); } @@ -1351,20 +1355,17 @@ plugin_display_short_list () */ void -plugin_init (int auto_load, int argc, char *argv[]) +plugin_init (char *force_plugin_autoload, int argc, char *argv[]) { /* read plugins options on disk */ plugin_config_init (); plugin_config_read (); - /* auto-load plugins if asked */ - if (auto_load) - { - plugin_quiet = 1; - plugin_auto_load (argc, argv, 1, 1, 1); - plugin_display_short_list (); - plugin_quiet = 0; - } + /* auto-load plugins */ + plugin_quiet = 1; + plugin_auto_load (force_plugin_autoload, 1, 1, 1, argc, argv); + plugin_display_short_list (); + plugin_quiet = 0; } /* diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h index fa62cb4bb..103b4b547 100644 --- a/src/plugins/plugin.h +++ b/src/plugins/plugin.h @@ -39,15 +39,17 @@ extern const char *plugin_get_name (struct t_weechat_plugin *plugin); extern struct t_weechat_plugin *plugin_load (const char *filename, int init_plugin, int argc, char **argv); -extern void plugin_auto_load (int argc, char **argv, +extern void plugin_auto_load (char *force_plugin_autoload, int load_from_plugin_path, int load_from_extra_lib_dir, - int load_from_lib_dir); + int load_from_lib_dir, + int argc, + char **argv); extern void plugin_unload (struct t_weechat_plugin *plugin); extern void plugin_unload_name (const char *name); extern void plugin_unload_all (); extern void plugin_reload_name (const char *name, int argc, char **argv); -extern void plugin_init (int auto_load, int argc, char *argv[]); +extern void plugin_init (char *force_plugin_autoload, int argc, char *argv[]); extern void plugin_end (); extern struct t_hdata *plugin_hdata_plugin_cb (const void *pointer, void *data, |