comparison libpurple/protocols/qq/buddy_info.c @ 30430:351d07aefb09

Kill off many dead assignments and any useless remaining variables. I think some of those QQ ones were actual logic errors, too. Let me know if there were any side-effects that were cut.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 23 Aug 2010 00:52:24 +0000
parents a5628ba3c83c
children f2e0b8f38e14
comparison
equal deleted inserted replaced
30429:922c8c553758 30430:351d07aefb09
222 } 222 }
223 223
224 void qq_request_buddy_info(PurpleConnection *gc, guint32 uid, 224 void qq_request_buddy_info(PurpleConnection *gc, guint32 uid,
225 guint32 update_class, int action) 225 guint32 update_class, int action)
226 { 226 {
227 qq_data *qd;
228 gchar raw_data[16] = {0}; 227 gchar raw_data[16] = {0};
229 228
230 g_return_if_fail(uid != 0); 229 g_return_if_fail(uid != 0);
231 230
232 qd = (qq_data *) gc->proto_data;
233 g_snprintf(raw_data, sizeof(raw_data), "%u", uid); 231 g_snprintf(raw_data, sizeof(raw_data), "%u", uid);
234 qq_send_cmd_mess(gc, QQ_CMD_GET_BUDDY_INFO, (guint8 *) raw_data, strlen(raw_data), 232 qq_send_cmd_mess(gc, QQ_CMD_GET_BUDDY_INFO, (guint8 *) raw_data, strlen(raw_data),
235 update_class, action); 233 update_class, action);
236 } 234 }
237 235
269 267
270 /* parse fields and send info packet */ 268 /* parse fields and send info packet */
271 static void info_modify_ok_cb(modify_info_request *info_request, PurpleRequestFields *fields) 269 static void info_modify_ok_cb(modify_info_request *info_request, PurpleRequestFields *fields)
272 { 270 {
273 PurpleConnection *gc; 271 PurpleConnection *gc;
274 qq_data *qd;
275 gchar **segments; 272 gchar **segments;
276 int index; 273 int index;
277 const char *utf8_str; 274 const char *utf8_str;
278 gchar *value; 275 gchar *value;
279 int choice_num; 276 int choice_num;
280 277
281 gc = info_request->gc; 278 gc = info_request->gc;
282 g_return_if_fail(gc != NULL && info_request->gc); 279 g_return_if_fail(gc != NULL);
283 qd = (qq_data *) gc->proto_data;
284 segments = info_request->segments; 280 segments = info_request->segments;
285 g_return_if_fail(segments != NULL); 281 g_return_if_fail(segments != NULL);
286 282
287 for (index = 1; segments[index] != NULL && index < QQ_INFO_LAST; index++) { 283 for (index = 1; segments[index] != NULL && index < QQ_INFO_LAST; index++) {
288 if (field_infos[index].iclass == QQ_FIELD_UNUSED) { 284 if (field_infos[index].iclass == QQ_FIELD_UNUSED) {
388 } 384 }
389 } 385 }
390 386
391 static void info_modify_dialogue(PurpleConnection *gc, gchar **segments, int iclass) 387 static void info_modify_dialogue(PurpleConnection *gc, gchar **segments, int iclass)
392 { 388 {
393 qq_data *qd;
394 PurpleRequestFieldGroup *group; 389 PurpleRequestFieldGroup *group;
395 PurpleRequestFields *fields; 390 PurpleRequestFields *fields;
396 modify_info_request *info_request; 391 modify_info_request *info_request;
397 gchar *utf8_title, *utf8_prim; 392 gchar *utf8_title, *utf8_prim;
398 int index; 393 int index;
399 394
400 qd = (qq_data *) gc->proto_data;
401 /* Keep one dialog once a time */ 395 /* Keep one dialog once a time */
402 purple_request_close_with_handle(gc); 396 purple_request_close_with_handle(gc);
403 397
404 fields = purple_request_fields_new(); 398 fields = purple_request_fields_new();
405 group = purple_request_field_group_new(NULL); 399 group = purple_request_field_group_new(NULL);
414 408
415 switch (iclass) { 409 switch (iclass) {
416 case QQ_FIELD_CONTACT: 410 case QQ_FIELD_CONTACT:
417 utf8_title = g_strdup(_("Modify Contact")); 411 utf8_title = g_strdup(_("Modify Contact"));
418 utf8_prim = g_strdup_printf("%s for %s", _("Modify Contact"), segments[0]); 412 utf8_prim = g_strdup_printf("%s for %s", _("Modify Contact"), segments[0]);
413 break;
419 case QQ_FIELD_ADDR: 414 case QQ_FIELD_ADDR:
420 utf8_title = g_strdup(_("Modify Address")); 415 utf8_title = g_strdup(_("Modify Address"));
421 utf8_prim = g_strdup_printf("%s for %s", _("Modify Address"), segments[0]); 416 utf8_prim = g_strdup_printf("%s for %s", _("Modify Address"), segments[0]);
417 break;
422 case QQ_FIELD_EXT: 418 case QQ_FIELD_EXT:
423 utf8_title = g_strdup(_("Modify Extended Information")); 419 utf8_title = g_strdup(_("Modify Extended Information"));
424 utf8_prim = g_strdup_printf("%s for %s", _("Modify Extended Information"), segments[0]); 420 utf8_prim = g_strdup_printf("%s for %s", _("Modify Extended Information"), segments[0]);
425 break; 421 break;
426 case QQ_FIELD_BASE: 422 case QQ_FIELD_BASE:
427 default: 423 default:
428 utf8_title = g_strdup(_("Modify Information")); 424 utf8_title = g_strdup(_("Modify Information"));
429 utf8_prim = g_strdup_printf("%s for %s", _("Modify Information"), segments[0]); 425 utf8_prim = g_strdup_printf("%s for %s", _("Modify Information"), segments[0]);
426 break;
430 } 427 }
431 428
432 info_request = g_new0(modify_info_request, 1); 429 info_request = g_new0(modify_info_request, 1);
433 info_request->gc = gc; 430 info_request->gc = gc;
434 info_request->iclass = iclass; 431 info_request->iclass = iclass;