| 1761 } |
1761 } |
| 1762 |
1762 |
| 1763 index_tmp = g_strdup_printf("%s.XXXXXX", pathstr); |
1763 index_tmp = g_strdup_printf("%s.XXXXXX", pathstr); |
| 1764 if ((index_fd = g_mkstemp(index_tmp)) == -1) { |
1764 if ((index_fd = g_mkstemp(index_tmp)) == -1) { |
| 1765 purple_debug_error("log", "Failed to open index temp file: %s\n", |
1765 purple_debug_error("log", "Failed to open index temp file: %s\n", |
| 1766 g_strerror(errno)); |
1766 g_strerror(errno)); |
| 1767 g_free(pathstr); |
1767 g_free(pathstr); |
| 1768 g_free(index_tmp); |
1768 g_free(index_tmp); |
| 1769 index = NULL; |
1769 index = NULL; |
| 1770 } else { |
1770 } else { |
| 1771 if ((index = fdopen(index_fd, "wb")) == NULL) |
1771 if ((index = fdopen(index_fd, "wb")) == NULL) |
| 1772 { |
1772 { |
| 1773 purple_debug_error("log", "Failed to fdopen() index temp file: %s\n", |
1773 purple_debug_error("log", "Failed to fdopen() index temp file: %s\n", |
| 1774 g_strerror(errno)); |
1774 g_strerror(errno)); |
| 1775 close(index_fd); |
1775 close(index_fd); |
| 1776 if (index_tmp != NULL) |
1776 if (index_tmp != NULL) |
| 1777 { |
1777 { |
| 1778 g_unlink(index_tmp); |
1778 g_unlink(index_tmp); |
| 1779 g_free(index_tmp); |
1779 g_free(index_tmp); |
| 2020 set->name = set->normalized_name = name; |
2020 set->name = set->normalized_name = name; |
| 2021 |
2021 |
| 2022 /* Search the buddy list to find the account and to determine if this is a buddy. */ |
2022 /* Search the buddy list to find the account and to determine if this is a buddy. */ |
| 2023 for (gnode = purple_blist_get_root(); |
2023 for (gnode = purple_blist_get_root(); |
| 2024 !found && gnode != NULL; |
2024 !found && gnode != NULL; |
| 2025 gnode = purple_blist_node_get_sibling_next(gnode)) |
2025 gnode = purple_blist_node_get_sibling_next(gnode)) |
| 2026 { |
2026 { |
| 2027 if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
2027 if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
| 2028 continue; |
2028 continue; |
| 2029 |
2029 |
| 2030 for (cnode = purple_blist_node_get_first_child(gnode); |
2030 for (cnode = purple_blist_node_get_first_child(gnode); |
| 2034 if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
2034 if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
| 2035 continue; |
2035 continue; |
| 2036 |
2036 |
| 2037 for (bnode = purple_blist_node_get_first_child(cnode); |
2037 for (bnode = purple_blist_node_get_first_child(cnode); |
| 2038 !found && bnode != NULL; |
2038 !found && bnode != NULL; |
| 2039 bnode = purple_blist_node_get_sibling_next(bnode)) |
2039 bnode = purple_blist_node_get_sibling_next(bnode)) |
| 2040 { |
2040 { |
| 2041 PurpleBuddy *buddy = (PurpleBuddy *)bnode; |
2041 PurpleBuddy *buddy = (PurpleBuddy *)bnode; |
| 2042 |
2042 |
| 2043 if (purple_strequal(purple_buddy_get_name(buddy), name)) { |
2043 if (purple_strequal(purple_buddy_get_name(buddy), name)) { |
| 2044 set->account = purple_buddy_get_account(buddy); |
2044 set->account = purple_buddy_get_account(buddy); |