# HG changeset patch # User Luke Schierer # Date 1063632562 0 # Node ID 7de1b559cbbb43148f34c5630e2fbc0a18a1f812 # Parent 8ab95f4c9800baecae6de30503132d9704fa6b08 [gaim-migrate @ 7392] Tim Ringenbach (marv_sf) writes: " This fixes a bug where SMS users who aren't anymore would still be. It also truncates status message for the yahoo server, because for some reason if it has to do it itself, it clears the away flag. Finally, it tries to do (our) statuses and idleness better. I think we're now sending the right thing in the regard now (as opposed to before, when we didn't bother letting the server know we were idle if we were also in a predefined status). For some reason we still don't show as idle on our own list while in those states, but i think that's a seperate bug in process status that i need to look into." committer: Tailor Script diff -r 8ab95f4c9800 -r 7de1b559cbbb src/protocols/yahoo/yahoo.c --- a/src/protocols/yahoo/yahoo.c Mon Sep 15 07:35:49 2003 +0000 +++ b/src/protocols/yahoo/yahoo.c Mon Sep 15 13:29:22 2003 +0000 @@ -371,8 +371,8 @@ g_free(f->msg); f->msg = NULL; } - if (f->status == YAHOO_STATUS_AVAILABLE) - f->idle = 0; + + f->sms = 0; break; case 19: /* custom message */ if (f) { @@ -1697,13 +1697,11 @@ if (msg) { yd->current_status = YAHOO_STATUS_CUSTOM; - gc->away = g_strdup(msg); + gc->away = g_strndup(msg, YAHOO_MAX_STATUS_MESSAGE_LENGTH); } else if (state) { gc->away = g_strdup(""); if (!strcmp(state, _("Available"))) { yd->current_status = YAHOO_STATUS_AVAILABLE; - g_free(gc->away); - gc->away = NULL; } else if (!strcmp(state, _("Be Right Back"))) { yd->current_status = YAHOO_STATUS_BRB; } else if (!strcmp(state, _("Busy"))) { @@ -1724,14 +1722,12 @@ yd->current_status = YAHOO_STATUS_STEPPEDOUT; } else if (!strcmp(state, _("Invisible"))) { yd->current_status = YAHOO_STATUS_INVISIBLE; - } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { + } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { /* this should never happen? */ if (gc->is_idle) { yd->current_status = YAHOO_STATUS_IDLE; } else { yd->current_status = YAHOO_STATUS_AVAILABLE; } - g_free(gc->away); - gc->away = NULL; } } else if (gc->is_idle) { yd->current_status = YAHOO_STATUS_IDLE; @@ -1743,11 +1739,16 @@ service = YAHOO_SERVICE_ISBACK; else service = YAHOO_SERVICE_ISAWAY; - pkt = yahoo_packet_new(service, yd->current_status, 0); + + pkt = yahoo_packet_new(service, YAHOO_STATUS_AVAILABLE, 0); g_snprintf(s, sizeof(s), "%d", yd->current_status); yahoo_packet_hash(pkt, 10, s); - if (yd->current_status == YAHOO_STATUS_CUSTOM) { - yahoo_packet_hash(pkt, 19, msg); + + if ((yd->current_status == YAHOO_STATUS_CUSTOM) && gc->away) + yahoo_packet_hash(pkt, 19, gc->away); + + if ((yd->current_status != YAHOO_STATUS_AVAILABLE) && + (yd->current_status != YAHOO_STATUS_IDLE)) { if (gc->is_idle) yahoo_packet_hash(pkt, 47, "2"); else @@ -1764,14 +1765,12 @@ struct yahoo_packet *pkt = NULL; if (idle && yd->current_status == YAHOO_STATUS_AVAILABLE) { - pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_IDLE, 0); + pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_AVAILABLE, 0); yd->current_status = YAHOO_STATUS_IDLE; } else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) { pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_AVAILABLE, 0); yd->current_status = YAHOO_STATUS_AVAILABLE; - } else if (idle && gc->away && yd->current_status == YAHOO_STATUS_CUSTOM) { - pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_IDLE, 0); - } else if (!idle && gc->away && yd->current_status == YAHOO_STATUS_CUSTOM) { + } else { pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_AVAILABLE, 0); } @@ -1785,7 +1784,14 @@ yahoo_packet_hash(pkt, 47, "2"); else yahoo_packet_hash(pkt, 47, "1"); /* fixme when available messages are possible */ + } else if (idle && (yd->current_status != YAHOO_STATUS_AVAILABLE) && + (yd->current_status != YAHOO_STATUS_IDLE)) { + yahoo_packet_hash(pkt, 47, "2"); + } else if (!idle && (yd->current_status != YAHOO_STATUS_AVAILABLE) && + (yd->current_status != YAHOO_STATUS_IDLE)) { + yahoo_packet_hash(pkt, 47, "1"); } + yahoo_send_packet(yd, pkt); yahoo_packet_free(pkt); } diff -r 8ab95f4c9800 -r 7de1b559cbbb src/protocols/yahoo/yahoo.h --- a/src/protocols/yahoo/yahoo.h Mon Sep 15 07:35:49 2003 +0000 +++ b/src/protocols/yahoo/yahoo.h Mon Sep 15 13:29:22 2003 +0000 @@ -74,6 +74,7 @@ YAHOO_SERVICE_IGNORECONTACT, /* > 1, 7, 13 < 1, 66, 13, 0*/ YAHOO_SERVICE_REJECTCONTACT, YAHOO_SERVICE_GROUPRENAME = 0x89, /* > 1, 65(new), 66(0), 67(old) */ + /* YAHOO_SERVICE_??? = 0x8A, */ YAHOO_SERVICE_CHATONLINE = 0x96, /* > 109(id), 1, 6(abcde) < 0,1*/ YAHOO_SERVICE_CHATGOTO, YAHOO_SERVICE_CHATJOIN, /* > 1 104-room 129-1600326591 62-2 */ @@ -139,6 +140,8 @@ gboolean sms; }; +#define YAHOO_MAX_STATUS_MESSAGE_LENGTH (56) + struct yahoo_packet *yahoo_packet_new(enum yahoo_service service, enum yahoo_status status, int id); void yahoo_packet_hash(struct yahoo_packet *pkt, int key, const char *value); int yahoo_send_packet(struct yahoo_data *yd, struct yahoo_packet *pkt);