| 400 } else { /* a group */ |
400 } else { /* a group */ |
| 401 group = qq_room_search_id(gc, uid); |
401 group = qq_room_search_id(gc, uid); |
| 402 if(group == NULL) { |
402 if(group == NULL) { |
| 403 purple_debug_info("QQ", |
403 purple_debug_info("QQ", |
| 404 "Not find room id %d in qq_process_get_buddies_and_rooms\n", uid); |
404 "Not find room id %d in qq_process_get_buddies_and_rooms\n", uid); |
| 405 qq_set_pending_id(&qd->adding_groups_from_server, uid, TRUE); |
|
| 406 //group = g_newa(qq_group, 1); |
|
| 407 //group->id = uid; |
|
| 408 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, uid, NULL, 0, |
405 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, uid, NULL, 0, |
| 409 0, 0); |
406 0, QQ_ROOM_INFO_CREATE); |
| 410 } else { |
407 } else { |
| 411 group->my_role = QQ_ROOM_ROLE_YES; |
408 group->my_role = QQ_ROOM_ROLE_YES; |
| 412 qq_group_refresh(gc, group); |
409 qq_group_refresh(gc, group); |
| 413 } |
410 } |
| 414 ++j; |
411 ++j; |
| 428 #define QQ_CHANGE_ONLINE_STATUS_REPLY_OK 0x30 /* ASCII value of "0" */ |
425 #define QQ_CHANGE_ONLINE_STATUS_REPLY_OK 0x30 /* ASCII value of "0" */ |
| 429 |
426 |
| 430 /* TODO: figure out what's going on with the IP region. Sometimes I get valid IP addresses, |
427 /* TODO: figure out what's going on with the IP region. Sometimes I get valid IP addresses, |
| 431 * but the port number's weird, other times I get 0s. I get these simultaneously on the same buddy, |
428 * but the port number's weird, other times I get 0s. I get these simultaneously on the same buddy, |
| 432 * using different accounts to get info. */ |
429 * using different accounts to get info. */ |
| 433 |
|
| 434 /* Help calculate the correct icon index to tell the server. */ |
|
| 435 gint get_icon_offset(PurpleConnection *gc) |
|
| 436 { |
|
| 437 PurpleAccount *account; |
|
| 438 PurplePresence *presence; |
|
| 439 |
|
| 440 account = purple_connection_get_account(gc); |
|
| 441 presence = purple_account_get_presence(account); |
|
| 442 |
|
| 443 if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_INVISIBLE)) { |
|
| 444 return 2; |
|
| 445 } else if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_AWAY) |
|
| 446 || purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_EXTENDED_AWAY) |
|
| 447 || purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_UNAVAILABLE)) { |
|
| 448 return 1; |
|
| 449 } else { |
|
| 450 return 0; |
|
| 451 } |
|
| 452 } |
|
| 453 |
|
| 454 static guint8 get_status_from_purple(PurpleConnection *gc) |
430 static guint8 get_status_from_purple(PurpleConnection *gc) |
| 455 { |
431 { |
| 456 qq_data *qd; |
432 qq_data *qd; |
| 457 PurpleAccount *account; |
433 PurpleAccount *account; |
| 458 PurplePresence *presence; |
434 PurplePresence *presence; |