skeleton for xchat_del_pluginpref

This commit is contained in:
Berke Viktor 2012-01-14 00:29:01 +01:00
parent c979a8a8b7
commit c3821b6316
5 changed files with 35 additions and 3 deletions

View File

@ -148,6 +148,8 @@ struct _xchat_plugin
int value); int value);
int (*xchat_get_pluginpref_int) (xchat_plugin *ph, int (*xchat_get_pluginpref_int) (xchat_plugin *ph,
const char *var); const char *var);
int (*xchat_del_pluginpref) (xchat_plugin *ph,
const char *var);
}; };
#endif #endif
@ -321,6 +323,10 @@ int
xchat_get_pluginpref_int (xchat_plugin *ph, xchat_get_pluginpref_int (xchat_plugin *ph,
const char *var); const char *var);
int
xchat_del_pluginpref (xchat_plugin *ph,
const char *var);
#if !defined(PLUGIN_C) && defined(WIN32) #if !defined(PLUGIN_C) && defined(WIN32)
#ifndef XCHAT_PLUGIN_HANDLE #ifndef XCHAT_PLUGIN_HANDLE
#define XCHAT_PLUGIN_HANDLE (ph) #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_get_pluginpref_str ((XCHAT_PLUGIN_HANDLE)->xchat_get_pluginpref_str)
#define xchat_set_pluginpref_int ((XCHAT_PLUGIN_HANDLE)->xchat_set_pluginpref_int) #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_get_pluginpref_int ((XCHAT_PLUGIN_HANDLE)->xchat_get_pluginpref_int)
#define xchat_del_pluginpref ((XCHAT_PLUGIN_HANDLE)->xchat_del_pluginpref)
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -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_get_pluginpref_str = xchat_get_pluginpref_str;
pl->xchat_set_pluginpref_int = xchat_set_pluginpref_int; pl->xchat_set_pluginpref_int = xchat_set_pluginpref_int;
pl->xchat_get_pluginpref_int = xchat_get_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 */ /* incase new plugins are loaded on older xchat */
pl->xchat_dummy4 = xchat_dummy; pl->xchat_dummy4 = xchat_dummy;
@ -1587,9 +1588,11 @@ xchat_free (xchat_plugin *ph, void *ptr)
g_free (ptr); g_free (ptr);
} }
int static int
xchat_set_pluginpref_str (xchat_plugin *pl, const char *var, const char *value) xchat_set_pluginpref_str_real (xchat_plugin *pl, const char *var, const char *value, int mode)
{ {
/* mode: 0 = delete, 1 = save */
FILE *fpIn; FILE *fpIn;
int fhOut; int fhOut;
int prevConfig; 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 int
xchat_get_pluginpref_str (xchat_plugin *pl, const char *var, char *dest) 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]; char buffer[12];
sprintf (buffer, "%d", value); sprintf (buffer, "%d", value);
return xchat_set_pluginpref_str (pl, var, buffer); return xchat_set_pluginpref_str_real (pl, var, buffer, 1);
} }
int int
@ -1758,3 +1767,9 @@ xchat_get_pluginpref_int (xchat_plugin *pl, const char *var)
return -1; return -1;
} }
} }
int
xchat_del_pluginpref (xchat_plugin *pl, const char *var)
{
xchat_set_pluginpref_str_real (pl, var, 0, 0);
}

View File

@ -109,6 +109,8 @@ struct _xchat_plugin
int value); int value);
int (*xchat_get_pluginpref_int) (xchat_plugin *ph, int (*xchat_get_pluginpref_int) (xchat_plugin *ph,
const char *var); const char *var);
int (*xchat_del_pluginpref) (xchat_plugin *ph,
const char *var);
void *(*xchat_dummy4) (xchat_plugin *ph); void *(*xchat_dummy4) (xchat_plugin *ph);
void *(*xchat_dummy3) (xchat_plugin *ph); void *(*xchat_dummy3) (xchat_plugin *ph);
void *(*xchat_dummy2) (xchat_plugin *ph); void *(*xchat_dummy2) (xchat_plugin *ph);

View File

@ -148,6 +148,8 @@ struct _xchat_plugin
int value); int value);
int (*xchat_get_pluginpref_int) (xchat_plugin *ph, int (*xchat_get_pluginpref_int) (xchat_plugin *ph,
const char *var); const char *var);
int (*xchat_del_pluginpref) (xchat_plugin *ph,
const char *var);
}; };
#endif #endif
@ -321,6 +323,10 @@ int
xchat_get_pluginpref_int (xchat_plugin *ph, xchat_get_pluginpref_int (xchat_plugin *ph,
const char *var); const char *var);
int
xchat_del_pluginpref (xchat_plugin *ph,
const char *var);
#if !defined(PLUGIN_C) && defined(WIN32) #if !defined(PLUGIN_C) && defined(WIN32)
#ifndef XCHAT_PLUGIN_HANDLE #ifndef XCHAT_PLUGIN_HANDLE
#define XCHAT_PLUGIN_HANDLE (ph) #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_get_pluginpref_str ((XCHAT_PLUGIN_HANDLE)->xchat_get_pluginpref_str)
#define xchat_set_pluginpref_int ((XCHAT_PLUGIN_HANDLE)->xchat_set_pluginpref_int) #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_get_pluginpref_int ((XCHAT_PLUGIN_HANDLE)->xchat_get_pluginpref_int)
#define xchat_del_pluginpref ((XCHAT_PLUGIN_HANDLE)->xchat_del_pluginpref)
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -34,5 +34,6 @@ EXPORTED {
xchat_get_pluginpref_str; xchat_get_pluginpref_str;
xchat_set_pluginpref_int; xchat_set_pluginpref_int;
xchat_get_pluginpref_int; xchat_get_pluginpref_int;
xchat_del_pluginpref;
local: *; local: *;
}; };