Changeset 0f7ee7e5 for protocols/purple


Ignore:
Timestamp:
2009-10-11T12:57:29Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
b74b287
Parents:
db4cd40
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/purple/purple.c

    rdb4cd40 r0f7ee7e5  
    4747static void purple_init( account_t *acc )
    4848{
    49         /* TODO: Figure out variables to export via set. */
    50        
     49        PurplePlugin *prpl = purple_plugins_find_with_id( acc->prpl->name );
     50        PurplePluginProtocolInfo *pi = prpl->info->extra_info;
     51        GList *i;
     52       
     53        for( i = pi->protocol_options; i; i = i->next )
     54        {
     55                PurpleAccountOption *o = i->data;
     56                const char *name;
     57                char *def = NULL;
     58                set_eval eval = NULL;
     59                set_t *s;
     60               
     61                name = purple_account_option_get_setting( o );
     62               
     63                switch( purple_account_option_get_type( o ) )
     64                {
     65                case PURPLE_PREF_STRING:
     66                        def = g_strdup( purple_account_option_get_default_string( o ) );
     67                        break;
     68               
     69                case PURPLE_PREF_INT:
     70                        def = g_strdup_printf( "%d", purple_account_option_get_default_int( o ) );
     71                        eval = set_eval_int;
     72                        break;
     73               
     74                case PURPLE_PREF_BOOLEAN:
     75                        if( purple_account_option_get_default_bool( o ) )
     76                                def = g_strdup( "true" );
     77                        else
     78                                def = g_strdup( "false" );
     79                        eval = set_eval_bool;
     80                        break;
     81               
     82                default:
     83                        fprintf( stderr, "Setting with unknown type: %s (%d)\n", name, purple_account_option_get_type( o ) );
     84                }
     85               
     86                if( def != NULL )
     87                {
     88                        s = set_add( &acc->set, name, def, eval, acc );
     89                        s->flags |= ACC_SET_OFFLINE_ONLY;
     90                        g_free( def );
     91                }
     92        }
    5193}
    5294
     
    5597        struct im_connection *ic = imcb_new( acc );
    5698        PurpleAccount *pa;
    57         //PurpleSavedStatus *ps;
    58         //GList *i;
    5999       
    60100        /* For now this is needed in the _connected() handlers if using
     
    69109       
    70110        purple_account_set_enabled( pa, "BitlBee", TRUE );
    71        
    72         /*
    73         for( i = ((PurplePluginProtocolInfo *)pa->gc->prpl->info->extra_info)->protocol_options; i; i = i->next )
    74         {
    75                 PurpleAccountOption *o = i->data;
    76                
    77                 printf( "%s\n", o->pref_name );
    78         }
    79         */
    80        
    81         //ps = purple_savedstatus_new( NULL, PURPLE_STATUS_AVAILABLE );
    82         //purple_savedstatus_activate_for_account( ps, pa );
    83111}
    84112
Note: See TracChangeset for help on using the changeset viewer.