summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorBerke Viktor <berkeviktor@aol.com>2012-01-15 19:07:48 +0100
committerBerke Viktor <berkeviktor@aol.com>2012-01-15 19:07:48 +0100
commit4942dc667f3ff40601b7afd2efd91dff1f73789a (patch)
treef71519d3cf2f391407ef5a929157d0dea4e6249d /src/common
parente421c11686c7ab9e21d9fbf34ba363f990d45fa9 (diff)
refactor plugin config API and add skeleton for xchat_pluginpref_list
Diffstat (limited to 'src/common')
-rw-r--r--src/common/plugin.c37
-rw-r--r--src/common/plugin.h12
-rw-r--r--src/common/xchat-plugin.h37
3 files changed, 51 insertions, 35 deletions
diff --git a/src/common/plugin.c b/src/common/plugin.c
index b08143e0..cff8d49b 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c
@@ -270,11 +270,12 @@ 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_pluginpref_str = xchat_set_pluginpref_str;
-		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;
+		pl->xchat_pluginpref_set_str = xchat_pluginpref_set_str;
+		pl->xchat_pluginpref_get_str = xchat_pluginpref_get_str;
+		pl->xchat_pluginpref_set_int = xchat_pluginpref_set_int;
+		pl->xchat_pluginpref_get_int = xchat_pluginpref_get_int;
+		pl->xchat_pluginpref_delete = xchat_pluginpref_delete;
+		pl->xchat_pluginpref_list = xchat_pluginpref_list;
 
 		/* incase new plugins are loaded on older xchat */
 		pl->xchat_dummy4 = xchat_dummy;
@@ -1589,7 +1590,7 @@ xchat_free (xchat_plugin *ph, void *ptr)
 }
 
 static int
-xchat_set_pluginpref_str_real (xchat_plugin *pl, const char *var, const char *value, int mode) /* mode: 0 = delete, 1 = save */
+xchat_pluginpref_set_str_real (xchat_plugin *pl, const char *var, const char *value, int mode) /* mode: 0 = delete, 1 = save */
 {
 	FILE *fpIn;
 	int fhOut;
@@ -1702,13 +1703,13 @@ xchat_set_pluginpref_str_real (xchat_plugin *pl, const char *var, const char *va
 }
 
 int
-xchat_set_pluginpref_str (xchat_plugin *pl, const char *var, const char *value)
+xchat_pluginpref_set_str (xchat_plugin *pl, const char *var, const char *value)
 {
-	return xchat_set_pluginpref_str_real (pl, var, value, 1);
+	return xchat_pluginpref_set_str_real (pl, var, value, 1);
 }
 
 int
-xchat_get_pluginpref_str (xchat_plugin *pl, const char *var, char *dest)
+xchat_pluginpref_get_str (xchat_plugin *pl, const char *var, char *dest)
 {
 	int fh;
 	int l;
@@ -1760,20 +1761,20 @@ xchat_get_pluginpref_str (xchat_plugin *pl, const char *var, char *dest)
 }
 
 int
-xchat_set_pluginpref_int (xchat_plugin *pl, const char *var, int value)
+xchat_pluginpref_set_int (xchat_plugin *pl, const char *var, int value)
 {
 	char buffer[12];
 
 	sprintf (buffer, "%d", value);
-	return xchat_set_pluginpref_str_real (pl, var, buffer, 1);
+	return xchat_pluginpref_set_str_real (pl, var, buffer, 1);
 }
 
 int
-xchat_get_pluginpref_int (xchat_plugin *pl, const char *var)
+xchat_pluginpref_get_int (xchat_plugin *pl, const char *var)
 {
 	char buffer[12];
 
-	if (xchat_get_pluginpref_str (pl, var, buffer))
+	if (xchat_pluginpref_get_str (pl, var, buffer))
 	{
 		return atoi (buffer);
 	}
@@ -1784,7 +1785,13 @@ xchat_get_pluginpref_int (xchat_plugin *pl, const char *var)
 }
 
 int
-xchat_del_pluginpref (xchat_plugin *pl, const char *var)
+xchat_pluginpref_delete (xchat_plugin *pl, const char *var)
 {
-	return xchat_set_pluginpref_str_real (pl, var, 0, 0);
+	return xchat_pluginpref_set_str_real (pl, var, 0, 0);
 }
+
+int
+xchat_pluginpref_list (char* dest)
+{
+	return 0;
+}
\ No newline at end of file
diff --git a/src/common/plugin.h b/src/common/plugin.h
index bb86f0a3..8c347d51 100644
--- a/src/common/plugin.h
+++ b/src/common/plugin.h
@@ -98,19 +98,21 @@ struct _xchat_plugin
 	     int flags);
 	void (*xchat_free) (xchat_plugin *ph,
 	    void *ptr);
-	int (*xchat_set_pluginpref_str) (xchat_plugin *ph,
+	int (*xchat_pluginpref_set_str) (xchat_plugin *ph,
 		const char *var,
 		const char *value);
-	int (*xchat_get_pluginpref_str) (xchat_plugin *ph,
+	int (*xchat_pluginpref_get_str) (xchat_plugin *ph,
 		const char *var,
 		char *dest);
-	int (*xchat_set_pluginpref_int) (xchat_plugin *ph,
+	int (*xchat_pluginpref_set_int) (xchat_plugin *ph,
 		const char *var,
 		int value);
-	int (*xchat_get_pluginpref_int) (xchat_plugin *ph,
+	int (*xchat_pluginpref_get_int) (xchat_plugin *ph,
 		const char *var);
-	int (*xchat_del_pluginpref) (xchat_plugin *ph,
+	int (*xchat_pluginpref_delete) (xchat_plugin *ph,
 		const char *var);
+	int (*xchat_pluginpref_list) (xchat_plugin *ph,
+		char *dest);
 	void *(*xchat_dummy4) (xchat_plugin *ph);
 	void *(*xchat_dummy3) (xchat_plugin *ph);
 	void *(*xchat_dummy2) (xchat_plugin *ph);
diff --git a/src/common/xchat-plugin.h b/src/common/xchat-plugin.h
index 373c664e..1b7da8fb 100644
--- a/src/common/xchat-plugin.h
+++ b/src/common/xchat-plugin.h
@@ -137,19 +137,21 @@ struct _xchat_plugin
 	     int flags);
 	void (*xchat_free) (xchat_plugin *ph,
 	    void *ptr);
-	int (*xchat_set_pluginpref_str) (xchat_plugin *ph,
+	int (*xchat_pluginpref_set_str) (xchat_plugin *ph,
 		const char *var,
 		const char *value);
-	int (*xchat_get_pluginpref_str) (xchat_plugin *ph,
+	int (*xchat_pluginpref_get_str) (xchat_plugin *ph,
 		const char *var,
 		char *dest);
-	int (*xchat_set_pluginpref_int) (xchat_plugin *ph,
+	int (*xchat_pluginpref_set_int) (xchat_plugin *ph,
 		const char *var,
 		int value);
-	int (*xchat_get_pluginpref_int) (xchat_plugin *ph,
+	int (*xchat_pluginpref_get_int) (xchat_plugin *ph,
 		const char *var);
-	int (*xchat_del_pluginpref) (xchat_plugin *ph,
+	int (*xchat_pluginpref_delete) (xchat_plugin *ph,
 		const char *var);
+	int (*xchat_pluginpref_list) (xchat_plugin *ph,
+		char *dest);
 };
 #endif
 
@@ -306,27 +308,31 @@ xchat_free (xchat_plugin *ph,
 	    void *ptr);
 
 int
-xchat_set_pluginpref_str (xchat_plugin *ph,
+xchat_pluginpref_set_str (xchat_plugin *ph,
 		const char *var,
 		const char *value);
 
 int
-xchat_get_pluginpref_str (xchat_plugin *ph,
+xchat_pluginpref_get_str (xchat_plugin *ph,
 		const char *var,
 		char *dest);
 
 int
-xchat_set_pluginpref_int (xchat_plugin *ph,
+xchat_pluginpref_set_int (xchat_plugin *ph,
 		const char *var,
 		int value);
 int
-xchat_get_pluginpref_int (xchat_plugin *ph,
+xchat_pluginpref_get_int (xchat_plugin *ph,
 		const char *var);
 
 int
-xchat_del_pluginpref (xchat_plugin *ph,
+xchat_pluginpref_delete (xchat_plugin *ph,
 		const char *var);
 
+int
+xchat_pluginpref_list (xchat_plugin *ph,
+		char *dest);
+
 #if !defined(PLUGIN_C) && defined(WIN32)
 #ifndef XCHAT_PLUGIN_HANDLE
 #define XCHAT_PLUGIN_HANDLE (ph)
@@ -361,11 +367,12 @@ xchat_del_pluginpref (xchat_plugin *ph,
 #define xchat_send_modes ((XCHAT_PLUGIN_HANDLE)->xchat_send_modes)
 #define xchat_strip ((XCHAT_PLUGIN_HANDLE)->xchat_strip)
 #define xchat_free ((XCHAT_PLUGIN_HANDLE)->xchat_free)
-#define xchat_set_pluginpref_str ((XCHAT_PLUGIN_HANDLE)->xchat_set_pluginpref_str)
-#define xchat_get_pluginpref_str ((XCHAT_PLUGIN_HANDLE)->xchat_get_pluginpref_str)
-#define xchat_set_pluginpref_int ((XCHAT_PLUGIN_HANDLE)->xchat_set_pluginpref_int)
-#define xchat_get_pluginpref_int ((XCHAT_PLUGIN_HANDLE)->xchat_get_pluginpref_int)
-#define xchat_del_pluginpref ((XCHAT_PLUGIN_HANDLE)->xchat_del_pluginpref)
+#define xchat_pluginpref_set_str ((XCHAT_PLUGIN_HANDLE)->xchat_pluginpref_set_str)
+#define xchat_pluginpref_get_str ((XCHAT_PLUGIN_HANDLE)->xchat_pluginpref_get_str)
+#define xchat_pluginpref_set_int ((XCHAT_PLUGIN_HANDLE)->xchat_pluginpref_set_int)
+#define xchat_pluginpref_get_int ((XCHAT_PLUGIN_HANDLE)->xchat_pluginpref_get_int)
+#define xchat_pluginpref_delete ((XCHAT_PLUGIN_HANDLE)->xchat_pluginpref_delete)
+#define xchat_pluginpref_list ((XCHAT_PLUGIN_HANDLE)->xchat_pluginpref_list)
 #endif
 
 #ifdef __cplusplus