Changeset c9f0c79


Ignore:
Timestamp:
2006-06-26T12:04:21Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
471573f
Parents:
fd03770
Message:

Implemented cleaner way of passing the "Incorrect password" error.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • storage_xml.c

    rfd03770 rc9f0c79  
    3434        XML_PASS_CHECK_ONLY = -1,
    3535        XML_PASS_UNKNOWN = 0,
     36        XML_PASS_WRONG,
    3637        XML_PASS_OK
    3738} xml_pass_st;
    3839
    39 /* This isn't very clean, probably making a separate error class + code for
    40    BitlBee would be a better solution. But this will work for now... */
    41 #define XML_PASS_ERRORMSG "Wrong username or password"
     40/* To make it easier later when extending the format: */
    4241#define XML_FORMAT_VERSION 1
    4342
     
    108107                                if( pass_dec[i] != pass_md5[i] )
    109108                                {
     109                                        xd->pass_st = XML_PASS_WRONG;
    110110                                        g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
    111                                                      XML_PASS_ERRORMSG );
     111                                                     "Password mismatch" );
    112112                                        break;
    113113                                }
     
    302302                if( !g_markup_parse_context_parse( ctx, buf, st, &gerr ) || gerr )
    303303                {
     304                        xml_pass_st pass_st = xd->pass_st;
     305                       
    304306                        g_markup_parse_context_free( ctx );
    305307                        close( fd );
    306308                       
    307                         /* Slightly dirty... */
    308                         if( gerr && strcmp( gerr->message, XML_PASS_ERRORMSG ) == 0 )
     309                        if( pass_st == XML_PASS_WRONG )
    309310                        {
    310311                                g_clear_error( &gerr );
     
    332333        irc->status |= USTATUS_IDENTIFIED;
    333334       
     335        /* TODO: This really shouldn't be here, I think... */
    334336        if( set_getint( irc, "auto_connect" ) )
    335337        {
Note: See TracChangeset for help on using the changeset viewer.