Mercurial > pidgin.yaz
changeset 24623:35d0ce5f319a
Further cleanup to fix CID 373.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Wed, 10 Dec 2008 02:44:03 +0000 |
parents | 7b10acb20526 |
children | eae0e194658e |
files | libpurple/protocols/bonjour/bonjour_ft.c libpurple/protocols/bonjour/jabber.c |
diffstat | 2 files changed, 18 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/bonjour_ft.c Wed Dec 10 02:28:30 2008 +0000 +++ b/libpurple/protocols/bonjour/bonjour_ft.c Wed Dec 10 02:44:03 2008 +0000 @@ -411,8 +411,10 @@ 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 @@ 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)
--- a/libpurple/protocols/bonjour/jabber.c Wed Dec 10 02:28:30 2008 +0000 +++ b/libpurple/protocols/bonjour/jabber.c Wed Dec 10 02:44:03 2008 +0000 @@ -77,7 +77,7 @@ }; 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 @@ 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) { 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 -xep_iq_parse(xmlnode *packet, PurpleConnection *connection, PurpleBuddy *pb) +xep_iq_parse(xmlnode *packet, PurpleBuddy *pb) { - xmlnode *child = NULL; - - if(packet == NULL || pb == NULL) - return; - - if(connection == NULL) { - if(pb->account != NULL) - connection = (pb->account)->gc; - } + xmlnode *child; 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