comparison libpurple/protocols/yahoo/libymsg.c @ 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 99b9c9ee7363
children d1cecbc467c6
comparison
equal deleted inserted replaced
29392:4863fed15aa2 29393:fa35d7029a14
4257 status = xmlnode_get_data(validate_data_child); 4257 status = xmlnode_get_data(validate_data_child);
4258 4258
4259 validate_data_child = xmlnode_get_child(validate_data_root, "carrier"); 4259 validate_data_child = xmlnode_get_child(validate_data_root, "carrier");
4260 carrier = xmlnode_get_data(validate_data_child); 4260 carrier = xmlnode_get_data(validate_data_child);
4261 4261
4262 purple_debug_info("yahoo","SMS validate data: Mobile:%s, Status:%s, Carrier:%s\n", mobile_no, status, carrier); 4262 purple_debug_info("yahoo", "SMS validate data: %s\n", webdata);
4263 4263
4264 if( strcmp(status, "Valid") == 0) { 4264 if (status && g_str_equal(status, "Valid") == 0) {
4265 g_hash_table_insert(yd->sms_carrier, g_strdup_printf("+%s", mobile_no), g_strdup(carrier)); 4265 g_hash_table_insert(yd->sms_carrier,
4266 yahoo_send_im(sms_cb_data->gc, sms_cb_data->who, sms_cb_data->what, PURPLE_MESSAGE_SEND); 4266 g_strdup_printf("+%s", mobile_no), g_strdup(carrier));
4267 } 4267 yahoo_send_im(sms_cb_data->gc, sms_cb_data->who,
4268 else { 4268 sms_cb_data->what, PURPLE_MESSAGE_SEND);
4269 g_hash_table_insert(yd->sms_carrier, g_strdup_printf("+%s", mobile_no), g_strdup("Unknown")); 4269 } else {
4270 purple_conversation_write(conv, NULL, _("Can't send SMS. Unknown mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL)); 4270 g_hash_table_insert(yd->sms_carrier,
4271 g_strdup_printf("+%s", mobile_no), g_strdup("Unknown"));
4272 purple_conversation_write(conv, NULL,
4273 _("Can't send SMS. Unknown mobile carrier."),
4274 PURPLE_MESSAGE_SYSTEM, time(NULL));
4271 } 4275 }
4272 4276
4273 xmlnode_free(validate_data_child); 4277 xmlnode_free(validate_data_child);
4274 xmlnode_free(validate_data_root); 4278 xmlnode_free(validate_data_root);
4275 g_free(sms_cb_data->who); 4279 g_free(sms_cb_data->who);