diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-command.c | 2 | ||||
-rw-r--r-- | src/plugins/alias/alias.c | 1 | ||||
-rw-r--r-- | src/plugins/aspell/weechat-aspell.c | 1 | ||||
-rw-r--r-- | src/plugins/charset/charset.c | 1 | ||||
-rw-r--r-- | src/plugins/exec/exec.c | 1 | ||||
-rw-r--r-- | src/plugins/fifo/fifo.c | 1 | ||||
-rw-r--r-- | src/plugins/guile/weechat-guile.c | 1 | ||||
-rw-r--r-- | src/plugins/irc/irc.c | 1 | ||||
-rw-r--r-- | src/plugins/logger/logger.c | 1 | ||||
-rw-r--r-- | src/plugins/lua/weechat-lua.c | 1 | ||||
-rw-r--r-- | src/plugins/perl/weechat-perl.c | 1 | ||||
-rw-r--r-- | src/plugins/plugin.c | 249 | ||||
-rw-r--r-- | src/plugins/plugin.h | 3 | ||||
-rw-r--r-- | src/plugins/python/weechat-python.c | 1 | ||||
-rw-r--r-- | src/plugins/relay/relay.c | 1 | ||||
-rw-r--r-- | src/plugins/ruby/weechat-ruby.c | 1 | ||||
-rw-r--r-- | src/plugins/script/script.c | 1 | ||||
-rw-r--r-- | src/plugins/tcl/weechat-tcl.c | 1 | ||||
-rw-r--r-- | src/plugins/trigger/trigger.c | 1 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 6 | ||||
-rw-r--r-- | src/plugins/xfer/xfer.c | 1 |
21 files changed, 212 insertions, 65 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 9a2225a21..012254a76 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -4395,7 +4395,7 @@ COMMAND_CALLBACK(plugin) &plugin_argc); } full_name = util_search_full_lib_name (argv[2], "plugins"); - plugin_load (full_name, plugin_argc, plugin_argv); + plugin_load (full_name, 1, plugin_argc, plugin_argv); if (full_name) free (full_name); if (plugin_argv) diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c index b93ebeb00..f36148d49 100644 --- a/src/plugins/alias/alias.c +++ b/src/plugins/alias/alias.c @@ -34,6 +34,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("Alias commands")); WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(8000); #define ALIAS_IS_ARG_NUMBER(number) ((number >= '1') && (number <= '9')) diff --git a/src/plugins/aspell/weechat-aspell.c b/src/plugins/aspell/weechat-aspell.c index 0c23ff05c..e6d3bff2b 100644 --- a/src/plugins/aspell/weechat-aspell.c +++ b/src/plugins/aspell/weechat-aspell.c @@ -46,6 +46,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("Spell checker for input (with Aspell)")); WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(9000); struct t_weechat_plugin *weechat_aspell_plugin = NULL; diff --git a/src/plugins/charset/charset.c b/src/plugins/charset/charset.c index 599b41c1a..ad275e848 100644 --- a/src/plugins/charset/charset.c +++ b/src/plugins/charset/charset.c @@ -37,6 +37,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("Charset conversions")); WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(13000); #define CHARSET_CONFIG_NAME "charset" diff --git a/src/plugins/exec/exec.c b/src/plugins/exec/exec.c index 7cce86265..7363700b4 100644 --- a/src/plugins/exec/exec.c +++ b/src/plugins/exec/exec.c @@ -37,6 +37,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("Execution of external commands in WeeChat")); WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(11000); struct t_weechat_plugin *weechat_exec_plugin = NULL; diff --git a/src/plugins/fifo/fifo.c b/src/plugins/fifo/fifo.c index 922099d75..a570742a8 100644 --- a/src/plugins/fifo/fifo.c +++ b/src/plugins/fifo/fifo.c @@ -40,6 +40,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("FIFO pipe for remote control")); WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(7000); #define FIFO_FILENAME_PREFIX "weechat_fifo_" diff --git a/src/plugins/guile/weechat-guile.c b/src/plugins/guile/weechat-guile.c index 9dae6f860..f29a625ee 100644 --- a/src/plugins/guile/weechat-guile.c +++ b/src/plugins/guile/weechat-guile.c @@ -42,6 +42,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("Support of scheme scripts (with Guile)")); WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(3000); struct t_weechat_plugin *weechat_guile_plugin = NULL; diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c index 0f8da74f0..70f2b0978 100644 --- a/src/plugins/irc/irc.c +++ b/src/plugins/irc/irc.c @@ -50,6 +50,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("IRC (Internet Relay Chat) protocol")); WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(5000); struct t_weechat_plugin *weechat_irc_plugin = NULL; diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index 0ca04aec1..521adec1d 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -50,6 +50,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("Log buffers to files")); WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(12000); struct t_weechat_plugin *weechat_logger_plugin = NULL; diff --git a/src/plugins/lua/weechat-lua.c b/src/plugins/lua/weechat-lua.c index 233ade22e..354634316 100644 --- a/src/plugins/lua/weechat-lua.c +++ b/src/plugins/lua/weechat-lua.c @@ -39,6 +39,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("Support of lua scripts")); WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(3000); struct t_weechat_plugin *weechat_lua_plugin; diff --git a/src/plugins/perl/weechat-perl.c b/src/plugins/perl/weechat-perl.c index d19c84243..c51374553 100644 --- a/src/plugins/perl/weechat-perl.c +++ b/src/plugins/perl/weechat-perl.c @@ -37,6 +37,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("Support of perl scripts")); WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(3000); struct t_weechat_plugin *weechat_perl_plugin = NULL; diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 5974b88f9..bf5484b7d 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -36,6 +36,7 @@ #include <dlfcn.h> #include "../core/weechat.h" +#include "../core/wee-arraylist.h" #include "../core/wee-config.h" #include "../core/wee-eval.h" #include "../core/wee-hashtable.h" @@ -281,38 +282,127 @@ plugin_check_autoload (const char *filename) } /* - * Searches for position of plugin (to keep list sorted). + * Returns arguments for plugins (only the relevant arguments for plugins, + * arguments for WeeChat core not returned). + * + * Note: plugin_argv must be freed after use (with free()). */ -struct t_weechat_plugin * -plugin_find_pos (struct t_weechat_plugin *plugin) +void +plugin_get_args (struct t_weechat_plugin *plugin, + int argc, char **argv, + int *plugin_argc, char ***plugin_argv) { - struct t_weechat_plugin *ptr_plugin; + int i, temp_argc; + char **temp_argv; - for (ptr_plugin = weechat_plugins; ptr_plugin; - ptr_plugin = ptr_plugin->next_plugin) + temp_argc = 0; + temp_argv = NULL; + + if (argc > 0) { - if (string_strcasecmp (plugin->name, ptr_plugin->name) < 0) - return ptr_plugin; + temp_argv = malloc ((argc + 1) * sizeof (*temp_argv)); + if (temp_argv) + { + for (i = 0; i < argc; i++) + { + if ((strcmp (argv[i], "-a") == 0) + || (strcmp (argv[i], "--no-connect") == 0) + || (strcmp (argv[i], "-s") == 0) + || (strcmp (argv[i], "--no-script") == 0) + || (strcmp (argv[i], "--upgrade") == 0) + || (strncmp (argv[i], plugin->name, + strlen (plugin->name)) == 0)) + { + temp_argv[temp_argc++] = argv[i]; + } + } + if (temp_argc == 0) + { + free (temp_argv); + temp_argv = NULL; + } + else + temp_argv[temp_argc] = NULL; + } } - return NULL; + + *plugin_argc = temp_argc; + *plugin_argv = temp_argv; +} + +/* + * Initializes a plugin by calling its init() function. + * + * Returns: + * 1: OK + * 0: error + */ + +int +plugin_call_init (struct t_weechat_plugin *plugin, int argc, char **argv) +{ + t_weechat_init_func *init_func; + int plugin_argc, rc; + char **plugin_argv; + + if (plugin->initialized) + return 1; + + /* look for plugin init function */ + init_func = dlsym (plugin->handle, "weechat_plugin_init"); + if (!init_func) + return 0; + + /* get arguments for the plugin */ + plugin_get_args (plugin, argc, argv, &plugin_argc, &plugin_argv); + + /* init plugin */ + if (weechat_debug_core >= 1) + { + gui_chat_printf (NULL, + _("Initializing plugin \"%s\" (priority: %d)"), + plugin->name, + plugin->priority); + } + rc = ((t_weechat_init_func *)init_func) (plugin, + plugin_argc, plugin_argv); + if (rc == WEECHAT_RC_OK) + { + plugin->initialized = 1; + } + else + { + gui_chat_printf (NULL, + _("%sError: unable to initialize plugin " + "\"%s\""), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + plugin->filename); + } + + if (plugin_argv) + free (plugin_argv); + + return (rc == WEECHAT_RC_OK) ? 1 : 0; } /* * Loads a WeeChat plugin (a dynamic library). * + * If init_plugin == 1, then the init() function in plugin is called + * (with argc/argv), otherwise the plugin is just loaded but not initialized. + * * Returns a pointer to new WeeChat plugin, NULL if error. */ struct t_weechat_plugin * -plugin_load (const char *filename, int argc, char **argv) +plugin_load (const char *filename, int init_plugin, int argc, char **argv) { void *handle; char *name, *api_version, *author, *description, *version; char *license, *charset; t_weechat_init_func *init_func; - int rc, i, plugin_argc; - char **plugin_argv; + int *priority; struct t_weechat_plugin *new_plugin; struct t_config_option *ptr_option; @@ -477,6 +567,13 @@ plugin_load (const char *filename, int argc, char **argv) return NULL; } + /* + * look for plugin priority: it is used to initialize plugins in + * appropriate order: the important plugins that don't depend on other + * plugins are initialized first + */ + priority = dlsym (handle, "weechat_plugin_priority"); + /* create new plugin */ new_plugin = malloc (sizeof (*new_plugin)); if (new_plugin) @@ -490,6 +587,9 @@ plugin_load (const char *filename, int argc, char **argv) new_plugin->version = strdup (version); new_plugin->license = strdup (license); new_plugin->charset = (charset) ? strdup (charset) : NULL; + new_plugin->priority = (priority) ? + *priority : PLUGIN_PRIORITY_DEFAULT; + new_plugin->initialized = 0; ptr_option = config_weechat_debug_get (name); new_plugin->debug = (ptr_option) ? CONFIG_INTEGER(ptr_option) : 0; @@ -798,55 +898,14 @@ plugin_load (const char *filename, int argc, char **argv) */ gui_buffer_set_plugin_for_upgrade (name, new_plugin); - /* build arguments for plugin */ - plugin_argc = 0; - plugin_argv = NULL; - if (argc > 0) + if (init_plugin) { - plugin_argv = malloc ((argc + 1) * sizeof (*plugin_argv)); - if (plugin_argv) + if (!plugin_call_init (new_plugin, argc, argv)) { - plugin_argc = 0; - for (i = 0; i < argc; i++) - { - if ((strcmp (argv[i], "-a") == 0) - || (strcmp (argv[i], "--no-connect") == 0) - || (strcmp (argv[i], "-s") == 0) - || (strcmp (argv[i], "--no-script") == 0) - || (strcmp (argv[i], "--upgrade") == 0) - || (strncmp (argv[i], name, strlen (name)) == 0)) - { - plugin_argv[plugin_argc] = argv[i]; - plugin_argc++; - } - } - if (plugin_argc == 0) - { - free (plugin_argv); - plugin_argv = NULL; - } - else - plugin_argv[plugin_argc] = NULL; + plugin_remove (new_plugin); + return NULL; } } - - /* init plugin */ - rc = ((t_weechat_init_func *)init_func) (new_plugin, - plugin_argc, plugin_argv); - - if (plugin_argv) - free (plugin_argv); - - if (rc != WEECHAT_RC_OK) - { - gui_chat_printf (NULL, - _("%sError: unable to initialize plugin " - "\"%s\""), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], - filename); - plugin_remove (new_plugin); - return NULL; - } } else { @@ -885,7 +944,28 @@ plugin_auto_load_file (void *args, const char *filename) plugin_args = (struct t_plugin_args *)args; if (plugin_check_extension_allowed (filename)) - plugin_load (filename, plugin_args->argc, plugin_args->argv); + plugin_load (filename, 0, plugin_args->argc, plugin_args->argv); +} + +/* + * Callback used to sort plugins arraylist by priority (high priority first). + */ + +int +plugin_arraylist_cmp_cb (void *data, struct t_arraylist *arraylist, + void *pointer1, void *pointer2) +{ + struct t_weechat_plugin *plugin1, *plugin2; + + /* make C compiler happy */ + (void) data; + (void) arraylist; + + plugin1 = (struct t_weechat_plugin *)pointer1; + plugin2 = (struct t_weechat_plugin *)pointer2; + + return (plugin1->priority > plugin2->priority) ? + -1 : ((plugin1->priority < plugin2->priority) ? 1 : 0); } /* @@ -896,8 +976,10 @@ void plugin_auto_load (int argc, char **argv) { char *dir_name, *plugin_path, *plugin_path2; + struct t_weechat_plugin *ptr_plugin; struct t_plugin_args plugin_args; - int length; + struct t_arraylist *arraylist; + int length, i; plugin_args.argc = argc; plugin_args.argv = argv; @@ -950,6 +1032,36 @@ plugin_auto_load (int argc, char **argv) plugin_autoload_array = NULL; } plugin_autoload_count = 0; + + /* initialize all uninitialized plugins */ + arraylist = arraylist_new (10, 1, 1, + &plugin_arraylist_cmp_cb, NULL, NULL, NULL); + if (arraylist) + { + for (ptr_plugin = weechat_plugins; ptr_plugin; + ptr_plugin = ptr_plugin->next_plugin) + { + arraylist_add (arraylist, ptr_plugin); + } + i = 0; + while (i < arraylist_size (arraylist)) + { + ptr_plugin = arraylist_get (arraylist, i); + if (!ptr_plugin->initialized) + { + if (!plugin_call_init (ptr_plugin, argc, argv)) + { + plugin_remove (ptr_plugin); + arraylist_remove (arraylist, i); + } + else + i++; + } + else + i++; + } + arraylist_free (arraylist); + } } /* @@ -1038,9 +1150,12 @@ plugin_unload (struct t_weechat_plugin *plugin) name = (plugin->name) ? strdup (plugin->name) : NULL; - end_func = dlsym (plugin->handle, "weechat_plugin_end"); - if (end_func) - (void) (end_func) (plugin); + if (plugin->initialized) + { + end_func = dlsym (plugin->handle, "weechat_plugin_end"); + if (end_func) + (void) (end_func) (plugin); + } plugin_remove (plugin); @@ -1118,7 +1233,7 @@ plugin_reload_name (const char *name, int argc, char **argv) if (filename) { plugin_unload (ptr_plugin); - plugin_load (filename, argc, argv); + plugin_load (filename, 1, argc, argv); free (filename); } } @@ -1244,6 +1359,8 @@ plugin_hdata_plugin_cb (void *data, const char *hdata_name) HDATA_VAR(struct t_weechat_plugin, version, STRING, 0, NULL, NULL); HDATA_VAR(struct t_weechat_plugin, license, STRING, 0, NULL, NULL); HDATA_VAR(struct t_weechat_plugin, charset, STRING, 0, NULL, NULL); + HDATA_VAR(struct t_weechat_plugin, priority, INTEGER, 0, NULL, NULL); + HDATA_VAR(struct t_weechat_plugin, initialized, INTEGER, 0, NULL, NULL); HDATA_VAR(struct t_weechat_plugin, debug, INTEGER, 0, NULL, NULL); HDATA_VAR(struct t_weechat_plugin, prev_plugin, POINTER, 0, NULL, hdata_name); HDATA_VAR(struct t_weechat_plugin, next_plugin, POINTER, 0, NULL, hdata_name); @@ -1296,6 +1413,10 @@ plugin_add_to_infolist (struct t_infolist *infolist, return 0; if (!infolist_new_var_string (ptr_item, "charset", plugin->charset)) return 0; + if (!infolist_new_var_integer (ptr_item, "priority", plugin->priority)) + return 0; + if (!infolist_new_var_integer (ptr_item, "initialized", plugin->initialized)) + return 0; if (!infolist_new_var_integer (ptr_item, "debug", plugin->debug)) return 0; @@ -1322,6 +1443,8 @@ plugin_print_log () log_printf (" description. . . . . . : '%s'", ptr_plugin->description); log_printf (" version. . . . . . . . : '%s'", ptr_plugin->version); log_printf (" charset. . . . . . . . : '%s'", ptr_plugin->charset); + log_printf (" priority . . . . . . . : %d", ptr_plugin->priority); + log_printf (" initialized. . . . . . : %d", ptr_plugin->initialized); log_printf (" debug. . . . . . . . . : %d", ptr_plugin->debug); log_printf (" prev_plugin. . . . . . : 0x%lx", ptr_plugin->prev_plugin); log_printf (" next_plugin. . . . . . : 0x%lx", ptr_plugin->next_plugin); diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h index 1240a1805..08028f95a 100644 --- a/src/plugins/plugin.h +++ b/src/plugins/plugin.h @@ -24,6 +24,8 @@ #define PLUGIN_CORE "core" +#define PLUGIN_PRIORITY_DEFAULT 1000 + typedef int (t_weechat_init_func) (struct t_weechat_plugin *plugin, int argc, char *argv[]); typedef int (t_weechat_end_func) (struct t_weechat_plugin *plugin); @@ -35,6 +37,7 @@ extern int plugin_valid (struct t_weechat_plugin *plugin); extern struct t_weechat_plugin *plugin_search (const char *name); 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_unload (struct t_weechat_plugin *plugin); diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c index 5a8ea1bc0..434bb6536 100644 --- a/src/plugins/python/weechat-python.c +++ b/src/plugins/python/weechat-python.c @@ -39,6 +39,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("Support of python scripts")); WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(3000); struct t_weechat_plugin *weechat_python_plugin = NULL; diff --git a/src/plugins/relay/relay.c b/src/plugins/relay/relay.c index cca154afc..ead40834c 100644 --- a/src/plugins/relay/relay.c +++ b/src/plugins/relay/relay.c @@ -42,6 +42,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("Relay WeeChat data to remote application " WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(4000); struct t_weechat_plugin *weechat_relay_plugin = NULL; diff --git a/src/plugins/ruby/weechat-ruby.c b/src/plugins/ruby/weechat-ruby.c index 12c1fc880..6be92393e 100644 --- a/src/plugins/ruby/weechat-ruby.c +++ b/src/plugins/ruby/weechat-ruby.c @@ -61,6 +61,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("Support of ruby scripts")); WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(3000); struct t_weechat_plugin *weechat_ruby_plugin = NULL; diff --git a/src/plugins/script/script.c b/src/plugins/script/script.c index b1723ebee..8e0c690f8 100644 --- a/src/plugins/script/script.c +++ b/src/plugins/script/script.c @@ -40,6 +40,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("Scripts manager")); WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(2000); struct t_weechat_plugin *weechat_script_plugin = NULL; diff --git a/src/plugins/tcl/weechat-tcl.c b/src/plugins/tcl/weechat-tcl.c index f40ebecb0..d72f18572 100644 --- a/src/plugins/tcl/weechat-tcl.c +++ b/src/plugins/tcl/weechat-tcl.c @@ -40,6 +40,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("Support of tcl scripts")); WEECHAT_PLUGIN_AUTHOR("Dmitry Kobylin <fnfal@academ.tsc.ru>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(3000); struct t_weechat_plugin *weechat_tcl_plugin = NULL; diff --git a/src/plugins/trigger/trigger.c b/src/plugins/trigger/trigger.c index 8aae71c7c..fb77c3f19 100644 --- a/src/plugins/trigger/trigger.c +++ b/src/plugins/trigger/trigger.c @@ -38,6 +38,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("Text replacement and command execution on events WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(10000); struct t_weechat_plugin *weechat_trigger_plugin = NULL; diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index c1ae5900d..c6ad8e3ec 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -57,7 +57,7 @@ struct timeval; * please change the date with current one; for a second change at same * date, increment the 01, otherwise please keep 01. */ -#define WEECHAT_PLUGIN_API_VERSION "20141122-01" +#define WEECHAT_PLUGIN_API_VERSION "20150114-01" /* macros for defining plugin infos */ #define WEECHAT_PLUGIN_NAME(__name) \ @@ -71,6 +71,8 @@ struct timeval; char weechat_plugin_version[] = __version; #define WEECHAT_PLUGIN_LICENSE(__license) \ char weechat_plugin_license[] = __license; +#define WEECHAT_PLUGIN_PRIORITY(__priority) \ + int weechat_plugin_priority = __priority; /* return codes for plugin functions */ #define WEECHAT_RC_OK 0 @@ -235,6 +237,8 @@ struct t_weechat_plugin char *version; /* plugin version */ char *license; /* license */ char *charset; /* charset used by plugin */ + int priority; /* plugin priority (default is 1000) */ + int initialized; /* plugin initialized? (init called) */ int debug; /* debug level for plugin (0=off) */ struct t_weechat_plugin *prev_plugin; /* link to previous plugin */ struct t_weechat_plugin *next_plugin; /* link to next plugin */ diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c index 248b12b49..d7d14c41c 100644 --- a/src/plugins/xfer/xfer.c +++ b/src/plugins/xfer/xfer.c @@ -50,6 +50,7 @@ WEECHAT_PLUGIN_DESCRIPTION(N_("DCC file transfer and direct chat")); WEECHAT_PLUGIN_AUTHOR("Sébastien Helleu <flashcode@flashtux.org>"); WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); +WEECHAT_PLUGIN_PRIORITY(6000); struct t_weechat_plugin *weechat_xfer_plugin = NULL; |