| 300 } |
300 } |
| 301 |
301 |
| 302 static void yahoo_set_away(struct gaim_connection *gc, char *state, char *msg) { |
302 static void yahoo_set_away(struct gaim_connection *gc, char *state, char *msg) { |
| 303 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
303 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
| 304 |
304 |
| |
305 if (gc->away) |
| |
306 g_free(gc->away); |
| |
307 gc->away = NULL; |
| |
308 |
| 305 if (msg) { |
309 if (msg) { |
| 306 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_CUSTOM, msg); |
310 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_CUSTOM, msg); |
| 307 yd->current_status = YAHOO_STATUS_CUSTOM; |
311 yd->current_status = YAHOO_STATUS_CUSTOM; |
| |
312 gc->away = g_strdup(msg); |
| 308 } else if (state) { |
313 } else if (state) { |
| 309 if (!strcmp(state, "Available")) { |
314 if (!strcmp(state, "Available")) { |
| 310 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_AVAILABLE, msg); |
315 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_AVAILABLE, msg); |
| 311 yd->current_status = YAHOO_STATUS_AVAILABLE; |
316 yd->current_status = YAHOO_STATUS_AVAILABLE; |
| 312 } else if (!strcmp(state, "Be Right Back")) { |
317 } else if (!strcmp(state, "Be Right Back")) { |
| 313 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_BRB, msg); |
318 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_BRB, msg); |
| 314 yd->current_status = YAHOO_STATUS_BRB; |
319 yd->current_status = YAHOO_STATUS_BRB; |
| |
320 gc->away = g_strdup(yahoo_get_status_string(YAHOO_STATUS_BRB)); |
| 315 } else if (!strcmp(state, "Busy")) { |
321 } else if (!strcmp(state, "Busy")) { |
| 316 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_BUSY, msg); |
322 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_BUSY, msg); |
| 317 yd->current_status = YAHOO_STATUS_BUSY; |
323 yd->current_status = YAHOO_STATUS_BUSY; |
| |
324 gc->away = g_strdup(yahoo_get_status_string(YAHOO_STATUS_BUSY)); |
| 318 } else if (!strcmp(state, "Not At Home")) { |
325 } else if (!strcmp(state, "Not At Home")) { |
| 319 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_NOTATHOME, msg); |
326 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_NOTATHOME, msg); |
| 320 yd->current_status = YAHOO_STATUS_NOTATHOME; |
327 yd->current_status = YAHOO_STATUS_NOTATHOME; |
| |
328 gc->away = g_strdup(yahoo_get_status_string(YAHOO_STATUS_NOTATHOME)); |
| 321 } else if (!strcmp(state, "Not At Desk")) { |
329 } else if (!strcmp(state, "Not At Desk")) { |
| 322 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_NOTATDESK, msg); |
330 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_NOTATDESK, msg); |
| 323 yd->current_status = YAHOO_STATUS_NOTATDESK; |
331 yd->current_status = YAHOO_STATUS_NOTATDESK; |
| |
332 gc->away = g_strdup(yahoo_get_status_string(YAHOO_STATUS_NOTATDESK)); |
| 324 } else if (!strcmp(state, "Not In Office")) { |
333 } else if (!strcmp(state, "Not In Office")) { |
| 325 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_NOTINOFFICE, msg); |
334 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_NOTINOFFICE, msg); |
| 326 yd->current_status = YAHOO_STATUS_NOTINOFFICE; |
335 yd->current_status = YAHOO_STATUS_NOTINOFFICE; |
| |
336 gc->away = g_strdup(yahoo_get_status_string(YAHOO_STATUS_NOTINOFFICE)); |
| 327 } else if (!strcmp(state, "On Phone")) { |
337 } else if (!strcmp(state, "On Phone")) { |
| 328 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_ONPHONE, msg); |
338 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_ONPHONE, msg); |
| 329 yd->current_status = YAHOO_STATUS_ONPHONE; |
339 yd->current_status = YAHOO_STATUS_ONPHONE; |
| |
340 gc->away = g_strdup(yahoo_get_status_string(YAHOO_STATUS_ONPHONE)); |
| 330 } else if (!strcmp(state, "On Vacation")) { |
341 } else if (!strcmp(state, "On Vacation")) { |
| 331 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_ONVACATION, msg); |
342 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_ONVACATION, msg); |
| 332 yd->current_status = YAHOO_STATUS_ONVACATION; |
343 yd->current_status = YAHOO_STATUS_ONVACATION; |
| |
344 gc->away = g_strdup(yahoo_get_status_string(YAHOO_STATUS_ONVACATION)); |
| 333 } else if (!strcmp(state, "Out To Lunch")) { |
345 } else if (!strcmp(state, "Out To Lunch")) { |
| 334 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_OUTTOLUNCH, msg); |
346 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_OUTTOLUNCH, msg); |
| 335 yd->current_status = YAHOO_STATUS_OUTTOLUNCH; |
347 yd->current_status = YAHOO_STATUS_OUTTOLUNCH; |
| |
348 gc->away = g_strdup(yahoo_get_status_string(YAHOO_STATUS_OUTTOLUNCH)); |
| 336 } else if (!strcmp(state, "Stepped Out")) { |
349 } else if (!strcmp(state, "Stepped Out")) { |
| 337 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_STEPPEDOUT, msg); |
350 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_STEPPEDOUT, msg); |
| 338 yd->current_status = YAHOO_STATUS_STEPPEDOUT; |
351 yd->current_status = YAHOO_STATUS_STEPPEDOUT; |
| |
352 gc->away = g_strdup(yahoo_get_status_string(YAHOO_STATUS_STEPPEDOUT)); |
| 339 } else if (!strcmp(state, "Invisible")) { |
353 } else if (!strcmp(state, "Invisible")) { |
| 340 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_INVISIBLE, msg); |
354 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_INVISIBLE, msg); |
| 341 yd->current_status = YAHOO_STATUS_INVISIBLE; |
355 yd->current_status = YAHOO_STATUS_INVISIBLE; |
| |
356 gc->away = g_strdup(yahoo_get_status_string(YAHOO_STATUS_INVISIBLE)); |
| 342 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
357 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
| 343 if (gc->is_idle) { |
358 if (gc->is_idle) { |
| 344 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_IDLE, NULL); |
359 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_IDLE, NULL); |
| 345 yd->current_status = YAHOO_STATUS_IDLE; |
360 yd->current_status = YAHOO_STATUS_IDLE; |
| 346 } else { |
361 } else { |