summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2007-12-01 10:25:59 +0100
committerSebastien Helleu <flashcode@flashtux.org>2007-12-01 10:25:59 +0100
commitd9755e237b12cc5c22857e4ef720cbbcf11173d7 (patch)
treeb1261fff7e69470f1ed9f856ee997c405167f380 /src/plugins
parent59fb878b77320844d7d2150c95ce22c253ffb4e6 (diff)
downloadweechat-d9755e237b12cc5c22857e4ef720cbbcf11173d7.zip
Added /reload command
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/plugin-api.c4
-rw-r--r--src/plugins/plugin-config.c50
-rw-r--r--src/plugins/plugin-config.h2
-rw-r--r--src/plugins/plugin.c1
4 files changed, 36 insertions, 21 deletions
diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c
index 7c91277e3..1dbb9372d 100644
--- a/src/plugins/plugin-api.c
+++ b/src/plugins/plugin-api.c
@@ -1219,10 +1219,8 @@ plugin_api_plugin_config_set (struct t_weechat_plugin *plugin,
return 0;
if (plugin_config_set (plugin->name, option_name, value))
- {
- plugin_config_write ();
return 1;
- }
+
return 0;
}
diff --git a/src/plugins/plugin-config.c b/src/plugins/plugin-config.c
index b621e0a71..d21418101 100644
--- a/src/plugins/plugin-config.c
+++ b/src/plugins/plugin-config.c
@@ -280,36 +280,50 @@ plugin_config_write_options (struct t_config_file *config_file)
}
/*
- * plugin_config_read: read WeeChat plugins configuration file
+ * plugin_config_init: init plugins config structure
+ */
+
+void
+plugin_config_init ()
+{
+ plugin_config = config_file_new (PLUGIN_CONFIG_FILENAME);
+ if (plugin_config)
+ {
+ config_file_new_section (plugin_config, "plugin",
+ &plugin_config_read_option,
+ &plugin_config_write_options,
+ NULL);
+ }
+}
+
+/*
+ * plugin_config_read: read plugins configuration file
* return: 0 = successful
* -1 = config file file not found
* -2 = error in config file
- * -3 = not enough memory
*/
int
plugin_config_read ()
{
- if (!plugin_config)
- {
- plugin_config = config_file_new (PLUGIN_CONFIG_FILENAME);
- if (plugin_config)
- {
- config_file_new_section (plugin_config, "plugin",
- &plugin_config_read_option,
- &plugin_config_write_options,
- NULL);
- }
- }
-
- if (!plugin_config)
- return -3;
-
return config_file_read (plugin_config);
}
/*
- * plugin_config_write: write WeeChat configuration file
+ * plugin_config_reload: read plugins configuration file
+ * return: 0 = successful
+ * -1 = config file file not found
+ * -2 = error in config file
+ */
+
+int
+plugin_config_reload ()
+{
+ return config_file_reload (plugin_config);
+}
+
+/*
+ * plugin_config_write: write plugins configuration file
* return: 0 if ok
* < 0 if error
*/
diff --git a/src/plugins/plugin-config.h b/src/plugins/plugin-config.h
index 7558388ba..24e67101d 100644
--- a/src/plugins/plugin-config.h
+++ b/src/plugins/plugin-config.h
@@ -29,7 +29,9 @@ extern struct t_config_option *plugin_config_search_internal (char *);
extern struct t_config_option *plugin_config_search (char *, char *);
extern int plugin_config_set_internal (char *, char *);
extern int plugin_config_set (char *, char *, char *);
+extern void plugin_config_init ();
extern int plugin_config_read ();
+extern int plugin_config_reload ();
extern int plugin_config_write ();
#endif /* plugin-config.h */
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 54eea1191..b8fa1597d 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -566,6 +566,7 @@ void
plugin_init (int auto_load)
{
/* read plugins options on disk */
+ plugin_config_init ();
plugin_config_read ();
/* auto-load plugins if asked */