diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-07-17 00:31:55 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-07-17 00:31:55 +0100 |
commit | 4346c3f4343d0cf67a7eefc381c5b10e15011ce8 (patch) | |
tree | c8777657d9beb067fa5e92f2df7b193fa0ae60a1 /storage_xml.c | |
parent | 3709301b1559aabb3292e8c15bac14a85d8fc31e (diff) | |
parent | ef14a83adbb9036c0006ad460c5e11882a3d7e13 (diff) |
Merging mainline.
Diffstat (limited to 'storage_xml.c')
-rw-r--r-- | storage_xml.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/storage_xml.c b/storage_xml.c index 7a10cea7..db72025d 100644 --- a/storage_xml.c +++ b/storage_xml.c @@ -58,6 +58,7 @@ struct xml_parsedata char *given_nick; char *given_pass; xml_pass_st pass_st; + int unknown_tag; }; static char *xml_attr( const gchar **attr_names, const gchar **attr_values, const gchar *key ) @@ -85,7 +86,11 @@ static void xml_start_element( GMarkupParseContext *ctx, const gchar *element_na struct xml_parsedata *xd = data; irc_t *irc = xd->irc; - if( g_strcasecmp( element_name, "user" ) == 0 ) + if( xd->unknown_tag > 0 ) + { + xd->unknown_tag ++; + } + else if( g_strcasecmp( element_name, "user" ) == 0 ) { char *nick = xml_attr( attr_names, attr_values, "nick" ); char *pass = xml_attr( attr_names, attr_values, "password" ); @@ -266,8 +271,15 @@ static void xml_start_element( GMarkupParseContext *ctx, const gchar *element_na } else { + xd->unknown_tag ++; + irc_usermsg( irc, "Warning: Unknown XML tag found in configuration file (%s). " + "This may happen when downgrading BitlBee versions. " + "This tag will be skipped and the information will be lost " + "once you save your settings.", element_name ); + /* g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, "Unkown element: %s", element_name ); + */ } } @@ -275,7 +287,11 @@ static void xml_end_element( GMarkupParseContext *ctx, const gchar *element_name { struct xml_parsedata *xd = data; - if( g_strcasecmp( element_name, "setting" ) == 0 && xd->current_setting ) + if( xd->unknown_tag > 0 ) + { + xd->unknown_tag --; + } + else if( g_strcasecmp( element_name, "setting" ) == 0 && xd->current_setting ) { g_free( xd->current_setting ); xd->current_setting = NULL; |