diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-03-12 01:05:21 +0000 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-03-12 01:05:21 +0000 |
commit | 4dc6b8d10786baafd3ead9a2ecb22d7065b9c4b9 (patch) | |
tree | 1b832a6c016c82da0719ab16fe632f5c4fcfd0ee /protocols/purple/purple.c | |
parent | 56244c0a88b603a683da9c0cc6abfccdc7616265 (diff) |
Added support for PURPLE_PREF_STRING_LIST style settings, this makes the
QQ module (and maybe others) work.
Diffstat (limited to 'protocols/purple/purple.c')
-rw-r--r-- | protocols/purple/purple.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c index 3c1f505c..9a6556b0 100644 --- a/protocols/purple/purple.c +++ b/protocols/purple/purple.c @@ -67,6 +67,9 @@ static void purple_init( account_t *acc ) const char *name; char *def = NULL; set_eval eval = NULL; + void *eval_data = NULL; + GList *io = NULL; + GSList *opts = NULL; name = purple_account_option_get_setting( o ); @@ -89,8 +92,20 @@ static void purple_init( account_t *acc ) eval = set_eval_bool; break; + case PURPLE_PREF_STRING_LIST: + def = g_strdup( purple_account_option_get_default_list_value( o ) ); + for( io = purple_account_option_get_list( o ); io; io = io->next ) + { + PurpleKeyValuePair *kv = io->data; + opts = g_slist_append( opts, kv->key ); + } + eval = set_eval_list; + eval_data = opts; + break; + default: - fprintf( stderr, "Setting with unknown type: %s (%d)\n", name, purple_account_option_get_type( o ) ); + irc_usermsg( acc->irc, "Setting with unknown type: %s (%d) Expect stuff to break..\n", + name, purple_account_option_get_type( o ) ); name = NULL; } @@ -98,6 +113,7 @@ static void purple_init( account_t *acc ) { s = set_add( &acc->set, name, def, eval, acc ); s->flags |= ACC_SET_OFFLINE_ONLY; + s->eval_data = eval_data; g_free( def ); } } @@ -149,6 +165,7 @@ static void purple_sync_settings( account_t *acc, PurpleAccount *pa ) switch( purple_account_option_get_type( o ) ) { case PURPLE_PREF_STRING: + case PURPLE_PREF_STRING_LIST: purple_account_set_string( pa, name, set_getstr( &acc->set, name ) ); break; |