Changeset 7c5affca for protocols


Ignore:
Timestamp:
2010-03-12T01:47:44Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
3330468
Parents:
4dc6b8d
Message:

Add some simple information about available settings to the online help
command.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/purple/purple.c

    r4dc6b8d r7c5affca  
    6060        GList *i, *st;
    6161        set_t *s;
     62        char help_title[64];
     63        GString *help;
     64       
     65        help = g_string_new( "" );
     66        g_string_printf( help, "BitlBee libpurple module %s (%s).\n\nSupported settings:",
     67                                (char*) acc->prpl->name, prpl->info->name );
    6268       
    6369        /* Convert all protocol_options into per-account setting variables. */
     
    7884                case PURPLE_PREF_STRING:
    7985                        def = g_strdup( purple_account_option_get_default_string( o ) );
     86                       
     87                        g_string_append_printf( help, "\n* %s (%s), %s, default: %s",
     88                                                name, purple_account_option_get_text( o ),
     89                                                "string", def );
     90                       
    8091                        break;
    8192               
     
    8394                        def = g_strdup_printf( "%d", purple_account_option_get_default_int( o ) );
    8495                        eval = set_eval_int;
     96                       
     97                        g_string_append_printf( help, "\n* %s (%s), %s, default: %s",
     98                                                name, purple_account_option_get_text( o ),
     99                                                "integer", def );
     100                       
    85101                        break;
    86102               
     
    91107                                def = g_strdup( "false" );
    92108                        eval = set_eval_bool;
     109                       
     110                        g_string_append_printf( help, "\n* %s (%s), %s, default: %s",
     111                                                name, purple_account_option_get_text( o ),
     112                                                "boolean", def );
     113                       
    93114                        break;
    94115               
    95116                case PURPLE_PREF_STRING_LIST:
    96117                        def = g_strdup( purple_account_option_get_default_list_value( o ) );
     118                       
     119                        g_string_append_printf( help, "\n* %s (%s), %s, default: %s",
     120                                                name, purple_account_option_get_text( o ),
     121                                                "list", def );
     122                        g_string_append( help, "\n  Possible values: " );
     123                       
    97124                        for( io = purple_account_option_get_list( o ); io; io = io->next )
    98125                        {
    99126                                PurpleKeyValuePair *kv = io->data;
    100127                                opts = g_slist_append( opts, kv->key );
     128                                g_string_append_printf( help, "%s, ", kv->key );
    101129                        }
     130                        g_string_truncate( help, help->len - 2 );
    102131                        eval = set_eval_list;
    103132                        eval_data = opts;
     133                       
    104134                        break;
    105135                       
     
    118148                }
    119149        }
     150       
     151        g_snprintf( help_title, sizeof( help_title ), "purple %s", (char*) acc->prpl->name );
     152        help_add_mem( &global.help, help_title, help->str );
     153        g_string_free( help, TRUE );
    120154       
    121155        if( pi->options & OPT_PROTO_MAIL_CHECK )
     
    713747        }
    714748       
     749        g_string_append( help, "\n\nFor used protocols, more information about available "
     750                         "settings can be found using \x02help purple <protocol name>\x02" );
     751       
    715752        /* Add a simple dynamically-generated help item listing all
    716753           the supported protocols. */
Note: See TracChangeset for help on using the changeset viewer.