~vish/ubuntu/maverick/pidgin/bug25979

« back to all changes in this revision

Viewing changes to libpurple/protocols/qq/buddy_list.c

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-10-09 19:40:26 UTC
  • mfrom: (1.4.1 upstream) (46.1.10 karmic)
  • Revision ID: james.westby@ubuntu.com-20091009194026-wbqqh0bsbz19nx5q
Tags: 1:2.6.2-1ubuntu7
* Don't stick the buddy list window to all desktops as some
  window managers have trouble to properly unstick it (LP: #346840)
  - debian/patches/11_buddy_list_really_show.patch
* Always use default tray icon size on KDE (LP: #209440)
  - debian/patches/62_tray_icon_size_kde.patch
* Use scrollbars in the preferences dialog if the screen height is
  below 700 px instead of 600 px
  - debian/patches/60_1024x600_gtkprefs.c.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
#define QQ_GET_ONLINE_BUDDY_03          0x03    /* unknown function */
48
48
 
49
49
typedef struct _qq_buddy_online {
50
 
        qq_buddy_status bs;
51
50
        guint16 unknown1;
52
51
        guint8 ext_flag;
53
52
        guint8 comm_flag;
216
215
                if (qd->client_version >= 2007) bytes += 4;
217
216
 
218
217
                if (bs.uid == 0 || (bytes - bytes_start) != entry_len) {
219
 
                        purple_debug_error("QQ", "uid=0 or entry complete len(%d) != %d",
 
218
                        purple_debug_error("QQ", "uid=0 or entry complete len(%d) != %d\n",
220
219
                                        (bytes - bytes_start), entry_len);
221
220
                        continue;
222
221
                }       /* check if it is a valid entry */
233
232
                        /* create no-auth buddy */
234
233
                        buddy = qq_buddy_new(gc, bs.uid);
235
234
                }
236
 
                bd = (buddy == NULL) ? NULL : (qq_buddy_data *)buddy->proto_data;
 
235
                bd = (buddy == NULL) ? NULL : (qq_buddy_data *)purple_buddy_get_protocol_data(buddy);
237
236
                if (bd == NULL) {
238
237
                        purple_debug_error("QQ",
239
238
                                        "Got an online buddy %u, but not in my buddy list\n", bs.uid);
282
281
        qd = (qq_data *) gc->proto_data;
283
282
 
284
283
        if (data_len <= 2) {
285
 
                purple_debug_error("QQ", "empty buddies list");
 
284
                purple_debug_error("QQ", "empty buddies list\n");
286
285
                return -1;
287
286
        }
288
287
        /* qq_show_packet("QQ get buddies list", data, data_len); */
335
334
#endif
336
335
 
337
336
                buddy = qq_buddy_find_or_new(gc, bd.uid);
338
 
                if (buddy == NULL || buddy->proto_data == NULL) {
 
337
                if (buddy == NULL || purple_buddy_get_protocol_data(buddy) == NULL) {
339
338
                        g_free(bd.nickname);
340
339
                        continue;
341
340
                }
343
342
                bd.last_update = time(NULL);
344
343
                qq_update_buddy_status(gc, bd.uid, bd.status, bd.comm_flag);
345
344
 
346
 
                g_memmove(buddy->proto_data, &bd, sizeof(qq_buddy_data));
 
345
                g_memmove(purple_buddy_get_protocol_data(buddy), &bd, sizeof(qq_buddy_data));
347
346
                /* nickname has been copy to buddy_data do not free
348
347
                   g_free(bd.nickname);
349
348
                */
353
352
 
354
353
        if(bytes > data_len) {
355
354
                purple_debug_error("QQ",
356
 
                                "qq_process_get_buddies: Dangerous error! maybe protocol changed, notify developers!");
 
355
                                "qq_process_get_buddies: Dangerous error! maybe protocol changed, notify developers!\n");
357
356
        }
358
357
 
359
358
        purple_debug_info("QQ", "Received %d buddies, nextposition=%u\n",
398
397
                /* 05: skip unknow 0x00 */
399
398
                bytes += 1;
400
399
                if (uid == 0 || (type != 0x1 && type != 0x4)) {
401
 
                        purple_debug_info("QQ", "Buddy entry, uid=%u, type=%d", uid, type);
 
400
                        purple_debug_info("QQ", "Buddy entry, uid=%u, type=%d\n", uid, type);
402
401
                        continue;
403
402
                }
404
403
                if(0x1 == type) { /* a buddy */
408
407
                } else { /* a group */
409
408
                        rmd = qq_room_data_find(gc, uid);
410
409
                        if(rmd == NULL) {
411
 
                                purple_debug_info("QQ", "Unknow room id %u", uid);
 
410
                                purple_debug_info("QQ", "Unknown room id %u\n", uid);
412
411
                                qq_send_room_cmd_only(gc, QQ_ROOM_CMD_GET_INFO, uid);
413
412
                        } else {
414
413
                                rmd->my_role = QQ_ROOM_ROLE_YES;
419
418
 
420
419
        if(bytes > data_len) {
421
420
                purple_debug_error("QQ",
422
 
                                "qq_process_get_buddies_and_rooms: Dangerous error! maybe protocol changed, notify developers!");
 
421
                                "qq_process_get_buddies_and_rooms: Dangerous error! maybe protocol changed, notify developers!\n");
423
422
        }
424
423
 
425
424
        purple_debug_info("QQ", "Received %d buddies and %d groups, nextposition=%u\n", i, j, (guint) position);
570
569
                /* create no-auth buddy */
571
570
                buddy = qq_buddy_new(gc, bs.uid);
572
571
        }
573
 
        bd = (buddy == NULL) ? NULL : (qq_buddy_data *) buddy->proto_data;
 
572
        bd = (buddy == NULL) ? NULL : (qq_buddy_data *)purple_buddy_get_protocol_data(buddy);
574
573
        if (bd == NULL) {
575
574
                purple_debug_warning("QQ", "Got status of no-auth buddy %u\n", bs.uid);
576
575
                return;
662
661
        for (it = buddies; it; it = it->next) {
663
662
                buddy = it->data;
664
663
                if (buddy == NULL) continue;
665
 
                if (buddy->proto_data == NULL) continue;
666
 
 
667
 
                bd = (qq_buddy_data *)buddy->proto_data;
 
664
 
 
665
                bd = purple_buddy_get_protocol_data(buddy);
 
666
                if (bd == NULL) continue;
 
667
 
668
668
                if (bd->uid == 0) continue;
669
669
                if (bd->uid == qd->uid) continue;       /* my status is always online in my buddy list */
670
670
                if (tm_limit < bd->last_update) continue;
684
684
        GSList *buddies, *it;
685
685
        gint count = 0;
686
686
 
687
 
        qd = (qq_data *) (gc->proto_data);
 
687
        qd = (qq_data *)purple_connection_get_protocol_data(gc);
688
688
 
689
689
        buddies = purple_find_buddies(purple_connection_get_account(gc), NULL);
690
690
        for (it = buddies; it; it = it->next) {
 
691
                qq_buddy_data *qbd = NULL;
 
692
 
691
693
                buddy = it->data;
692
694
                if (buddy == NULL) continue;
693
 
                if (buddy->proto_data == NULL) continue;
694
 
 
695
 
                qq_buddy_data_free(buddy->proto_data);
696
 
                buddy->proto_data = NULL;
 
695
 
 
696
                qbd = purple_buddy_get_protocol_data(buddy);
 
697
                if (qbd == NULL) continue;
 
698
 
 
699
                qq_buddy_data_free(qbd);
 
700
                purple_buddy_set_protocol_data(buddy, NULL);
697
701
 
698
702
                count++;
699
703
        }