changeset 29393:fa35d7029a14

* Don't crash if status is NULL * Try to make the formatting of this code a little cleaner (to me, anyway) * Print out the entire xml string instead of just pieces. Avoids a potential NULL-printf (do we still care about these? I heard a rumor that newer windows glibc handled "%s", null), and provides more info
author Mark Doliner <mark@kingant.net>
date Tue, 09 Feb 2010 01:51:25 +0000
parents 4863fed15aa2
children d1cecbc467c6
files libpurple/protocols/yahoo/libymsg.c
diffstat 1 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/libymsg.c	Mon Feb 08 18:38:42 2010 +0000
+++ b/libpurple/protocols/yahoo/libymsg.c	Tue Feb 09 01:51:25 2010 +0000
@@ -4259,15 +4259,19 @@
 		validate_data_child = xmlnode_get_child(validate_data_root, "carrier");
 		carrier = xmlnode_get_data(validate_data_child);
 
-		purple_debug_info("yahoo","SMS validate data: Mobile:%s, Status:%s, Carrier:%s\n", mobile_no, status, carrier);
-
-		if( strcmp(status, "Valid") == 0) {
-			g_hash_table_insert(yd->sms_carrier, g_strdup_printf("+%s", mobile_no), g_strdup(carrier));
-			yahoo_send_im(sms_cb_data->gc, sms_cb_data->who, sms_cb_data->what, PURPLE_MESSAGE_SEND);
-		}
-		else	{
-			g_hash_table_insert(yd->sms_carrier, g_strdup_printf("+%s", mobile_no), g_strdup("Unknown"));
-			purple_conversation_write(conv, NULL, _("Can't send SMS. Unknown mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL));
+		purple_debug_info("yahoo", "SMS validate data: %s\n", webdata);
+
+		if (status && g_str_equal(status, "Valid") == 0) {
+			g_hash_table_insert(yd->sms_carrier,
+					g_strdup_printf("+%s", mobile_no), g_strdup(carrier));
+			yahoo_send_im(sms_cb_data->gc, sms_cb_data->who,
+					sms_cb_data->what, PURPLE_MESSAGE_SEND);
+		} else {
+			g_hash_table_insert(yd->sms_carrier,
+					g_strdup_printf("+%s", mobile_no), g_strdup("Unknown"));
+			purple_conversation_write(conv, NULL,
+					_("Can't send SMS. Unknown mobile carrier."),
+					PURPLE_MESSAGE_SYSTEM, time(NULL));
 		}
 
 		xmlnode_free(validate_data_child);