Changeset eb6df6a for storage_xml.c


Ignore:
Timestamp:
2010-07-11T17:21:21Z (14 years ago)
Author:
Sven Moritz Hallberg <pesco@…>
Branches:
master
Children:
be999a5
Parents:
3759849 (diff), 00540d4 (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:

merge with upstraem bitlbee 1.2.8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • storage_xml.c

    r3759849 reb6df6a  
    6060        char *given_pass;
    6161        xml_pass_st pass_st;
     62        int unknown_tag;
    6263};
    6364
     
    8788        irc_t *irc = xd->irc;
    8889       
    89         if( g_strcasecmp( element_name, "user" ) == 0 )
     90        if( xd->unknown_tag > 0 )
     91        {
     92                xd->unknown_tag ++;
     93        }
     94        else if( g_strcasecmp( element_name, "user" ) == 0 )
    9095        {
    9196                char *nick = xml_attr( attr_names, attr_values, "nick" );
     
    225230        else
    226231        {
     232                xd->unknown_tag ++;
     233                irc_usermsg( irc, "Warning: Unknown XML tag found in configuration file (%s). "
     234                                  "This may happen when downgrading BitlBee versions. "
     235                                  "This tag will be skipped and the information will be lost "
     236                                  "once you save your settings.", element_name );
     237                /*
    227238                g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT,
    228239                             "Unkown element: %s", element_name );
     240                */
    229241        }
    230242}
     
    234246        struct xml_parsedata *xd = data;
    235247       
    236         if( g_strcasecmp( element_name, "setting" ) == 0 && xd->current_setting )
     248        if( xd->unknown_tag > 0 )
     249        {
     250                xd->unknown_tag --;
     251        }
     252        else if( g_strcasecmp( element_name, "setting" ) == 0 && xd->current_setting )
    237253        {
    238254                g_free( xd->current_setting );
     
    404420                return STORAGE_ALREADY_EXISTS;
    405421       
    406         strcat( path, "~" );
    407         if( ( fd = open( path, O_WRONLY | O_CREAT | O_TRUNC, 0600 ) ) < 0 )
     422        strcat( path, ".XXXXXX" );
     423        if( ( fd = mkstemp( path ) ) < 0 )
    408424        {
    409425                irc_usermsg( irc, "Error while opening configuration file." );
     
    499515        close( fd );
    500516       
    501         path2 = g_strndup( path, strlen( path ) - 1 );
     517        path2 = g_strndup( path, strlen( path ) - 7 );
    502518        if( rename( path, path2 ) != 0 )
    503519        {
Note: See TracChangeset for help on using the changeset viewer.