pidgin: fd954d6a: Further cleanup to fix CID 373.

datallah at pidgin.im datallah at pidgin.im
Tue Dec 9 21:50:27 EST 2008


-----------------------------------------------------------------
Revision: fd954d6a415456dce86aa9443b24e1df25019bd7
Ancestor: 0a8ec53a6de6bb97a7e43abb0364227be7d15b14
Author: datallah at pidgin.im
Date: 2008-12-10T02:44:03
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/fd954d6a415456dce86aa9443b24e1df25019bd7

Modified files:
        libpurple/protocols/bonjour/bonjour_ft.c
        libpurple/protocols/bonjour/jabber.c

ChangeLog: 

Further cleanup to fix CID 373.

-------------- next part --------------
============================================================
--- libpurple/protocols/bonjour/bonjour_ft.c	655f82b2b35b210d3fce3d3675088eaeb79e3a1f
+++ libpurple/protocols/bonjour/bonjour_ft.c	6f80818d2a9d4999de657e50ef0168af44d7fdbe
@@ -411,8 +411,10 @@ xep_si_parse(PurpleConnection *pc, xmlno
 	BonjourData *bd;
 	PurpleXfer *xfer;
 
-	if(pc == NULL || packet == NULL || pb == NULL)
-		return;
+	g_return_if_fail(pc != NULL);
+	g_return_if_fail(packet != NULL);
+	g_return_if_fail(pb != NULL);
+
 	bd = (BonjourData*) pc->proto_data;
 	if(bd == NULL)
 		return;
@@ -488,8 +490,9 @@ xep_bytestreams_parse(PurpleConnection *
 	xmlnode *query;
 	BonjourData *bd;
 
-	if(pc == NULL || packet == NULL || pb == NULL)
-		return;
+	g_return_if_fail(pc != NULL);
+	g_return_if_fail(packet != NULL);
+	g_return_if_fail(pb != NULL);
 
 	bd = (BonjourData*) pc->proto_data;
 	if(bd == NULL)
============================================================
--- libpurple/protocols/bonjour/jabber.c	7ae523d26e4c3cdb1a3f09fcc5679d34d6073899
+++ libpurple/protocols/bonjour/jabber.c	950c3dbec07ffe4800de1ed6c66bb5d4c54550b3
@@ -77,7 +77,7 @@ static void
 };
 
 static void
-xep_iq_parse(xmlnode *packet, PurpleConnection *connection, PurpleBuddy *pb);
+xep_iq_parse(xmlnode *packet, PurpleBuddy *pb);
 
 static BonjourJabberConversation *
 bonjour_jabber_conv_new(PurpleBuddy *pb, PurpleAccount *account, const char *ip) {
@@ -364,7 +364,7 @@ void bonjour_jabber_process_packet(Purpl
 	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);
+		xep_iq_parse(packet, pb);
 	else
 		purple_debug_warning("bonjour", "Unknown packet: %s\n", packet->name ? packet->name : "(null)");
 }
@@ -1158,14 +1158,12 @@ check_if_blocked(PurpleBuddy *pb)
 check_if_blocked(PurpleBuddy *pb)
 {
 	gboolean blocked = FALSE;
-	GSList *l = NULL;
-	PurpleAccount *acc = NULL;
+	GSList *l;
+	PurpleAccount *acc = purple_buddy_get_account(pb);
 
-	if(pb == NULL)
+	if(acc == NULL)
 		return FALSE;
 
-	acc = pb->account;
-
 	for(l = acc->deny; l != NULL; l = l->next) {
 		if(!purple_utf8_strcasecmp(pb->name, (char *)l->data)) {
 			purple_debug_info("bonjour", "%s has been blocked by %s.\n", pb->name, acc->username);
@@ -1177,25 +1175,19 @@ static void
 }
 
 static void
-xep_iq_parse(xmlnode *packet, PurpleConnection *connection, PurpleBuddy *pb)
+xep_iq_parse(xmlnode *packet, PurpleBuddy *pb)
 {
-	xmlnode *child = NULL;
+	xmlnode *child;
 
-	if(packet == NULL || pb == NULL)
-		return;
-
-	if(connection == NULL) {
-		if(pb->account != NULL)
-			connection = (pb->account)->gc;
-	}
-
 	if(check_if_blocked(pb))
 		return;
 
 	if ((child = xmlnode_get_child(packet, "si")) || (child = xmlnode_get_child(packet, "error")))
-		xep_si_parse(connection, packet, pb);
+		xep_si_parse(purple_account_get_connection(pb->account),
+			packet, pb);
 	else
-		xep_bytestreams_parse(connection, packet, pb);
+		xep_bytestreams_parse(purple_account_get_connection(pb->account),
+			packet, pb);
 }
 
 int


More information about the Commits mailing list