Permalink
Browse files

Check `save_config_on_unload` on plugin unload

Plugins were not checking the value of `plugin.save_config_on_unload`
and thus always writing their configuration to file on exit. The
`weechat_config_write` macro now checks this preference before writing
to file.

Macro returns WEECHAT_CONFIG_WRITE_OK when the file is not written due
to user preference.
  • Loading branch information...
1 parent a1b9a89 commit 0d60de4a2c6cbfb101a0f23b861704f331e0e5c7 @guns committed Sep 10, 2011
Showing with 5 additions and 2 deletions.
  1. +2 −1 src/plugins/plugin.c
  2. +3 −1 src/plugins/weechat-plugin.h
@@ -1159,7 +1159,8 @@ void
plugin_end ()
{
/* write plugins config options */
- plugin_config_write ();
+ if (CONFIG_BOOLEAN(config_plugin_save_config_on_unload))
+ plugin_config_write ();
/* unload all plugins */
plugin_unload_all ();
@@ -1170,7 +1170,9 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
#define weechat_config_write_line(__config, __option, __value...) \
weechat_plugin->config_write_line(__config, __option, ##__value)
#define weechat_config_write(__config) \
- weechat_plugin->config_write(__config)
+ ((weechat_config_boolean \
+ (weechat_config_get ("weechat.plugin.save_config_on_unload"))) ? \
+ weechat_plugin->config_write(__config) : WEECHAT_CONFIG_WRITE_OK)
#define weechat_config_read(__config) \
weechat_plugin->config_read(__config)
#define weechat_config_reload(__config) \

0 comments on commit 0d60de4

Please sign in to comment.