summary refs log tree commit diff stats
path: root/src/common/plugin.c
diff options
context:
space:
mode:
authorBerke Viktor <berkeviktor@aol.com>2011-11-30 08:28:19 +0100
committerBerke Viktor <berkeviktor@aol.com>2011-11-30 08:28:19 +0100
commit1567d326971811fd956042aaa43c932d247b4681 (patch)
tree569a9e8c4fd495a9614fdc6e0dc9d78060375831 /src/common/plugin.c
parentf49caf67f642336888a63d61f60b458236df19ad (diff)
plugin config - separate string and int functions
Diffstat (limited to 'src/common/plugin.c')
-rw-r--r--src/common/plugin.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/common/plugin.c b/src/common/plugin.c
index 41690038..bd960ea5 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c
@@ -270,8 +270,10 @@ plugin_add (session *sess, char *filename, void *handle, void *init_func,
 		pl->xchat_send_modes = xchat_send_modes;
 		pl->xchat_strip = xchat_strip;
 		pl->xchat_free = xchat_free;
-		pl->xchat_set_plugin_pref = xchat_set_plugin_pref;
-		pl->xchat_get_plugin_pref = xchat_get_plugin_pref;
+		pl->xchat_set_plugin_pref_str = xchat_set_plugin_pref_str;
+		pl->xchat_get_plugin_pref_str = xchat_get_plugin_pref_str;
+		pl->xchat_set_plugin_pref_int = xchat_set_plugin_pref_int;
+		pl->xchat_get_plugin_pref_int= xchat_get_plugin_pref_int;
 
 		/* incase new plugins are loaded on older xchat */
 		pl->xchat_dummy4 = xchat_dummy;
@@ -1582,7 +1584,7 @@ xchat_free (xchat_plugin *ph, void *ptr)
 }
 
 int
-xchat_set_plugin_pref (xchat_plugin *pl, char *var, char *value)
+xchat_set_plugin_pref_str (xchat_plugin *pl, char *var, char *value)
 {
 	FILE *fpIn;
 	int fhOut;
@@ -1678,7 +1680,7 @@ xchat_set_plugin_pref (xchat_plugin *pl, char *var, char *value)
 }
 
 int
-xchat_get_plugin_pref (xchat_plugin *pl, char *var, char *dest)
+xchat_get_plugin_pref_str (xchat_plugin *pl, char *var, char *dest)
 {
 	int fh;
 	int l;
@@ -1728,3 +1730,19 @@ xchat_get_plugin_pref (xchat_plugin *pl, char *var, char *dest)
 	close (fh);
 	return 1;
 }
+
+int
+xchat_set_plugin_pref_int (xchat_plugin *pl, char *var, int value)
+{
+	char buffer[12];
+	sprintf (buffer, "%d", value);
+	return xchat_set_plugin_pref_str (pl, var, buffer);
+}
+
+int
+xchat_get_plugin_pref_int (xchat_plugin *pl, char *var)
+{
+	char buffer[12];
+	xchat_get_plugin_pref_str (pl, var, buffer);
+	return atoi (buffer);
+}