Changeset 06b39f2


Ignore:
Timestamp:
2010-07-13T00:17:37Z (9 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
83e2d30, b1af3e8
Parents:
db2cef1
Message:

Automatically convert nick_source settings to their nick_convert equivalent.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/account.c

    rdb2cef1 r06b39f2  
    2828#include "account.h"
    2929
     30static char *set_eval_nick_source( set_t *set, char *value );
     31
    3032account_t *account_add( bee_t *bee, struct prpl *prpl, char *user, char *pass )
    3133{
     
    5759        s->flags |= SET_NULL_OK;
    5860       
    59         s = set_add( &a->set, "nick_source", "handle", NULL, a );
     61        s = set_add( &a->set, "nick_source", "handle", set_eval_nick_source, a );
     62        s->flags |= ACC_SET_NOSAVE; /* Just for bw compatibility! */
    6063       
    6164        s = set_add( &a->set, "password", NULL, set_eval_account, a );
     
    153156       
    154157        return SET_INVALID;
     158}
     159
     160/* For bw compatibility, have this write-only setting. */
     161static char *set_eval_nick_source( set_t *set, char *value )
     162{
     163        account_t *a = set->data;
     164       
     165        if( strcmp( value, "full_name" ) == 0 )
     166                set_setstr( &a->set, "nick_format", "%full_name" );
     167        else if( strcmp( value, "first_name" ) == 0 )
     168                set_setstr( &a->set, "nick_format", "%first_name" );
     169        else
     170                set_setstr( &a->set, "nick_format", "%-@nick" );
     171       
     172        return value;
    155173}
    156174
Note: See TracChangeset for help on using the changeset viewer.