im.pidgin.pidgin: faa582bf7e047ea81c74ab372095434ae26d7832

datallah at pidgin.im datallah at pidgin.im
Thu Nov 15 12:37:03 EST 2007


-----------------------------------------------------------------
Revision: faa582bf7e047ea81c74ab372095434ae26d7832
Ancestor: fc30f406394a49062a0b54c77bb51e95f19b5608
Author: datallah at pidgin.im
Date: 2007-11-15T17:27:16
Branch: im.pidgin.pidgin

Modified 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

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/bonjour/bonjour.c	31f32c7e54739ad6f7d7455442e7b2b9c11e01b8
+++ libpurple/protocols/bonjour/bonjour.c	ab854bdc1c3160fecdf938fbe22cbf20a5ddb10f
@@ -86,6 +86,7 @@ bonjour_removeallfromlocal(PurpleConnect
 				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);
 			}
 		}
============================================================
--- libpurple/protocols/bonjour/bonjour_ft.c	79d8d4dd925173212558e3c363cb645d4601d766
+++ libpurple/protocols/bonjour/bonjour_ft.c	2686dbe09ac1e9e11de4a5a3a98b3c0ef45fef56
@@ -625,7 +625,14 @@ bonjour_sock5_request_cb(gpointer data, 
 		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;
 
============================================================
--- libpurple/protocols/bonjour/jabber.c	bd176d594c58c36c7c5c52336050b6d567c22dc1
+++ libpurple/protocols/bonjour/jabber.c	2efbf5ef31788c2042d42e9bc657e4faedc07a24
@@ -327,13 +327,15 @@ void bonjour_jabber_process_packet(Purpl
 }
 
 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 @@ _client_socket_handler(gpointer data, gi
 		/* 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 @@ _client_socket_handler(gpointer data, gi
 		}
 		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 {
============================================================
--- libpurple/protocols/bonjour/mdns_avahi.c	c1f5802b294ab38d21f3372bc541440071a4559d
+++ libpurple/protocols/bonjour/mdns_avahi.c	5cd991c2ee38f86b764210de978cbc1f48c8a796
@@ -81,6 +81,7 @@ _resolver_callback(AvahiServiceResolver 
 				/* 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 @@ _resolver_callback(AvahiServiceResolver 
 			}
 
 			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 @@ _browser_callback(AvahiServiceBrowser *b
 		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:
============================================================
--- libpurple/protocols/bonjour/mdns_howl.c	73b2d22de3f8220b50e523c59207e8709e59288a
+++ libpurple/protocols/bonjour/mdns_howl.c	4ca7d855dcc039f89f83b312ab8a5354a093cffb
@@ -115,7 +115,7 @@ _browser_reply(sw_discovery discovery, s
 {
 	sw_discovery_resolve_id rid;
 	PurpleAccount *account = (PurpleAccount*)extra;
-	PurpleBuddy *gb = NULL;
+	PurpleBuddy *0b = NULL;
 
 	switch (status)
 	{
@@ -148,9 +148,11 @@ _browser_reply(sw_discovery discovery, s
 			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");
============================================================
--- libpurple/protocols/bonjour/mdns_win32.c	544621f7ceac5ef9451d047f2b5855649412dbe0
+++ libpurple/protocols/bonjour/mdns_win32.c	ce1562e7608efd912c35189431c839366b8c269d
@@ -238,8 +238,11 @@ _mdns_service_browse_callback(DNSService
 		/* 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)");
 	}
 }
 
============================================================
--- libpurple/protocols/bonjour/parser.c	e0107a8afc655564ba4a1c424820b37e7d31dab4
+++ libpurple/protocols/bonjour/parser.c	19899ac4f7916de7238ed94ba77f92aaad9626e9
@@ -188,6 +188,9 @@ void bonjour_parser_process(PurpleBuddy 
 {
 	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. */


More information about the Commits mailing list