From c3821b6316c3d25ef6affd5215796d3abbefd2fe Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sat, 14 Jan 2012 00:29:01 +0100 Subject: skeleton for xchat_del_pluginpref --- src/common/plugin.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/common/plugin.c') diff --git a/src/common/plugin.c b/src/common/plugin.c index 5ed20b87..02cdcce5 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -274,6 +274,7 @@ plugin_add (session *sess, char *filename, void *handle, void *init_func, pl->xchat_get_pluginpref_str = xchat_get_pluginpref_str; pl->xchat_set_pluginpref_int = xchat_set_pluginpref_int; pl->xchat_get_pluginpref_int = xchat_get_pluginpref_int; + pl->xchat_del_pluginpref = xchat_del_pluginpref; /* incase new plugins are loaded on older xchat */ pl->xchat_dummy4 = xchat_dummy; @@ -1587,9 +1588,11 @@ xchat_free (xchat_plugin *ph, void *ptr) g_free (ptr); } -int -xchat_set_pluginpref_str (xchat_plugin *pl, const char *var, const char *value) +static int +xchat_set_pluginpref_str_real (xchat_plugin *pl, const char *var, const char *value, int mode) { + /* mode: 0 = delete, 1 = save */ + FILE *fpIn; int fhOut; int prevConfig; @@ -1683,6 +1686,12 @@ xchat_set_pluginpref_str (xchat_plugin *pl, const char *var, const char *value) } } +int +xchat_set_pluginpref_str (xchat_plugin *pl, const char *var, const char *value) +{ + return xchat_set_pluginpref_str (pl, var, value, 1); +} + int xchat_get_pluginpref_str (xchat_plugin *pl, const char *var, char *dest) { @@ -1741,7 +1750,7 @@ xchat_set_pluginpref_int (xchat_plugin *pl, const char *var, int value) char buffer[12]; sprintf (buffer, "%d", value); - return xchat_set_pluginpref_str (pl, var, buffer); + return xchat_set_pluginpref_str_real (pl, var, buffer, 1); } int @@ -1758,3 +1767,9 @@ xchat_get_pluginpref_int (xchat_plugin *pl, const char *var) return -1; } } + +int +xchat_del_pluginpref (xchat_plugin *pl, const char *var) +{ + xchat_set_pluginpref_str_real (pl, var, 0, 0); +} -- cgit 1.4.1