summary refs log tree commit diff stats
path: root/src/common/plugin.c
diff options
context:
space:
mode:
authorBerke Viktor <berkeviktor@aol.com>2012-01-14 00:29:01 +0100
committerBerke Viktor <berkeviktor@aol.com>2012-01-14 00:29:01 +0100
commitc3821b6316c3d25ef6affd5215796d3abbefd2fe (patch)
tree37bcf84cb8417c0c91ce42d8d38f5d5e896dbef9 /src/common/plugin.c
parentc979a8a8b7493538dde5b80936b298ad6b57c877 (diff)
skeleton for xchat_del_pluginpref
Diffstat (limited to 'src/common/plugin.c')
-rw-r--r--src/common/plugin.c21
1 files changed, 18 insertions, 3 deletions
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;
@@ -1684,6 +1687,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)
 {
 	int fh;
@@ -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);
+}