Changeset 5f8ab6a9 for protocols/yahoo


Ignore:
Timestamp:
2010-06-03T10:41:03Z (14 years ago)
Author:
Sven Moritz Hallberg <pesco@…>
Branches:
master
Children:
814aa52
Parents:
3f81999 (diff), f9928cb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge in bitlbee 1.2.5

Location:
protocols/yahoo
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/yahoo/libyahoo2.c

    r3f81999 r5f8ab6a9  
    857857}
    858858
    859 static YList * bud_str2list(char *rawlist)
    860 {
    861         YList * l = NULL;
    862 
    863         char **lines;
    864         char **split;
    865         char **buddies;
    866         char **tmp, **bud;
    867 
    868         lines = y_strsplit(rawlist, "\n", -1);
    869         for (tmp = lines; *tmp; tmp++) {
    870                 struct yahoo_buddy *newbud;
    871 
    872                 split = y_strsplit(*tmp, ":", 2);
    873                 if (!split)
    874                         continue;
    875                 if (!split[0] || !split[1]) {
    876                         y_strfreev(split);
    877                         continue;
    878                 }
    879                 buddies = y_strsplit(split[1], ",", -1);
    880 
    881                 for (bud = buddies; bud && *bud; bud++) {
    882                         newbud = y_new0(struct yahoo_buddy, 1);
    883                         newbud->id = strdup(*bud);
    884                         newbud->group = strdup(split[0]);
    885 
    886                         if(y_list_find_custom(l, newbud, is_same_bud)) {
    887                                 FREE(newbud->id);
    888                                 FREE(newbud->group);
    889                                 FREE(newbud);
    890                                 continue;
    891                         }
    892 
    893                         newbud->real_name = NULL;
    894 
    895                         l = y_list_append(l, newbud);
    896 
    897                         NOTICE(("Added buddy %s to group %s", newbud->id, newbud->group));
    898                 }
    899 
    900                 y_strfreev(buddies);
    901                 y_strfreev(split);
    902         }
    903         y_strfreev(lines);
    904 
    905         return l;
    906 }
    907 
    908859static char * getcookie(char *rawcookie)
    909860{
     
    13621313}
    13631314
    1364 
    1365 static void yahoo_process_status(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
     1315static void yahoo_process_status(struct yahoo_input_data *yid,
     1316        struct yahoo_packet *pkt)
    13661317{
    13671318        YList *l;
    13681319        struct yahoo_data *yd = yid->yd;
    13691320
    1370         struct user
    1371         {
    1372                 char *name;     /* 7    name */
    1373                 int   state;    /* 10   state */
    1374                 int   flags;    /* 13   flags, bit 0 = pager, bit 1 = chat, bit 2 = game */
    1375                 int   mobile;   /* 60   mobile */
    1376                 char *msg;      /* 19   custom status message */
    1377                 int   away;     /* 47   away (or invisible)*/
    1378                 int   buddy_session;    /* 11   state */
    1379                 int   f17;      /* 17   in chat? then what about flags? */
    1380                 int   idle;     /* 137  seconds idle */
    1381                 int   f138;     /* 138  state */
    1382                 char *f184;     /* 184  state */
    1383                 int   f192;     /* 192  state */
    1384                 int   f10001;   /* 10001        state */
    1385                 int   f10002;   /* 10002        state */
    1386                 int   f198;     /* 198  state */
    1387                 char *f197;     /* 197  state */
    1388                 char *f205;     /* 205  state */
    1389                 int   f213;     /* 213  state */
    1390         } *u;
     1321        struct yahoo_process_status_entry *u;
    13911322
    13921323        YList *users = 0;
    1393        
     1324
    13941325        if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) {
    1395                 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_DUPL, NULL);
    1396                 return;
    1397         }
     1326                YAHOO_CALLBACK(ext_yahoo_login_response) (yd->client_id,
     1327                        YAHOO_LOGIN_DUPL, NULL);
     1328                return;
     1329        }
     1330
     1331        /* Status updates may be spread accross multiple packets and not
     1332           even on buddy boundaries, so keeping some state is important.
     1333           So, continue where we left off, and only add a user entry to
     1334           the list once it's complete (301-315 End buddy). */
     1335        u = yd->half_user;
    13981336
    13991337        for (l = pkt->hash; l; l = l->next) {
     
    14011339
    14021340                switch (pair->key) {
    1403                 case 0: /* we won't actually do anything with this */
     1341                case 300:       /* Begin buddy */
     1342                        if (!strcmp(pair->value, "315") && !u) {
     1343                                u = yd->half_user = y_new0(struct yahoo_process_status_entry, 1);
     1344                        }
     1345                        break;
     1346                case 301:       /* End buddy */
     1347                        if (!strcmp(pair->value, "315") && u) {
     1348                                /* Sometimes user info comes in an odd format with no
     1349                                   "begin buddy" but *with* an "end buddy". Don't add
     1350                                   it twice. */
     1351                                if (!y_list_find(users, u))
     1352                                        users = y_list_prepend(users, u);
     1353                                u = yd->half_user = NULL;
     1354                        }
     1355                        break;
     1356                case 0: /* we won't actually do anything with this */
    14041357                        NOTICE(("key %d:%s", pair->key, pair->value));
    14051358                        break;
    1406                 case 1: /* we don't get the full buddy list here. */
     1359                case 1: /* we don't get the full buddy list here. */
    14071360                        if (!yd->logged_in) {
    1408                                 yd->logged_in = TRUE;
    1409                                 if(yd->current_status < 0)
     1361                                yd->logged_in = 1;
     1362                                if (yd->current_status < 0)
    14101363                                        yd->current_status = yd->initial_status;
    1411                                 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_OK, NULL);
     1364                                YAHOO_CALLBACK(ext_yahoo_login_response) (yd->
     1365                                        client_id, YAHOO_LOGIN_OK, NULL);
    14121366                        }
    14131367                        break;
    1414                 case 8: /* how many online buddies we have */
     1368                case 8: /* how many online buddies we have */
    14151369                        NOTICE(("key %d:%s", pair->key, pair->value));
    14161370                        break;
    1417                 case 7: /* the current buddy */
    1418                         u = y_new0(struct user, 1);
     1371                case 7: /* the current buddy */
     1372                        if (!u) {
     1373                                /* This will only happen in case of a single level message */
     1374                                u = y_new0(struct yahoo_process_status_entry, 1);
     1375                                users = y_list_prepend(users, u);
     1376                        }
    14191377                        u->name = pair->value;
    1420                         users = y_list_prepend(users, u);
    1421                         break;
    1422                 case 10: /* state */
    1423                         ((struct user*)users->data)->state = strtol(pair->value, NULL, 10);
    1424                         break;
    1425                 case 19: /* custom status message */
    1426                         ((struct user*)users->data)->msg = pair->value;
    1427                         break;
    1428                 case 47: /* is it an away message or not */
    1429                         ((struct user*)users->data)->away = atoi(pair->value);
    1430                         break;
    1431                 case 137: /* seconds idle */
    1432                         ((struct user*)users->data)->idle = atoi(pair->value);
    1433                         break;
    1434                 case 11: /* this is the buddy's session id */
    1435                         ((struct user*)users->data)->buddy_session = atoi(pair->value);
    1436                         break;
    1437                 case 17: /* in chat? */
    1438                         ((struct user*)users->data)->f17 = atoi(pair->value);
    1439                         break;
    1440                 case 13: /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */
    1441                         ((struct user*)users->data)->flags = atoi(pair->value);
    1442                         break;
    1443                 case 60: /* SMS -> 1 MOBILE USER */
     1378                        break;
     1379                case 10:        /* state */
     1380                        u->state = strtol(pair->value, NULL, 10);
     1381                        break;
     1382                case 19:        /* custom status message */
     1383                        u->msg = pair->value;
     1384                        break;
     1385                case 47:        /* is it an away message or not. Not applicable for YMSG16 anymore */
     1386                        u->away = atoi(pair->value);
     1387                        break;
     1388                case 137:       /* seconds idle */
     1389                        u->idle = atoi(pair->value);
     1390                        break;
     1391                case 11:        /* this is the buddy's session id */
     1392                        u->buddy_session = atoi(pair->value);
     1393                        break;
     1394                case 17:        /* in chat? */
     1395                        u->f17 = atoi(pair->value);
     1396                        break;
     1397                case 13:        /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */
     1398                        u->flags = atoi(pair->value);
     1399                        break;
     1400                case 60:        /* SMS -> 1 MOBILE USER */
    14441401                        /* sometimes going offline makes this 2, but invisible never sends it */
    1445                         ((struct user*)users->data)->mobile = atoi(pair->value);
     1402                        u->mobile = atoi(pair->value);
    14461403                        break;
    14471404                case 138:
    1448                         ((struct user*)users->data)->f138 = atoi(pair->value);
     1405                        u->f138 = atoi(pair->value);
    14491406                        break;
    14501407                case 184:
    1451                         ((struct user*)users->data)->f184 = pair->value;
     1408                        u->f184 = pair->value;
    14521409                        break;
    14531410                case 192:
    1454                         ((struct user*)users->data)->f192 = atoi(pair->value);
     1411                        u->f192 = atoi(pair->value);
    14551412                        break;
    14561413                case 10001:
    1457                         ((struct user*)users->data)->f10001 = atoi(pair->value);
     1414                        u->f10001 = atoi(pair->value);
    14581415                        break;
    14591416                case 10002:
    1460                         ((struct user*)users->data)->f10002 = atoi(pair->value);
     1417                        u->f10002 = atoi(pair->value);
    14611418                        break;
    14621419                case 198:
    1463                         ((struct user*)users->data)->f198 = atoi(pair->value);
     1420                        u->f198 = atoi(pair->value);
    14641421                        break;
    14651422                case 197:
    1466                         ((struct user*)users->data)->f197 = pair->value;
     1423                        u->f197 = pair->value;
    14671424                        break;
    14681425                case 205:
    1469                         ((struct user*)users->data)->f205 = pair->value;
     1426                        u->f205 = pair->value;
    14701427                        break;
    14711428                case 213:
    1472                         ((struct user*)users->data)->f213 = atoi(pair->value);
    1473                         break;
    1474                 case 16: /* Custom error message */
    1475                         YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, pair->value, 0, E_CUSTOM);
     1429                        u->f213 = atoi(pair->value);
     1430                        break;
     1431                case 16:        /* Custom error message */
     1432                        YAHOO_CALLBACK(ext_yahoo_error) (yd->client_id,
     1433                                pair->value, 0, E_CUSTOM);
    14761434                        break;
    14771435                default:
    1478                         WARNING(("unknown status key %d:%s", pair->key, pair->value));
    1479                         break;
    1480                 }
    1481         }
    1482        
     1436                        WARNING(("unknown status key %d:%s", pair->key,
     1437                                        pair->value));
     1438                        break;
     1439                }
     1440        }
     1441
    14831442        while (users) {
    14841443                YList *t = users;
    1485                 struct user *u = users->data;
     1444                struct yahoo_process_status_entry *u = users->data;
    14861445
    14871446                if (u->name != NULL) {
    1488                         if (pkt->service == YAHOO_SERVICE_LOGOFF) { /* || u->flags == 0) { Not in YMSG16 */
    1489                                 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, YAHOO_STATUS_OFFLINE, NULL, 1, 0, 0);
     1447                        if (pkt->service ==
     1448                                YAHOO_SERVICE_LOGOFF
     1449                                /*|| u->flags == 0 No flags for YMSG16 */ ) {
     1450                                YAHOO_CALLBACK(ext_yahoo_status_changed) (yd->
     1451                                        client_id, u->name,
     1452                                        YAHOO_STATUS_OFFLINE, NULL, 1, 0, 0);
    14901453                        } else {
    14911454                                /* Key 47 always seems to be 1 for YMSG16 */
    1492                                 if(!u->state)
     1455                                if (!u->state)
    14931456                                        u->away = 0;
    14941457                                else
    14951458                                        u->away = 1;
    14961459
    1497                                 YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, u->name, u->state, u->msg, u->away, u->idle, u->mobile);
     1460                                YAHOO_CALLBACK(ext_yahoo_status_changed) (yd->
     1461                                        client_id, u->name, u->state, u->msg,
     1462                                        u->away, u->idle, u->mobile);
    14981463                        }
    14991464                }
     
    15051470}
    15061471
    1507 static void yahoo_process_buddy_list(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
     1472static void yahoo_process_buddy_list(struct yahoo_input_data *yid,
     1473        struct yahoo_packet *pkt)
    15081474{
    15091475        struct yahoo_data *yd = yid->yd;
     
    15171483                struct yahoo_pair *pair = l->data;
    15181484
    1519                 switch(pair->key) {
     1485                switch (pair->key) {
    15201486                case 300:
    15211487                case 301:
    15221488                case 302:
     1489                        break;  /* Separators. Our logic does not need them */
    15231490                case 303:
    1524                         if ( 315 == atoi(pair->value) )
     1491                        if (318 == atoi(pair->value))
    15251492                                last_packet = 1;
    15261493                        break;
    15271494                case 65:
    1528                         g_free(cur_group);
    15291495                        cur_group = strdup(pair->value);
    15301496                        break;
     
    15321498                        newbud = y_new0(struct yahoo_buddy, 1);
    15331499                        newbud->id = strdup(pair->value);
    1534                         if(cur_group)
     1500                        if (cur_group)
    15351501                                newbud->group = strdup(cur_group);
    1536                         else {
    1537                                 struct yahoo_buddy *lastbud = (struct yahoo_buddy *)y_list_nth(
    1538                                                                 yd->buddies, y_list_length(yd->buddies)-1)->data;
     1502                        else if (yd->buddies) {
     1503                                struct yahoo_buddy *lastbud =
     1504                                        (struct yahoo_buddy *)y_list_nth(yd->
     1505                                        buddies,
     1506                                        y_list_length(yd->buddies) - 1)->data;
    15391507                                newbud->group = strdup(lastbud->group);
    1540                         }
     1508                        } else
     1509                                newbud->group = strdup("Buddies");
    15411510
    15421511                        yd->buddies = y_list_append(yd->buddies, newbud);
     
    15451514                }
    15461515        }
    1547        
    1548         g_free(cur_group);
    15491516
    15501517        /* we could be getting multiple packets here */
    1551         if (last_packet)
    1552                 return;
    1553 
    1554         YAHOO_CALLBACK(ext_yahoo_got_buddies)(yd->client_id, yd->buddies);
    1555 
    1556         /*** We login at the very end of the packet communication */
     1518        if (pkt->hash && !last_packet)
     1519                return;
     1520
     1521        YAHOO_CALLBACK(ext_yahoo_got_buddies) (yd->client_id, yd->buddies);
     1522
     1523        /* Logged in */
    15571524        if (!yd->logged_in) {
    1558                 yd->logged_in = TRUE;
    1559                 if(yd->current_status < 0)
     1525                yd->logged_in = 1;
     1526                if (yd->current_status < 0)
    15601527                        yd->current_status = yd->initial_status;
    1561                 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_OK, NULL);
    1562         }
    1563 }
    1564 
    1565 static void yahoo_process_list(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
     1528                YAHOO_CALLBACK(ext_yahoo_login_response) (yd->client_id,
     1529                        YAHOO_LOGIN_OK, NULL);
     1530
     1531                /*
     1532                yahoo_set_away(yd->client_id, yd->initial_status, NULL,
     1533                        (yd->initial_status == YAHOO_STATUS_AVAILABLE) ? 0 : 1);
     1534
     1535                yahoo_get_yab(yd->client_id);
     1536                */
     1537        }
     1538
     1539}
     1540
     1541static void yahoo_process_list(struct yahoo_input_data *yid,
     1542        struct yahoo_packet *pkt)
    15661543{
    15671544        struct yahoo_data *yd = yid->yd;
    15681545        YList *l;
    15691546
    1570         if (!yd->logged_in) {
    1571                 yd->logged_in = TRUE;
    1572                 if(yd->current_status < 0)
    1573                         yd->current_status = yd->initial_status;
    1574                 YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_OK, NULL);
    1575         }
    1576 
     1547        /* we could be getting multiple packets here */
    15771548        for (l = pkt->hash; l; l = l->next) {
    15781549                struct yahoo_pair *pair = l->data;
    15791550
    1580                 switch(pair->key) {
    1581                 case 87: /* buddies */
    1582                         if(!yd->rawbuddylist)
    1583                                 yd->rawbuddylist = strdup(pair->value);
    1584                         else {
    1585                                 yd->rawbuddylist = y_string_append(yd->rawbuddylist, pair->value);
     1551                switch (pair->key) {
     1552                case 89:        /* identities */
     1553                        {
     1554                                char **identities =
     1555                                        y_strsplit(pair->value, ",", -1);
     1556                                int i;
     1557                                for (i = 0; identities[i]; i++)
     1558                                        yd->identities =
     1559                                                y_list_append(yd->identities,
     1560                                                strdup(identities[i]));
     1561                                y_strfreev(identities);
    15861562                        }
    1587                         break;
    1588 
    1589                 case 88: /* ignore list */
    1590                         if(!yd->ignorelist)
    1591                                 yd->ignorelist = strdup("Ignore:");
    1592                         yd->ignorelist = y_string_append(yd->ignorelist, pair->value);
    1593                         break;
    1594 
    1595                 case 89: /* identities */
    1596                         {
    1597                         char **identities = y_strsplit(pair->value, ",", -1);
    1598                         int i;
    1599                         for(i=0; identities[i]; i++)
    1600                                 yd->identities = y_list_append(yd->identities,
    1601                                                 strdup(identities[i]));
    1602                         y_strfreev(identities);
    1603                         }
    1604                         YAHOO_CALLBACK(ext_yahoo_got_identities)(yd->client_id, yd->identities);
    1605                         break;
    1606                 case 59: /* cookies */
    1607                         if(yd->ignorelist) {
    1608                                 yd->ignore = bud_str2list(yd->ignorelist);
    1609                                 FREE(yd->ignorelist);
    1610                                 YAHOO_CALLBACK(ext_yahoo_got_ignore)(yd->client_id, yd->ignore);
    1611                         }
    1612                         if(yd->rawbuddylist) {
    1613                                 yd->buddies = bud_str2list(yd->rawbuddylist);
    1614                                 FREE(yd->rawbuddylist);
    1615                                 YAHOO_CALLBACK(ext_yahoo_got_buddies)(yd->client_id, yd->buddies);
    1616                         }
    1617 
    1618                         if(pair->value[0]=='Y') {
     1563                        YAHOO_CALLBACK(ext_yahoo_got_identities) (yd->client_id,
     1564                                yd->identities);
     1565                        break;
     1566                case 59:        /* cookies */
     1567                        if (pair->value[0] == 'Y') {
    16191568                                FREE(yd->cookie_y);
    16201569                                FREE(yd->login_cookie);
     
    16231572                                yd->login_cookie = getlcookie(yd->cookie_y);
    16241573
    1625                         } else if(pair->value[0]=='T') {
     1574                        } else if (pair->value[0] == 'T') {
    16261575                                FREE(yd->cookie_t);
    16271576                                yd->cookie_t = getcookie(pair->value);
    16281577
    1629                         } else if(pair->value[0]=='C') {
     1578                        } else if (pair->value[0] == 'C') {
    16301579                                FREE(yd->cookie_c);
    16311580                                yd->cookie_c = getcookie(pair->value);
    1632                         } 
    1633 
    1634                         if(yd->cookie_y && yd->cookie_t)
    1635                                 YAHOO_CALLBACK(ext_yahoo_got_cookies)(yd->client_id);
    1636 
    1637                         break;
    1638                 case 3: /* my id */
    1639                 case 90: /* 1 */
    1640                 case 100: /* 0 */
    1641                 case 101: /* NULL */
    1642                 case 102: /* NULL */
    1643                 case 93: /* 86400/1440 */
    1644                         break;
    1645                 }
    1646         }
     1581                        }
     1582
     1583                        break;
     1584                case 3: /* my id */
     1585                case 90:        /* 1 */
     1586                case 100:       /* 0 */
     1587                case 101:       /* NULL */
     1588                case 102:       /* NULL */
     1589                case 93:        /* 86400/1440 */
     1590                        break;
     1591                }
     1592        }
     1593
     1594        if (yd->cookie_y && yd->cookie_t)       /* We don't get cookie_c anymore */
     1595                YAHOO_CALLBACK(ext_yahoo_got_cookies) (yd->client_id);
    16471596}
    16481597
     
    23952344{
    23962345        struct yahoo_https_auth_data *had = req->data;
    2397         struct yahoo_input_data *yid = had->yid;
    2398         struct yahoo_data *yd = yid->yd;
     2346        struct yahoo_input_data *yid;
     2347        struct yahoo_data *yd;
    23992348        int st;
     2349       
     2350        if (y_list_find(inputs, had->yid) == NULL)
     2351                return;
     2352       
     2353        yid = had->yid;
     2354        yd = yid->yd;
    24002355       
    24012356        if (req->status_code != 200) {
     
    24382393{
    24392394        struct yahoo_https_auth_data *had = req->data;
    2440         struct yahoo_input_data *yid = had->yid;
    2441         struct yahoo_data *yd = yid->yd;
     2395        struct yahoo_input_data *yid;
     2396        struct yahoo_data *yd;
    24422397        struct yahoo_packet *pack;
    2443         char *crumb;
     2398        char *crumb = NULL;
    24442399        int st;
     2400       
     2401        if (y_list_find(inputs, had->yid) == NULL)
     2402                return;
     2403       
     2404        yid = had->yid;
     2405        yd = yid->yd;
    24452406       
    24462407        md5_byte_t result[16];
     
    40824043
    40834044        yd = yid->yd;
    4084 
    40854045        old_status = yd->current_status;
    4086 
    4087         if (msg && strncmp(msg,"Invisible",9)) {
    4088                 yd->current_status = YAHOO_STATUS_CUSTOM;
    4089         } else {
    4090                 yd->current_status = state;
    4091         }
     4046        yd->current_status = state;
    40924047
    40934048        /* Thank you libpurple :) */
     
    41044059        snprintf(s, sizeof(s), "%d", yd->current_status);
    41054060        yahoo_packet_hash(pkt, 10, s);
    4106          
    4107         if (yd->current_status == YAHOO_STATUS_CUSTOM) {
    4108                 yahoo_packet_hash(pkt, 19, msg);
    4109         } else {
    4110                 yahoo_packet_hash(pkt, 19, "");
    4111         }
    4112        
     4061        yahoo_packet_hash(pkt, 19, msg && state == YAHOO_STATUS_CUSTOM ? msg : "");
    41134062        yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0");
    4114 
    41154063        yahoo_send_packet(yid, pkt, 0);
    41164064        yahoo_packet_free(pkt);
  • protocols/yahoo/yahoo.c

    r3f81999 r5f8ab6a9  
    130130{
    131131        set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc );
     132       
     133        acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE;
    132134}
    133135
     
    197199{
    198200        struct byahoo_data *yd = (struct byahoo_data *) ic->proto_data;
    199         char *away;
    200        
    201         away = NULL;
    202        
    203         if( state && msg && g_strcasecmp( state, msg ) != 0 )
    204         {
    205                 yd->current_status = YAHOO_STATUS_CUSTOM;
    206                 away = "";
    207         }
    208         else if( state )
    209         {
    210                 /* Set msg to NULL since (if it isn't NULL already) it's equal
    211                    to state. msg must be empty if we want to use an existing
    212                    away state. */
    213                 msg = NULL;
    214                
    215                 away = "";
    216                 if( g_strcasecmp( state, "Available" ) == 0 )
    217                 {
    218                         yd->current_status = YAHOO_STATUS_AVAILABLE;
    219                         away = NULL;
    220                 }
    221                 else if( g_strcasecmp( state, "Be Right Back" ) == 0 )
     201       
     202        if( state && msg == NULL )
     203        {
     204                /* Use these states only if msg doesn't contain additional
     205                   info since away messages are only supported with CUSTOM. */
     206                if( g_strcasecmp( state, "Be Right Back" ) == 0 )
    222207                        yd->current_status = YAHOO_STATUS_BRB;
    223208                else if( g_strcasecmp( state, "Busy" ) == 0 )
     
    239224                else if( g_strcasecmp( state, "Invisible" ) == 0 )
    240225                        yd->current_status = YAHOO_STATUS_INVISIBLE;
    241                 else if( g_strcasecmp( state, GAIM_AWAY_CUSTOM ) == 0 )
    242                 {
    243                         yd->current_status = YAHOO_STATUS_AVAILABLE;
    244                        
    245                         away = NULL;
    246                 }
    247         }
     226                else
     227                        yd->current_status = YAHOO_STATUS_CUSTOM;
     228        }
     229        else if( msg )
     230                yd->current_status = YAHOO_STATUS_CUSTOM;
    248231        else
    249232                yd->current_status = YAHOO_STATUS_AVAILABLE;
    250233       
    251         yahoo_set_away( yd->y2_id, yd->current_status, msg, away != NULL ? 2 : 0 );
     234        yahoo_set_away( yd->y2_id, yd->current_status, msg, state ? 2 : 0 );
    252235}
    253236
     
    258241        if( m == NULL )
    259242        {
    260                 m = g_list_append( m, "Available" );
    261243                m = g_list_append( m, "Be Right Back" );
    262244                m = g_list_append( m, "Busy" );
     
    269251                m = g_list_append( m, "Stepped Out" );
    270252                m = g_list_append( m, "Invisible" );
    271                 m = g_list_append( m, GAIM_AWAY_CUSTOM );
    272253        }
    273254       
  • protocols/yahoo/yahoo2_types.h

    r3f81999 r5f8ab6a9  
    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.