| 1764 } |
1764 } |
| 1765 |
1765 |
| 1766 index_tmp = g_strdup_printf("%s.XXXXXX", pathstr); |
1766 index_tmp = g_strdup_printf("%s.XXXXXX", pathstr); |
| 1767 if ((index_fd = g_mkstemp(index_tmp)) == -1) { |
1767 if ((index_fd = g_mkstemp(index_tmp)) == -1) { |
| 1768 purple_debug_error("log", "Failed to open index temp file: %s\n", |
1768 purple_debug_error("log", "Failed to open index temp file: %s\n", |
| 1769 g_strerror(errno)); |
1769 g_strerror(errno)); |
| 1770 g_free(pathstr); |
1770 g_free(pathstr); |
| 1771 g_free(index_tmp); |
1771 g_free(index_tmp); |
| 1772 index = NULL; |
1772 index = NULL; |
| 1773 } else { |
1773 } else { |
| 1774 if ((index = fdopen(index_fd, "wb")) == NULL) |
1774 if ((index = fdopen(index_fd, "wb")) == NULL) |
| 1775 { |
1775 { |
| 1776 purple_debug_error("log", "Failed to fdopen() index temp file: %s\n", |
1776 purple_debug_error("log", "Failed to fdopen() index temp file: %s\n", |
| 1777 g_strerror(errno)); |
1777 g_strerror(errno)); |
| 1778 close(index_fd); |
1778 close(index_fd); |
| 1779 if (index_tmp != NULL) |
1779 if (index_tmp != NULL) |
| 1780 { |
1780 { |
| 1781 g_unlink(index_tmp); |
1781 g_unlink(index_tmp); |
| 1782 g_free(index_tmp); |
1782 g_free(index_tmp); |
| 1828 data->length = newlen; |
1828 data->length = newlen; |
| 1829 |
1829 |
| 1830 log->logger_data = data; |
1830 log->logger_data = data; |
| 1831 list = g_list_prepend(list, log); |
1831 list = g_list_prepend(list, log); |
| 1832 |
1832 |
| 1833 /* XXX: There is apparently Is there a proper way to print a time_t? */ |
|
| 1834 if (index != NULL) |
1833 if (index != NULL) |
| 1835 fprintf(index, "%d\t%d\t%lu\n", data->offset, data->length, (unsigned long)log->time); |
1834 fprintf(index, "%d\t%d\t%lu\n", data->offset, data->length, (unsigned long)log->time); |
| 1836 } |
1835 } |
| 1837 } |
1836 } |
| 1838 |
1837 |
| 1888 data->length = newlen; |
1887 data->length = newlen; |
| 1889 |
1888 |
| 1890 log->logger_data = data; |
1889 log->logger_data = data; |
| 1891 list = g_list_prepend(list, log); |
1890 list = g_list_prepend(list, log); |
| 1892 |
1891 |
| 1893 /* XXX: Is there a proper way to print a time_t? */ |
|
| 1894 if (index != NULL) |
1892 if (index != NULL) |
| 1895 fprintf(index, "%d\t%d\t%d\n", data->offset, data->length, (int)log->time); |
1893 fprintf(index, "%d\t%d\t%lu\n", data->offset, data->length, (unsigned long)log->time); |
| 1896 } |
1894 } |
| 1897 } |
1895 } |
| 1898 |
1896 |
| 1899 purple_stringref_unref(pathref); |
1897 purple_stringref_unref(pathref); |
| 1900 fclose(file); |
1898 fclose(file); |
| 2023 set->name = set->normalized_name = name; |
2021 set->name = set->normalized_name = name; |
| 2024 |
2022 |
| 2025 /* Search the buddy list to find the account and to determine if this is a buddy. */ |
2023 /* Search the buddy list to find the account and to determine if this is a buddy. */ |
| 2026 for (gnode = purple_blist_get_root(); |
2024 for (gnode = purple_blist_get_root(); |
| 2027 !found && gnode != NULL; |
2025 !found && gnode != NULL; |
| 2028 gnode = purple_blist_node_get_sibling_next(gnode)) |
2026 gnode = purple_blist_node_get_sibling_next(gnode)) |
| 2029 { |
2027 { |
| 2030 if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
2028 if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
| 2031 continue; |
2029 continue; |
| 2032 |
2030 |
| 2033 for (cnode = purple_blist_node_get_first_child(gnode); |
2031 for (cnode = purple_blist_node_get_first_child(gnode); |
| 2037 if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
2035 if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
| 2038 continue; |
2036 continue; |
| 2039 |
2037 |
| 2040 for (bnode = purple_blist_node_get_first_child(cnode); |
2038 for (bnode = purple_blist_node_get_first_child(cnode); |
| 2041 !found && bnode != NULL; |
2039 !found && bnode != NULL; |
| 2042 bnode = purple_blist_node_get_sibling_next(bnode)) |
2040 bnode = purple_blist_node_get_sibling_next(bnode)) |
| 2043 { |
2041 { |
| 2044 PurpleBuddy *buddy = (PurpleBuddy *)bnode; |
2042 PurpleBuddy *buddy = (PurpleBuddy *)bnode; |
| 2045 |
2043 |
| 2046 if (purple_strequal(purple_buddy_get_name(buddy), name)) { |
2044 if (purple_strequal(purple_buddy_get_name(buddy), name)) { |
| 2047 set->account = purple_buddy_get_account(buddy); |
2045 set->account = purple_buddy_get_account(buddy); |