summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--doc/en/autogen/user/weechat_options.txt2
-rw-r--r--doc/fr/autogen/user/weechat_options.txt2
-rw-r--r--doc/it/autogen/user/weechat_options.txt2
-rw-r--r--po/cs.po8
-rw-r--r--po/de.po8
-rw-r--r--po/es.po8
-rw-r--r--po/fr.po19
-rw-r--r--po/hu.po7
-rw-r--r--po/it.po8
-rw-r--r--po/pl.po8
-rw-r--r--po/ru.po7
-rw-r--r--po/weechat.pot7
-rw-r--r--src/core/wee-config.c7
-rw-r--r--src/plugins/plugin.c190
15 files changed, 193 insertions, 95 deletions
diff --git a/ChangeLog b/ChangeLog
index 7d2895aa7..6a339aba7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
FlashCode <flashcode@flashtux.org>
-v0.3.2-dev, 2010-03-30
+v0.3.2-dev, 2010-03-31
Version 0.3.2 (under dev!)
@@ -11,6 +11,9 @@ Version 0.3.2 (under dev!)
* core: add new command /mute
* core: add command line option "-s" (or "--no-script") to start WeeChat
without loading any script
+* core: improve plugins autoload (option weechat.plugin.autoload): allow to
+ use "*" as joker and "!" to prevent a plugin from being autoloaded
+ (task #6361)
* core: remove unneeded space after time on each line if option
weechat.look.buffer_time_format is set to empty value (bug #28751)
* core: add option "switch_active_buffer_previous" for command /input
diff --git a/doc/en/autogen/user/weechat_options.txt b/doc/en/autogen/user/weechat_options.txt
index d98890259..f8a4a37b4 100644
--- a/doc/en/autogen/user/weechat_options.txt
+++ b/doc/en/autogen/user/weechat_options.txt
@@ -574,7 +574,7 @@
** values: any string (default value: "%h/ssl/CAs.pem")
* *weechat.plugin.autoload*
-** description: comma separated list of plugins to load automatically at startup, "*" means all plugins found (names may be partial, for example "perl" is ok for "perl.so")
+** description: comma separated list of plugins to load automatically at startup, "*" means all plugins found, a name beginning with "!" is a negative value to prevent a plugin from being loaded, names can start or end with "*" to match several plugins (examples: "*", "*,!lua,!tcl")
** type: string
** values: any string (default value: "*")
diff --git a/doc/fr/autogen/user/weechat_options.txt b/doc/fr/autogen/user/weechat_options.txt
index 69edb721c..52d8b27dd 100644
--- a/doc/fr/autogen/user/weechat_options.txt
+++ b/doc/fr/autogen/user/weechat_options.txt
@@ -574,7 +574,7 @@
** valeurs: toute chaîne (valeur par défaut: "%h/ssl/CAs.pem")
* *weechat.plugin.autoload*
-** description: liste des extensions à charger automatiquement au démarrage, "*" signifie toutes (séparées par des virgules, les noms peuvent être partiels, par exemple "perl" est ok pour "perl.so")
+** description: liste des extensions à charger automatiquement au démarrage (séparées par des virgules), "*" signifie toutes les extensions trouvées, un nom commençant par "!" est une valeur négative pour empêcher une extension d'être chargée, les noms peuvent commencer ou se terminer par "*" pour indiquer plusieurs extensions (exemples: "*", "*,!lua,!tcl")
** type: chaîne
** valeurs: toute chaîne (valeur par défaut: "*")
diff --git a/doc/it/autogen/user/weechat_options.txt b/doc/it/autogen/user/weechat_options.txt
index 73f49f4a7..f1e2567ef 100644
--- a/doc/it/autogen/user/weechat_options.txt
+++ b/doc/it/autogen/user/weechat_options.txt
@@ -574,7 +574,7 @@
** valori: qualsiasi stringa (valore predefinito: "%h/ssl/CAs.pem")
* *weechat.plugin.autoload*
-** descrizione: elenco separato da virgole di plugin da caricare automaticamente all'avvio, "*" per tutti i plugin trovati (nomi possono essere parziali, per esempio "perl" va bene per "perl.so")
+** descrizione: comma separated list of plugins to load automatically at startup, "*" means all plugins found, a name beginning with "!" is a negative value to prevent a plugin from being loaded, names can start or end with "*" to match several plugins (examples: "*", "*,!lua,!tcl")
** tipo: stringa
** valori: qualsiasi stringa (valore predefinito: "*")
diff --git a/po/cs.po b/po/cs.po
index 80aec1f64..988a22d23 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-03-29 18:13+0200\n"
+"POT-Creation-Date: 2010-03-31 19:56+0200\n"
"PO-Revision-Date: 2010-03-23 10:19+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2065,10 +2065,12 @@ msgstr ""
msgid "file containing the certificate authorities"
msgstr "soubor obsahuje certifikační autority"
+#, fuzzy
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
-"means all plugins found (names may be partial, for example \"perl\" is ok "
-"for \"perl.so\")"
+"means all plugins found, a name beginning with \"!\" is a negative value to "
+"prevent a plugin from being loaded, names can start or end with \"*\" to "
+"match several plugins (examples: \"*\", \"*,!lua,!tcl\")"
msgstr ""
"čárkou rozdělený seznam pluginů pro automatické načtení při spuštění \"*\" "
"znamená všechny nalezené pluginy (jména mohou být částečná, například \"perl"
diff --git a/po/de.po b/po/de.po
index aae7865f1..5764d60ea 100644
--- a/po/de.po
+++ b/po/de.po
@@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-03-29 18:13+0200\n"
+"POT-Creation-Date: 2010-03-31 19:56+0200\n"
"PO-Revision-Date: 2010-03-29 22:38+0200\n"
"Last-Translator: Nils G <weechatter@arcor.de>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2176,10 +2176,12 @@ msgstr ""
msgid "file containing the certificate authorities"
msgstr "Datei enthält die Zertifizierungsstellen."
+#, fuzzy
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
-"means all plugins found (names may be partial, for example \"perl\" is ok "
-"for \"perl.so\")"
+"means all plugins found, a name beginning with \"!\" is a negative value to "
+"prevent a plugin from being loaded, names can start or end with \"*\" to "
+"match several plugins (examples: \"*\", \"*,!lua,!tcl\")"
msgstr ""
"Durch Kommata getrennte Liste der Erweiterungen, die beim Start automatisch "
"geladen werden sollen, \"*\" lädt alle gefundenen Erweiterungen (es können "
diff --git a/po/es.po b/po/es.po
index 5315e6ac8..c2429e3f2 100644
--- a/po/es.po
+++ b/po/es.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-03-29 18:13+0200\n"
+"POT-Creation-Date: 2010-03-31 19:56+0200\n"
"PO-Revision-Date: 2010-03-23 10:20+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2074,10 +2074,12 @@ msgstr ""
msgid "file containing the certificate authorities"
msgstr "archivo que contiene las autoridades de certificación"
+#, fuzzy
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
-"means all plugins found (names may be partial, for example \"perl\" is ok "
-"for \"perl.so\")"
+"means all plugins found, a name beginning with \"!\" is a negative value to "
+"prevent a plugin from being loaded, names can start or end with \"*\" to "
+"match several plugins (examples: \"*\", \"*,!lua,!tcl\")"
msgstr ""
"lista de plugins separados por comas para cargar automáticamente al iniciar, "
"\"*\" significa todos los plugins encontrados (los nombres pueden ser "
diff --git a/po/fr.po b/po/fr.po
index cfe609d48..7d9615333 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-03-29 18:13+0200\n"
-"PO-Revision-Date: 2010-03-29 18:16+0200\n"
+"POT-Creation-Date: 2010-03-31 19:56+0200\n"
+"PO-Revision-Date: 2010-03-31 19:57+0200\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -2145,12 +2145,15 @@ msgstr "fichier contenant les autorités de certification"
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
-"means all plugins found (names may be partial, for example \"perl\" is ok "
-"for \"perl.so\")"
-msgstr ""
-"liste des extensions à charger automatiquement au démarrage, \"*\" signifie "
-"toutes (séparées par des virgules, les noms peuvent être partiels, par "
-"exemple \"perl\" est ok pour \"perl.so\")"
+"means all plugins found, a name beginning with \"!\" is a negative value to "
+"prevent a plugin from being loaded, names can start or end with \"*\" to "
+"match several plugins (examples: \"*\", \"*,!lua,!tcl\")"
+msgstr ""
+"liste des extensions à charger automatiquement au démarrage (séparées par "
+"des virgules), \"*\" signifie toutes les extensions trouvées, un nom "
+"commençant par \"!\" est une valeur négative pour empêcher une extension "
+"d'être chargée, les noms peuvent commencer ou se terminer par \"*\" pour "
+"indiquer plusieurs extensions (exemples: \"*\", \"*,!lua,!tcl\")"
msgid ""
"enable debug messages by default in all plugins (option disabled by default, "
diff --git a/po/hu.po b/po/hu.po
index a8659a1ae..0d0872f92 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-03-29 18:13+0200\n"
+"POT-Creation-Date: 2010-03-31 19:56+0200\n"
"PO-Revision-Date: 2010-03-23 10:20+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1953,8 +1953,9 @@ msgstr ""
#, fuzzy
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
-"means all plugins found (names may be partial, for example \"perl\" is ok "
-"for \"perl.so\")"
+"means all plugins found, a name beginning with \"!\" is a negative value to "
+"prevent a plugin from being loaded, names can start or end with \"*\" to "
+"match several plugins (examples: \"*\", \"*,!lua,!tcl\")"
msgstr ""
"automatikusan betöltendő modulok vesszővel elválasztott listája, \"*\" "
"esetén az összes fellelt modul (az elnevezés lehet részleges, például a "
diff --git a/po/it.po b/po/it.po
index 63ce0a1c1..9e3a5a0b2 100644
--- a/po/it.po
+++ b/po/it.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Weechat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-03-29 18:13+0200\n"
+"POT-Creation-Date: 2010-03-31 19:56+0200\n"
"PO-Revision-Date: 2010-03-24 14:20+0100\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2117,10 +2117,12 @@ msgstr ""
msgid "file containing the certificate authorities"
msgstr "file contenente le autorità dei certificati"
+#, fuzzy
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
-"means all plugins found (names may be partial, for example \"perl\" is ok "
-"for \"perl.so\")"
+"means all plugins found, a name beginning with \"!\" is a negative value to "
+"prevent a plugin from being loaded, names can start or end with \"*\" to "
+"match several plugins (examples: \"*\", \"*,!lua,!tcl\")"
msgstr ""
"elenco separato da virgole di plugin da caricare automaticamente all'avvio, "
"\"*\" per tutti i plugin trovati (nomi possono essere parziali, per esempio "
diff --git a/po/pl.po b/po/pl.po
index 409e8368d..feed0679e 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-03-29 18:13+0200\n"
+"POT-Creation-Date: 2010-03-31 19:56+0200\n"
"PO-Revision-Date: 2010-03-23 10:20+0100\n"
"Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n"
"Language-Team: Polish\n"
@@ -2092,10 +2092,12 @@ msgstr ""
msgid "file containing the certificate authorities"
msgstr "plik zawierający dane centrum uwieżytelniającego (CA)"
+#, fuzzy
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
-"means all plugins found (names may be partial, for example \"perl\" is ok "
-"for \"perl.so\")"
+"means all plugins found, a name beginning with \"!\" is a negative value to "
+"prevent a plugin from being loaded, names can start or end with \"*\" to "
+"match several plugins (examples: \"*\", \"*,!lua,!tcl\")"
msgstr ""
"oddzielona przecinkami lista wtyczek do automatycznego załadowania podczas "
"startu, \"*\" oznacza wszystkie znalezione wtyczki (nazwy mogą być "
diff --git a/po/ru.po b/po/ru.po
index 44b5238dd..b0ac72512 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.2-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-03-29 18:13+0200\n"
+"POT-Creation-Date: 2010-03-31 19:56+0200\n"
"PO-Revision-Date: 2010-03-23 10:20+0100\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1960,8 +1960,9 @@ msgstr ""
#, fuzzy
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
-"means all plugins found (names may be partial, for example \"perl\" is ok "
-"for \"perl.so\")"
+"means all plugins found, a name beginning with \"!\" is a negative value to "
+"prevent a plugin from being loaded, names can start or end with \"*\" to "
+"match several plugins (examples: \"*\", \"*,!lua,!tcl\")"
msgstr ""
"разделённый запятыми список автоматически загружаемых при запуске plug-"
"in'ов , \"*\" означает все найденные plug-in'ы (имена могут быть не полными, "
diff --git a/po/weechat.pot b/po/weechat.pot
index 0960fb9a0..92e35ad3a 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2010-03-29 18:13+0200\n"
+"POT-Creation-Date: 2010-03-31 19:56+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -1664,8 +1664,9 @@ msgstr ""
msgid ""
"comma separated list of plugins to load automatically at startup, \"*\" "
-"means all plugins found (names may be partial, for example \"perl\" is ok "
-"for \"perl.so\")"
+"means all plugins found, a name beginning with \"!\" is a negative value to "
+"prevent a plugin from being loaded, names can start or end with \"*\" to "
+"match several plugins (examples: \"*\", \"*,!lua,!tcl\")"
msgstr ""
msgid ""
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index e7006f996..500d7419f 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -1992,9 +1992,10 @@ config_weechat_init_options ()
weechat_config_file, ptr_section,
"autoload", "string",
N_("comma separated list of plugins to load automatically "
- "at startup, \"*\" means all plugins found (names may "
- "be partial, for example \"perl\" is ok for "
- "\"perl.so\")"),
+ "at startup, \"*\" means all plugins found, a name beginning with "
+ "\"!\" is a negative value to prevent a plugin from being loaded, "
+ "names can start or end with \"*\" to match several plugins "
+ "(examples: \"*\", \"*,!lua,!tcl\")"),
NULL, 0, 0, "*", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_plugin_debug = config_file_new_option (
weechat_config_file, ptr_section,
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 6bd6d420b..37b33e60c 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
+#include <libgen.h>
#include <stdarg.h>
#include <string.h>
#include <sys/types.h>
@@ -63,6 +64,10 @@ struct t_weechat_plugin *last_weechat_plugin = NULL;
int plugin_argc; /* command line arguments (used only */
char **plugin_argv; /* first time loading plugin) */
+int plugin_autoload_count = 0; /* number of items in autoload_array */
+char **plugin_autoload_array = NULL; /* autoload array, this is split of */
+ /* option "weechat.plugin.autoload" */
+
void plugin_remove (struct t_weechat_plugin *plugin);
@@ -128,6 +133,80 @@ plugin_get_name (struct t_weechat_plugin *plugin)
}
/*
+ * plugin_check_autoload: check if a plugin can be autoloaded or not
+ * return 1 if plugin can be autoloaded
+ * 0 if plugin can NOT be autoloaded
+ * list of autoloaded plugins is set in option
+ * "weechat.plugin.autoload"
+ */
+
+int
+plugin_check_autoload (char *plugin_full_name)
+{
+ int i, plugin_authorized, plugin_blacklisted;
+ char *ptr_base_name, *base_name, *plugin_name, *pos;
+
+ /* by default we can auto load all plugins */
+ if (!plugin_autoload_array)
+ return 1;
+
+ /* get short name of plugin (filename without extension) */
+ plugin_name = NULL;
+ ptr_base_name = basename (plugin_full_name);
+ if (!ptr_base_name)
+ return 1;
+
+ base_name = strdup (ptr_base_name);
+ if (!base_name)
+ return 1;
+
+ if (CONFIG_STRING(config_plugin_extension)
+ && CONFIG_STRING(config_plugin_extension)[0])
+ {
+ pos = strstr (base_name,
+ CONFIG_STRING(config_plugin_extension));
+ plugin_name = (pos) ?
+ string_strndup (base_name, pos - base_name) :
+ strdup (base_name);
+ }
+ else
+ plugin_name = strdup (base_name);
+
+ free (base_name);
+
+ if (!plugin_name)
+ return 1;
+
+ /* browse array and check if plugin is "authorized" or "blacklisted" */
+ plugin_authorized = 0;
+ plugin_blacklisted = 0;
+ for (i = 0; i < plugin_autoload_count; i++)
+ {
+ if (plugin_autoload_array[i][0] == '!')
+ {
+ /*
+ * negative value: it is used to "blacklist" a plugin
+ * for example with "*,!perl", all plugins are loaded, but not perl
+ */
+ if (string_match (plugin_name, plugin_autoload_array[i] + 1, 0))
+ plugin_blacklisted = 1;
+ }
+ else
+ {
+ if (string_match (plugin_name, plugin_autoload_array[i], 0))
+ plugin_authorized = 1;
+ }
+ }
+
+ free (plugin_name);
+
+ if (plugin_blacklisted)
+ return 0;
+
+ return plugin_authorized;
+}
+
+/*
* plugin_find_pos: find position for a plugin (for sorting plugins list)
*/
@@ -171,6 +250,14 @@ plugin_load (const char *filename)
if (!full_name)
return NULL;
+ /*
+ * if plugin must not be autoloaded, then return immediately
+ * Note: the "plugin_autoload_array" variable is set only during auto-load,
+ * ie when WeeChat is starting or when doing /plugin autoload
+ */
+ if (plugin_autoload_array && !plugin_check_autoload (full_name))
+ return NULL;
+
ptr_home = getenv ("HOME");
full_name2 = string_replace (full_name, "~", ptr_home);
@@ -684,74 +771,65 @@ plugin_auto_load_file (void *plugin, const char *filename)
}
/*
- * plugin_auto_load: auto-load WeeChat plugins
+ * plugin_auto_load: auto-load WeeChat plugins, from user and system
+ * directories
*/
void
plugin_auto_load ()
{
char *ptr_home, *dir_name, *plugin_path, *plugin_path2;
- char *list_plugins, *pos, *pos2;
+
+ plugin_autoload_array = NULL;
+ plugin_autoload_count = 0;
if (CONFIG_STRING(config_plugin_autoload)
&& CONFIG_STRING(config_plugin_autoload)[0])
{
- if (string_strcasecmp (CONFIG_STRING(config_plugin_autoload),
- "*") == 0)
- {
- /* auto-load plugins in WeeChat home dir */
- if (CONFIG_STRING(config_plugin_path)
- && CONFIG_STRING(config_plugin_path)[0])
- {
- ptr_home = getenv ("HOME");
- plugin_path = string_replace (CONFIG_STRING(config_plugin_path),
- "~", ptr_home);
- plugin_path2 = string_replace ((plugin_path) ?
- plugin_path : CONFIG_STRING(config_plugin_path),
- "%h", weechat_home);
- util_exec_on_files ((plugin_path2) ?
- plugin_path2 : ((plugin_path) ?
- plugin_path : CONFIG_STRING(config_plugin_path)),
- 0,
- NULL,
- &plugin_auto_load_file);
- if (plugin_path)
- free (plugin_path);
- if (plugin_path2)
- free (plugin_path2);
- }
+ plugin_autoload_array = string_split (CONFIG_STRING(config_plugin_autoload),
+ ",", 0, 0,
+ &plugin_autoload_count);
+ }
- /* auto-load plugins in WeeChat global lib dir */
- dir_name = malloc (strlen (WEECHAT_LIBDIR) + 16);
- if (dir_name)
- {
- snprintf (dir_name, strlen (WEECHAT_LIBDIR) + 16,
- "%s/plugins", WEECHAT_LIBDIR);
- util_exec_on_files (dir_name, 0, NULL, &plugin_auto_load_file);
- free (dir_name);
- }
- }
- else
- {
- list_plugins = strdup (CONFIG_STRING(config_plugin_autoload));
- if (list_plugins)
- {
- pos = list_plugins;
- while (pos && pos[0])
- {
- pos2 = strchr (pos, ',');
- if (pos2)
- pos2[0] = '\0';
- plugin_load (pos);
- if (pos2)
- pos = pos2 + 1;
- else
- pos = NULL;
- }
- free (list_plugins);
- }
- }
+ /* auto-load plugins in WeeChat home dir */
+ if (CONFIG_STRING(config_plugin_path)
+ && CONFIG_STRING(config_plugin_path)[0])
+ {
+ ptr_home = getenv ("HOME");
+ plugin_path = string_replace (CONFIG_STRING(config_plugin_path),
+ "~", ptr_home);
+ plugin_path2 = string_replace ((plugin_path) ?
+ plugin_path : CONFIG_STRING(config_plugin_path),
+ "%h", weechat_home);
+ util_exec_on_files ((plugin_path2) ?
+ plugin_path2 : ((plugin_path) ?
+ plugin_path : CONFIG_STRING(config_plugin_path)),
+ 0,
+ NULL,
+ &plugin_auto_load_file);
+ if (plugin_path)
+ free (plugin_path);
+ if (plugin_path2)
+ free (plugin_path2);
+ }
+
+ /* auto-load plugins in WeeChat global lib dir */
+ dir_name = malloc (strlen (WEECHAT_LIBDIR) + 16);
+ if (dir_name)
+ {
+ snprintf (dir_name, strlen (WEECHAT_LIBDIR) + 16,
+ "%s/plugins", WEECHAT_LIBDIR);
+ util_exec_on_files (dir_name, 0, NULL, &plugin_auto_load_file);
+ free (dir_name);
+ }
+
+ /* free autoload array */
+ if (plugin_autoload_array)
+ {
+ string_free_split (plugin_autoload_array);
+ plugin_autoload_array = NULL;
}
+ plugin_autoload_count = 0;
}
/*