diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-03-12 00:38:40 +0000 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-03-12 00:38:40 +0000 | 
| commit | 56244c0a88b603a683da9c0cc6abfccdc7616265 (patch) | |
| tree | 4cb13fccc68df33bd5d6b92586cf4fb76a8d4107 | |
| parent | fdba6bcaf699930482d3ec1b30df461c05582925 (diff) | |
Added set_eval_list which I will need for the Purple module now to make QQ
(and others) work.
| -rw-r--r-- | set.c | 15 | ||||
| -rw-r--r-- | set.h | 4 | 
2 files changed, 19 insertions, 0 deletions
| @@ -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 ); @@ -68,6 +68,7 @@ typedef struct set  	   the passed value variable. When returning a corrected value,  	   set_setstr() should be able to free() the returned string! */  	set_eval eval; +	void *eval_data;  	struct set *next;  } set_t; @@ -97,6 +98,9 @@ int set_reset( set_t **head, const char *key );  char *set_eval_int( set_t *set, char *value );  char *set_eval_bool( set_t *set, char *value ); +/* Another more complicated one. */ +char *set_eval_list( set_t *set, char *value ); +  /* Some not very generic evaluators that really shouldn't be here... */  char *set_eval_to_char( set_t *set, char *value );  char *set_eval_ops( set_t *set, char *value ); | 
