Mercurial > pidgin
comparison src/list.c @ 4439:7693d84255e7
[gaim-migrate @ 4714]
die correctly (i.e. not silently) on invalid XML in the buddy list.
hopefully this will let us figure out the problems people are having
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Tue, 28 Jan 2003 03:47:22 +0000 |
parents | 94bf204f837e |
children | 474a0a88dd5e |
comparison
equal
deleted
inserted
replaced
4438:2054d8429925 | 4439:7693d84255e7 |
---|---|
749 BLIST_TAG_ACCOUNT, | 749 BLIST_TAG_ACCOUNT, |
750 BLIST_TAG_PERMIT, | 750 BLIST_TAG_PERMIT, |
751 BLIST_TAG_BLOCK, | 751 BLIST_TAG_BLOCK, |
752 BLIST_TAG_IGNORE | 752 BLIST_TAG_IGNORE |
753 } blist_parser_current_tag; | 753 } blist_parser_current_tag; |
754 static gboolean blist_parser_error_occurred = FALSE; | |
754 | 755 |
755 static void blist_start_element_handler (GMarkupParseContext *context, | 756 static void blist_start_element_handler (GMarkupParseContext *context, |
756 const gchar *element_name, | 757 const gchar *element_name, |
757 const gchar **attribute_names, | 758 const gchar **attribute_names, |
758 const gchar **attribute_values, | 759 const gchar **attribute_values, |
915 default: | 916 default: |
916 break; | 917 break; |
917 } | 918 } |
918 } | 919 } |
919 | 920 |
921 static void blist_error_handler(GMarkupParseContext *context, GError *error, | |
922 gpointer user_data) { | |
923 blist_parser_error_occurred = TRUE; | |
924 debug_printf("error parsing blist.xml: %s\n", error->message); | |
925 } | |
926 | |
920 static GMarkupParser blist_parser = { | 927 static GMarkupParser blist_parser = { |
921 blist_start_element_handler, | 928 blist_start_element_handler, |
922 blist_end_element_handler, | 929 blist_end_element_handler, |
923 blist_text_handler, | 930 blist_text_handler, |
924 NULL, | 931 NULL, |
925 NULL | 932 blist_error_handler |
926 }; | 933 }; |
927 | 934 |
928 static gboolean gaim_blist_read(const char *filename) { | 935 static gboolean gaim_blist_read(const char *filename) { |
929 gchar *contents; | 936 gchar *contents; |
930 gsize length; | 937 gsize length; |
948 g_markup_parse_context_free(context); | 955 g_markup_parse_context_free(context); |
949 return FALSE; | 956 return FALSE; |
950 } | 957 } |
951 | 958 |
952 g_markup_parse_context_free(context); | 959 g_markup_parse_context_free(context); |
960 if(blist_parser_error_occurred) | |
961 return FALSE; | |
962 | |
953 return TRUE; | 963 return TRUE; |
954 } | 964 } |
955 | 965 |
956 void gaim_blist_load() { | 966 void gaim_blist_load() { |
957 GSList *accts; | 967 GSList *accts; |