From 0f7ee7e53f6bcb2d1d262a94c278440413c0103a Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 11 Oct 2009 13:57:29 +0100 Subject: Copy all the string/bool/int account settings with their defaults to "account set". They can be changed, but changes don't yet have any effect. --- set.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'set.c') diff --git a/set.c b/set.c index 18d5a50d..f72e0ace 100644 --- a/set.c +++ b/set.c @@ -28,7 +28,7 @@ /* Used to use NULL for this, but NULL is actually a "valid" value. */ char *SET_INVALID = "nee"; -set_t *set_add( set_t **head, char *key, char *def, set_eval eval, void *data ) +set_t *set_add( set_t **head, const char *key, const char *def, set_eval eval, void *data ) { set_t *s = set_find( head, key ); -- cgit v1.2.3 From b74b287af7ee980b01b89e911e21ec8f163d24b3 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 11 Oct 2009 22:08:26 +0100 Subject: Fixed account cleanup (use remove, not destroy) and now using user's account settings. --- set.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'set.c') diff --git a/set.c b/set.c index f72e0ace..7abae37a 100644 --- a/set.c +++ b/set.c @@ -62,7 +62,7 @@ set_t *set_add( set_t **head, const char *key, const char *def, set_eval eval, v return s; } -set_t *set_find( set_t **head, char *key ) +set_t *set_find( set_t **head, const char *key ) { set_t *s = *head; @@ -76,7 +76,7 @@ set_t *set_find( set_t **head, char *key ) return s; } -char *set_getstr( set_t **head, char *key ) +char *set_getstr( set_t **head, const char *key ) { set_t *s = set_find( head, key ); @@ -86,7 +86,7 @@ char *set_getstr( set_t **head, char *key ) return s->value ? s->value : s->def; } -int set_getint( set_t **head, char *key ) +int set_getint( set_t **head, const char *key ) { char *s = set_getstr( head, key ); int i = 0; @@ -100,7 +100,7 @@ int set_getint( set_t **head, char *key ) return i; } -int set_getbool( set_t **head, char *key ) +int set_getbool( set_t **head, const char *key ) { char *s = set_getstr( head, key ); @@ -110,7 +110,7 @@ int set_getbool( set_t **head, char *key ) return bool2int( s ); } -int set_setstr( set_t **head, char *key, char *value ) +int set_setstr( set_t **head, const char *key, char *value ) { set_t *s = set_find( head, key ); char *nv = value; @@ -149,7 +149,7 @@ int set_setstr( set_t **head, char *key, char *value ) return 1; } -int set_setint( set_t **head, char *key, int value ) +int set_setint( set_t **head, const char *key, int value ) { char s[24]; /* Not quite 128-bit clean eh? ;-) */ @@ -157,7 +157,7 @@ int set_setint( set_t **head, char *key, int value ) return set_setstr( head, key, s ); } -void set_del( set_t **head, char *key ) +void set_del( set_t **head, const char *key ) { set_t *s = *head, *t = NULL; @@ -181,7 +181,7 @@ void set_del( set_t **head, char *key ) } } -int set_reset( set_t **head, char *key ) +int set_reset( set_t **head, const char *key ) { set_t *s; -- cgit v1.2.3 From 56244c0a88b603a683da9c0cc6abfccdc7616265 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 12 Mar 2010 00:38:40 +0000 Subject: Added set_eval_list which I will need for the Purple module now to make QQ (and others) work. --- set.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'set.c') diff --git a/set.c b/set.c index 7abae37a..baf85261 100644 --- a/set.c +++ b/set.c @@ -212,6 +212,21 @@ char *set_eval_bool( set_t *set, char *value ) return is_bool( value ) ? value : SET_INVALID; } +char *set_eval_list( set_t *set, char *value ) +{ + GSList *options = set->eval_data, *opt; + + for( opt = options; opt; opt = opt->next ) + if( strcmp( value, opt->data ) == 0 ) + return value; + + /* TODO: It'd be nice to show the user a list of allowed values, + but we don't have enough context here to do that. May + want to fix that. */ + + return NULL; +} + char *set_eval_to_char( set_t *set, char *value ) { char *s = g_new( char, 3 ); -- cgit v1.2.3