Changeset 7ea8697


Ignore:
Timestamp:
2009-10-10T15:00:16Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
e71cfbc
Parents:
037b66a
Message:

Setting Yahoo! away states works again.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/yahoo/libyahoo2.c

    r037b66a r7ea8697  
    40804080        struct yahoo_data *yd;
    40814081        struct yahoo_packet *pkt = NULL;
    4082         int service;
     4082        int old_status;
    40834083        char s[4];
    40844084
     
    40884088        yd = yid->yd;
    40894089
    4090         if (msg) {
     4090        old_status = yd->current_status;
     4091
     4092        if (msg && strncmp(msg,"Invisible",9)) {
    40914093                yd->current_status = YAHOO_STATUS_CUSTOM;
    40924094        } else {
     
    40944096        }
    40954097
    4096         if (yd->current_status == YAHOO_STATUS_AVAILABLE)
    4097                 service = YAHOO_SERVICE_ISBACK;
    4098         else
    4099                 service = YAHOO_SERVICE_ISAWAY;
     4098        /* Thank you libpurple :) */
     4099        if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
     4100                pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBILITY, YAHOO_STATUS_AVAILABLE, 0);
     4101                yahoo_packet_hash(pkt, 13, "2");
     4102                yahoo_send_packet(yid, pkt, 0);
     4103                yahoo_packet_free(pkt);
     4104
     4105                return;
     4106        }
     4107
     4108        pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, yd->current_status, yd->session_id);
     4109        snprintf(s, sizeof(s), "%d", yd->current_status);
     4110        yahoo_packet_hash(pkt, 10, s);
    41004111         
    4101         if ((away == 2) && (yd->current_status == YAHOO_STATUS_AVAILABLE)) {
    4102                 pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_BRB, yd->session_id);
    4103                 yahoo_packet_hash(pkt, 10, "999");
    4104                 yahoo_packet_hash(pkt, 47, "2");
    4105         }else {
    4106                 pkt = yahoo_packet_new(service, YAHOO_STATUS_AVAILABLE, yd->session_id);
    4107                 snprintf(s, sizeof(s), "%d", yd->current_status);
    4108                 yahoo_packet_hash(pkt, 10, s);
    4109                 if (yd->current_status == YAHOO_STATUS_CUSTOM) {
    4110                         yahoo_packet_hash(pkt, 19, msg);
    4111                         yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0");
    4112                 } else {
    4113                         yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0");
    4114                 }
    4115                
    4116                
    4117                
    4118         }
     4112        if (yd->current_status == YAHOO_STATUS_CUSTOM) {
     4113                yahoo_packet_hash(pkt, 19, msg);
     4114        } else {
     4115                yahoo_packet_hash(pkt, 19, "");
     4116        }
     4117       
     4118        yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0");
    41194119
    41204120        yahoo_send_packet(yid, pkt, 0);
    41214121        yahoo_packet_free(pkt);
     4122
     4123        if(old_status == YAHOO_STATUS_INVISIBLE) {
     4124                pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBILITY, YAHOO_STATUS_AVAILABLE, 0);
     4125                yahoo_packet_hash(pkt, 13, "1");
     4126                yahoo_send_packet(yid, pkt, 0);
     4127                yahoo_packet_free(pkt);
     4128        }
    41224129}
    41234130
Note: See TracChangeset for help on using the changeset viewer.