Mercurial > pidgin
comparison src/status.c @ 10343:ee4f477fc8cf
[gaim-migrate @ 11553]
Minor tweaks to the blist and status xml reading code. These functions
don't expect the filename to be called "blist.xml" and "status.xml"
anymore. Some guy wanted this because he wants to try to add some
sort of AIM buddy list importing, or something. I think.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 10 Dec 2004 05:49:01 +0000 |
parents | 84d73473c019 |
children | 64bc206c7473 |
comparison
equal
deleted
inserted
replaced
10342:476bf80b8ad8 | 10343:ee4f477fc8cf |
---|---|
1827 xmlnode *statuses, *status; | 1827 xmlnode *statuses, *status; |
1828 | 1828 |
1829 gaim_debug_info("status", "Reading %s\n", filename); | 1829 gaim_debug_info("status", "Reading %s\n", filename); |
1830 | 1830 |
1831 if (!g_file_get_contents(filename, &contents, &length, &error)) { | 1831 if (!g_file_get_contents(filename, &contents, &length, &error)) { |
1832 gaim_debug_error("status", "Error reading status.xml: %s\n", | 1832 gaim_debug_error("status", "Error reading statuses: %s\n", |
1833 error->message); | 1833 error->message); |
1834 g_error_free(error); | 1834 g_error_free(error); |
1835 return FALSE; | 1835 return FALSE; |
1836 } | 1836 } |
1837 | 1837 |
1838 statuses = xmlnode_from_str(contents, length); | 1838 statuses = xmlnode_from_str(contents, length); |
1839 | 1839 |
1840 if (statuses == NULL) { | 1840 if (statuses == NULL) { |
1841 FILE *backup; | 1841 FILE *backup; |
1842 gchar *name; | 1842 gchar *name; |
1843 gaim_debug_error("status", "Error parsing status.xml\n"); | 1843 gaim_debug_error("status", "Error parsing statuses\n"); |
1844 name = g_build_filename(gaim_user_dir(), "status.xml~", NULL); | 1844 name = g_strdup_printf("%s~", filename); |
1845 if ((backup = fopen(name, "w"))) { | 1845 if ((backup = fopen(name, "w"))) { |
1846 fwrite(contents, length, 1, backup); | 1846 fwrite(contents, length, 1, backup); |
1847 fclose(backup); | 1847 fclose(backup); |
1848 chmod(name, S_IRUSR | S_IWUSR); | 1848 chmod(name, S_IRUSR | S_IWUSR); |
1849 } else { | 1849 } else { |
1859 for (status = xmlnode_get_child(statuses, "status"); status != NULL; | 1859 for (status = xmlnode_get_child(statuses, "status"); status != NULL; |
1860 status = xmlnode_get_next_twin(status)) { | 1860 status = xmlnode_get_next_twin(status)) { |
1861 gaim_statuses_read_parse_status(status); | 1861 gaim_statuses_read_parse_status(status); |
1862 } | 1862 } |
1863 | 1863 |
1864 gaim_debug_info("status", "Finished reading status.xml\n"); | 1864 gaim_debug_info("status", "Finished reading statuses\n"); |
1865 | 1865 |
1866 xmlnode_free(statuses); | 1866 xmlnode_free(statuses); |
1867 | 1867 |
1868 return TRUE; | 1868 return TRUE; |
1869 } | 1869 } |