Changeset 7053379 for protocols/yahoo


Ignore:
Timestamp:
2010-03-12T23:02:29Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
1be0d26
Parents:
547c94c
Message:

Yahoo! status updates (at least initial ones, I assume) can be too long to
fit into one packet. Yahoo! servers will split them up, and not necessarily
on buddy boundaries. Trying to handle this a little bit better now. (Sadly
I can't test this myself, I can only see this causing troubles on testing
sometimes.)

Location:
protocols/yahoo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • protocols/yahoo/libyahoo2.c

    r547c94c r7053379  
    13171317        struct yahoo_data *yd = yid->yd;
    13181318
    1319         struct user {
    1320                 char *name;     /* 7      name */
    1321                 int state;      /* 10     state */
    1322                 int flags;      /* 13     flags, bit 0 = pager, bit 1 = chat, bit 2 = game */
    1323                 int mobile;     /* 60     mobile */
    1324                 char *msg;      /* 19     custom status message */
    1325                 int away;       /* 47     away (or invisible) */
    1326                 int buddy_session; /* 11  state */
    1327                 int f17;        /* 17     in chat? then what about flags? */
    1328                 int idle;       /* 137    seconds idle */
    1329                 int f138;       /* 138    state */
    1330                 char *f184;     /* 184    state */
    1331                 int f192;       /* 192    state */
    1332                 int f10001;     /* 10001  state */
    1333                 int f10002;     /* 10002  state */
    1334                 int f198;       /* 198    state */
    1335                 char *f197;     /* 197    state */
    1336                 char *f205;     /* 205    state */
    1337                 int f213;       /* 213    state */
    1338         } *u;
     1319        struct yahoo_process_status_entry *u;
    13391320
    13401321        YList *users = 0;
     
    13461327        }
    13471328
    1348         u = NULL;
     1329        /* Status updates may be spread accross multiple packets and not
     1330           even on buddy boundaries, so keeping some state is important.
     1331           So, continue where we left off, and only add a user entry to
     1332           the list once it's complete (301-315 End buddy). */
     1333        u = yd->half_user;
    13491334
    13501335        for (l = pkt->hash; l; l = l->next) {
     
    13541339                case 300:       /* Begin buddy */
    13551340                        if (!strcmp(pair->value, "315") && !u) {
    1356                                 u = y_new0(struct user, 1);
     1341                                u = yd->half_user = y_new0(struct yahoo_process_status_entry, 1);
    13571342                        }
    13581343                        break;
     
    13601345                        if (!strcmp(pair->value, "315") && u) {
    13611346                                users = y_list_prepend(users, u);
    1362                                 u = NULL;
     1347                                u = yd->half_user = NULL;
    13631348                        }
    13641349                        break;
     
    13811366                        if (!u) {
    13821367                                /* This will only happen in case of a single level message */
    1383                                 u = y_new0(struct user, 1);
     1368                                u = y_new0(struct yahoo_process_status_entry, 1);
    13841369                                users = y_list_prepend(users, u);
    13851370                        }
     
    14511436        while (users) {
    14521437                YList *t = users;
    1453                 struct user *u = users->data;
     1438                struct yahoo_process_status_entry *u = users->data;
    14541439
    14551440                if (u->name != NULL) {
  • protocols/yahoo/yahoo2_types.h

    r547c94c r7053379  
    196196
    197197        void  *server_settings;
     198       
     199        struct yahoo_process_status_entry *half_user;
    198200};
    199201
     
    261263};
    262264
     265struct yahoo_process_status_entry {
     266        char *name;     /* 7      name */
     267        int state;      /* 10     state */
     268        int flags;      /* 13     flags, bit 0 = pager, bit 1 = chat, bit 2 = game */
     269        int mobile;     /* 60     mobile */
     270        char *msg;      /* 19     custom status message */
     271        int away;       /* 47     away (or invisible) */
     272        int buddy_session; /* 11  state */
     273        int f17;        /* 17     in chat? then what about flags? */
     274        int idle;       /* 137    seconds idle */
     275        int f138;       /* 138    state */
     276        char *f184;     /* 184    state */
     277        int f192;       /* 192    state */
     278        int f10001;     /* 10001  state */
     279        int f10002;     /* 10002  state */
     280        int f198;       /* 198    state */
     281        char *f197;     /* 197    state */
     282        char *f205;     /* 205    state */
     283        int f213;       /* 213    state */
     284};
     285
    263286#ifdef __cplusplus
    264287}
Note: See TracChangeset for help on using the changeset viewer.