diff options
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; |