diff options
author | Berke Viktor <berkeviktor@aol.com> | 2012-01-14 00:29:01 +0100 |
---|---|---|
committer | Berke Viktor <berkeviktor@aol.com> | 2012-01-14 00:29:01 +0100 |
commit | c3821b6316c3d25ef6affd5215796d3abbefd2fe (patch) | |
tree | 37bcf84cb8417c0c91ce42d8d38f5d5e896dbef9 | |
parent | c979a8a8b7493538dde5b80936b298ad6b57c877 (diff) |
skeleton for xchat_del_pluginpref
-rw-r--r-- | plugins/xchat-plugin.h | 7 | ||||
-rw-r--r-- | src/common/plugin.c | 21 | ||||
-rw-r--r-- | src/common/plugin.h | 2 | ||||
-rw-r--r-- | src/common/xchat-plugin.h | 7 | ||||
-rw-r--r-- | src/version-script | 1 |
5 files changed, 35 insertions, 3 deletions
diff --git a/plugins/xchat-plugin.h b/plugins/xchat-plugin.h index 15799424..373c664e 100644 --- a/plugins/xchat-plugin.h +++ b/plugins/xchat-plugin.h @@ -148,6 +148,8 @@ struct _xchat_plugin int value); int (*xchat_get_pluginpref_int) (xchat_plugin *ph, const char *var); + int (*xchat_del_pluginpref) (xchat_plugin *ph, + const char *var); }; #endif @@ -321,6 +323,10 @@ int xchat_get_pluginpref_int (xchat_plugin *ph, const char *var); +int +xchat_del_pluginpref (xchat_plugin *ph, + const char *var); + #if !defined(PLUGIN_C) && defined(WIN32) #ifndef XCHAT_PLUGIN_HANDLE #define XCHAT_PLUGIN_HANDLE (ph) @@ -359,6 +365,7 @@ xchat_get_pluginpref_int (xchat_plugin *ph, #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) #endif #ifdef __cplusplus 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); +} diff --git a/src/common/plugin.h b/src/common/plugin.h index cddb86fb..bb86f0a3 100644 --- a/src/common/plugin.h +++ b/src/common/plugin.h @@ -109,6 +109,8 @@ struct _xchat_plugin int value); int (*xchat_get_pluginpref_int) (xchat_plugin *ph, const char *var); + int (*xchat_del_pluginpref) (xchat_plugin *ph, + const char *var); 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 15799424..373c664e 100644 --- a/src/common/xchat-plugin.h +++ b/src/common/xchat-plugin.h @@ -148,6 +148,8 @@ struct _xchat_plugin int value); int (*xchat_get_pluginpref_int) (xchat_plugin *ph, const char *var); + int (*xchat_del_pluginpref) (xchat_plugin *ph, + const char *var); }; #endif @@ -321,6 +323,10 @@ int xchat_get_pluginpref_int (xchat_plugin *ph, const char *var); +int +xchat_del_pluginpref (xchat_plugin *ph, + const char *var); + #if !defined(PLUGIN_C) && defined(WIN32) #ifndef XCHAT_PLUGIN_HANDLE #define XCHAT_PLUGIN_HANDLE (ph) @@ -359,6 +365,7 @@ xchat_get_pluginpref_int (xchat_plugin *ph, #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) #endif #ifdef __cplusplus diff --git a/src/version-script b/src/version-script index e76f4fe9..fe04dd46 100644 --- a/src/version-script +++ b/src/version-script @@ -34,5 +34,6 @@ EXPORTED { xchat_get_pluginpref_str; xchat_set_pluginpref_int; xchat_get_pluginpref_int; + xchat_del_pluginpref; local: *; }; |