Ignore:
Timestamp:
2006-10-15T09:41:12Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
2529faf
Parents:
695e392 (diff), e97827b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merging with storage-xml. It seems to be working pretty well, so maybe
this way more people will test it. :-)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/msn.c

    r695e392 r69cb623  
    2727#include "msn.h"
    2828
    29 static void msn_login( struct aim_user *acct )
    30 {
    31         struct gaim_connection *gc = new_gaim_conn( acct );
     29static char *msn_set_display_name( set_t *set, char *value );
     30
     31static void msn_acc_init( account_t *acc )
     32{
     33        set_t *s;
     34       
     35        s = set_add( &acc->set, "display_name", NULL, msn_set_display_name, acc );
     36        s->flags |= ACC_SET_NOSAVE | ACC_SET_ONLINE_ONLY;
     37}
     38
     39static void msn_login( account_t *acc )
     40{
     41        struct gaim_connection *gc = new_gaim_conn( acc );
    3242        struct msn_data *md = g_new0( struct msn_data, 1 );
    3343       
     
    3747        md->fd = -1;
    3848       
    39         if( strchr( acct->username, '@' ) == NULL )
     49        if( strchr( acc->user, '@' ) == NULL )
    4050        {
    4151                hide_login_progress( gc, "Invalid account name" );
     
    212222static void msn_set_info( struct gaim_connection *gc, char *info )
    213223{
    214         char buf[1024], *fn;
    215         struct msn_data *md = gc->proto_data;
    216        
    217         if( strlen( info ) > 129 )
    218         {
    219                 do_error_dialog( gc, "Maximum name length exceeded", "MSN" );
    220                 return;
    221         }
    222        
    223         fn = msn_http_encode( info );
    224        
    225         g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, gc->username, fn );
    226         msn_write( gc, buf, strlen( buf ) );
    227         g_free( fn );
     224        msn_set_display_name( set_find( &gc->acc->set, "display_name" ), info );
    228225}
    229226
     
    364361}
    365362
     363static char *msn_set_display_name( set_t *set, char *value )
     364{
     365        account_t *acc = set->data;
     366        struct gaim_connection *gc = acc->gc;
     367        struct msn_data *md;
     368        char buf[1024], *fn;
     369        int i;
     370       
     371        /* Double-check. */
     372        if( gc == NULL )
     373                return NULL;
     374       
     375        md = gc->proto_data;
     376       
     377        if( strlen( value ) > 129 )
     378        {
     379                serv_got_crap( gc, "Maximum name length exceeded" );
     380                return NULL;
     381        }
     382       
     383        fn = msn_http_encode( value );
     384       
     385        g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, gc->username, fn );
     386        msn_write( gc, buf, strlen( buf ) );
     387        g_free( fn );
     388       
     389        /* Returning NULL would be better, because the server still has to
     390           confirm the name change. However, it looks a bit confusing to the
     391           user. */
     392        return value;
     393}
     394
    366395void msn_init()
    367396{
    368397        struct prpl *ret = g_new0(struct prpl, 1);
     398       
    369399        ret->name = "msn";
    370400        ret->login = msn_login;
     401        ret->acc_init = msn_acc_init;
    371402        ret->close = msn_close;
    372403        ret->send_im = msn_send_im;
     
    388419        ret->rem_deny = msn_rem_deny;
    389420        ret->send_typing = msn_send_typing;
    390         ret->cmp_buddynames = g_strcasecmp;
     421        ret->handle_cmp = g_strcasecmp;
    391422
    392423        register_protocol(ret);
Note: See TracChangeset for help on using the changeset viewer.