Mercurial > pidgin
changeset 21527:5b9da9db7e81
Various bugfixes including using purple_account_remove_buddy() in addition to purple_blist_remove_buddy() to make sure that the buddy gets cleaned up fully when logging out or we go offline.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 15 Nov 2007 17:27:16 +0000 |
parents | aee91450a46a |
children | c9c6f77f624e |
files | libpurple/protocols/bonjour/bonjour.c libpurple/protocols/bonjour/bonjour_ft.c libpurple/protocols/bonjour/jabber.c libpurple/protocols/bonjour/mdns_avahi.c libpurple/protocols/bonjour/mdns_howl.c libpurple/protocols/bonjour/mdns_win32.c libpurple/protocols/bonjour/parser.c |
diffstat | 7 files changed, 36 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/bonjour.c Thu Nov 15 17:25:34 2007 +0000 +++ b/libpurple/protocols/bonjour/bonjour.c Thu Nov 15 17:27:16 2007 +0000 @@ -86,6 +86,7 @@ if (buddy->account != account) continue; purple_prpl_got_user_status(account, buddy->name, "offline", NULL); + purple_account_remove_buddy(account, buddy, NULL); purple_blist_remove_buddy(buddy); } }
--- a/libpurple/protocols/bonjour/bonjour_ft.c Thu Nov 15 17:25:34 2007 +0000 +++ b/libpurple/protocols/bonjour/bonjour_ft.c Thu Nov 15 17:27:16 2007 +0000 @@ -625,7 +625,14 @@ if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) { } else if(acceptfd == -1) { - /* TODO: This should cancel the ft */ + /* This should cancel the ft */ + purple_debug_error("Error accepting incoming SOCKS5 connection. (%d)\n", errno); + + purple_input_remove(xfer->watcher); + xfer->watcher = 0; + close(source); + purple_xfer_cancel_remote(xfer); + return; } else { int flags;
--- a/libpurple/protocols/bonjour/jabber.c Thu Nov 15 17:25:34 2007 +0000 +++ b/libpurple/protocols/bonjour/jabber.c Thu Nov 15 17:27:16 2007 +0000 @@ -327,13 +327,15 @@ } void bonjour_jabber_process_packet(PurpleBuddy *pb, xmlnode *packet) { + + g_return_if_fail(packet != NULL); + if (!strcmp(packet->name, "message")) _jabber_parse_and_write_message_to_ui(packet, pb); else if(!strcmp(packet->name, "iq")) xep_iq_parse(packet, NULL, pb); else - purple_debug_warning("bonjour", "Unknown packet: %s\n", - packet->name); + purple_debug_warning("bonjour", "Unknown packet: %s\n", packet->name ? packet->name : "(null)"); } @@ -351,8 +353,9 @@ /* There have been an error reading from the socket */ if (errno != EAGAIN) { BonjourBuddy *bb = pb->proto_data; + const char *err = g_strerror(errno); - purple_debug_warning("bonjour", "receive error: %s\n", g_strerror(errno)); + purple_debug_warning("bonjour", "receive error: %s\n", err ? err : "(null)"); bonjour_jabber_close_conversation(bb->conversation); bb->conversation = NULL; @@ -362,7 +365,7 @@ } return; } else if (len == 0) { /* The other end has closed the socket */ - purple_debug_warning("bonjour", "Connection closed (without stream end) by %s.\n", pb->name); + purple_debug_warning("bonjour", "Connection closed (without stream end) by %s.\n", pb->name ? pb->name : "(null)"); bonjour_jabber_stream_ended(pb); return; } else {
--- a/libpurple/protocols/bonjour/mdns_avahi.c Thu Nov 15 17:25:34 2007 +0000 +++ b/libpurple/protocols/bonjour/mdns_avahi.c Thu Nov 15 17:27:16 2007 +0000 @@ -81,6 +81,7 @@ /* We've already freed the resolver */ if (r == ((AvahiBuddyImplData *)bb->mdns_impl_data)->resolver) ((AvahiBuddyImplData *)bb->mdns_impl_data)->resolver = NULL; + purple_account_remove_buddy(account, pb, NULL); purple_blist_remove_buddy(pb); } break; @@ -117,9 +118,10 @@ } if (!bonjour_buddy_check(bb)) { - if (pb != NULL) + if (pb != NULL) { + purple_account_remove_buddy(account, pb, NULL); purple_blist_remove_buddy(pb); - else + } else bonjour_buddy_delete(bb); } else /* Add or update the buddy in our buddy list */ @@ -163,8 +165,10 @@ case AVAHI_BROWSER_REMOVE: purple_debug_info("bonjour", "_browser_callback - Remove service\n"); pb = purple_find_buddy(account, name); - if (pb != NULL) + if (pb != NULL) { + purple_account_remove_buddy(account, pb, NULL); purple_blist_remove_buddy(pb); + } break; case AVAHI_BROWSER_ALL_FOR_NOW: case AVAHI_BROWSER_CACHE_EXHAUSTED:
--- a/libpurple/protocols/bonjour/mdns_howl.c Thu Nov 15 17:25:34 2007 +0000 +++ b/libpurple/protocols/bonjour/mdns_howl.c Thu Nov 15 17:27:16 2007 +0000 @@ -115,7 +115,7 @@ { sw_discovery_resolve_id rid; PurpleAccount *account = (PurpleAccount*)extra; - PurpleBuddy *gb = NULL; + PurpleBuddy *0b = NULL; switch (status) { @@ -148,9 +148,11 @@ break; case SW_DISCOVERY_BROWSE_REMOVE_SERVICE: purple_debug_info("bonjour", "_browser_reply --> Remove service\n"); - gb = purple_find_buddy(account, name); - if (gb != NULL) - purple_blist_remove_buddy(gb); + pb = purple_find_buddy(account, name); + if (pb != NULL) { + purple_account_remove_buddy(account, pb, NULL); + purple_blist_remove_buddy(pb); + } break; case SW_DISCOVERY_BROWSE_RESOLVED: purple_debug_info("bonjour", "_browse_reply --> Resolved\n");
--- a/libpurple/protocols/bonjour/mdns_win32.c Thu Nov 15 17:25:34 2007 +0000 +++ b/libpurple/protocols/bonjour/mdns_win32.c Thu Nov 15 17:27:16 2007 +0000 @@ -238,8 +238,11 @@ /* A peer has sent a goodbye packet, remove them from the buddy list */ purple_debug_info("bonjour", "service browser - remove notification\n"); pb = purple_find_buddy(account, serviceName); - if (pb != NULL) + if (pb != NULL) { + purple_account_remove_buddy(account, pb, NULL); purple_blist_remove_buddy(pb); + } else + purple_debug_warning("bonjour", "Unable to find buddy (%s) to remove\n", serviceName ? serviceName : "(null)"); } }
--- a/libpurple/protocols/bonjour/parser.c Thu Nov 15 17:25:34 2007 +0000 +++ b/libpurple/protocols/bonjour/parser.c Thu Nov 15 17:27:16 2007 +0000 @@ -188,6 +188,9 @@ { BonjourBuddy *bb = pb->proto_data; + g_return_if_fail(bb != NULL); + g_return_if_fail(bb->conversation != NULL); + if (bb->conversation->context == NULL) { /* libxml inconsistently starts parsing on creating the * parser, so do a ParseChunk right afterwards to force it. */