Mercurial > pidgin
comparison src/protocols/yahoo/yahoo.c @ 13558:a0969be53e17
[gaim-migrate @ 15937]
Patch 1452620 from sadrul to improve Yahoo idle handling:
"If you are away with no status-message, and you want to
set the account as idle, then the account becomes
`online'. When you come back from idle, and you have
`away' selected in the statusbox, then the account
becomes online."
committer: Tailor Script <tailor@pidgin.im>
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Fri, 24 Mar 2006 02:48:28 +0000 |
parents | b6a63c9b0cb4 |
children | 2d31d61f572c |
comparison
equal
deleted
inserted
replaced
13557:73f8fa605e5a | 13558:a0969be53e17 |
---|---|
3233 static void yahoo_set_idle(GaimConnection *gc, int idle) | 3233 static void yahoo_set_idle(GaimConnection *gc, int idle) |
3234 { | 3234 { |
3235 struct yahoo_data *yd = gc->proto_data; | 3235 struct yahoo_data *yd = gc->proto_data; |
3236 struct yahoo_packet *pkt = NULL; | 3236 struct yahoo_packet *pkt = NULL; |
3237 char *msg = NULL, *msg2 = NULL; | 3237 char *msg = NULL, *msg2 = NULL; |
3238 | 3238 GaimStatus *status = NULL; |
3239 if (idle && yd->current_status == YAHOO_STATUS_AVAILABLE) | 3239 |
3240 if (idle && yd->current_status != YAHOO_STATUS_IDLE) | |
3240 yd->current_status = YAHOO_STATUS_IDLE; | 3241 yd->current_status = YAHOO_STATUS_IDLE; |
3241 else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) | 3242 else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) { |
3242 yd->current_status = YAHOO_STATUS_AVAILABLE; | 3243 status = gaim_presence_get_active_status(gaim_account_get_presence(gaim_connection_get_account(gc))); |
3244 yd->current_status = get_yahoo_status_from_gaim_status(status); | |
3245 } | |
3243 | 3246 |
3244 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0); | 3247 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0); |
3245 | 3248 |
3246 yahoo_packet_hash_int(pkt, 10, yd->current_status); | 3249 yahoo_packet_hash_int(pkt, 10, yd->current_status); |
3247 if (yd->current_status == YAHOO_STATUS_CUSTOM) { | 3250 if (yd->current_status == YAHOO_STATUS_CUSTOM) { |
3248 const char *tmp; | 3251 const char *tmp; |
3249 GaimStatus *status = gaim_presence_get_active_status(gaim_account_get_presence(gaim_connection_get_account(gc))); | 3252 if (status == NULL) |
3253 status = gaim_presence_get_active_status(gaim_account_get_presence(gaim_connection_get_account(gc))); | |
3250 tmp = gaim_status_get_attr_string(status, "message"); | 3254 tmp = gaim_status_get_attr_string(status, "message"); |
3251 if (tmp != NULL) { | 3255 if (tmp != NULL) { |
3252 msg = yahoo_string_encode(gc, tmp, NULL); | 3256 msg = yahoo_string_encode(gc, tmp, NULL); |
3253 msg2 = gaim_markup_strip_html(msg); | 3257 msg2 = gaim_markup_strip_html(msg); |
3254 yahoo_packet_hash_str(pkt, 19, msg2); | 3258 yahoo_packet_hash_str(pkt, 19, msg2); |
3255 } else { | 3259 } else { |
3256 yahoo_packet_hash_str(pkt, 19, ""); | 3260 /* get_yahoo_status_from_gaim_status() returns YAHOO_STATUS_CUSTOM for |
3261 * the generic away state (YAHOO_STATUS_TYPE_AWAY) with no message */ | |
3262 yahoo_packet_hash_str(pkt, 19, _("Away")); | |
3257 } | 3263 } |
3258 } else { | 3264 } else { |
3259 yahoo_packet_hash_str(pkt, 19, ""); | 3265 yahoo_packet_hash_str(pkt, 19, ""); |
3260 } | 3266 } |
3261 | 3267 |