| 395 } |
395 } |
| 396 |
396 |
| 397 static void icq_set_away(struct gaim_connection *gc, char *state, char *msg) { |
397 static void icq_set_away(struct gaim_connection *gc, char *state, char *msg) { |
| 398 struct icq_data *id = (struct icq_data *)gc->proto_data; |
398 struct icq_data *id = (struct icq_data *)gc->proto_data; |
| 399 |
399 |
| 400 if (gc->away) |
400 if (gc->away) { |
| |
401 g_free(gc->away); |
| 401 gc->away = NULL; |
402 gc->away = NULL; |
| |
403 } |
| 402 |
404 |
| 403 if (!strcmp(state, "Online")) |
405 if (!strcmp(state, "Online")) |
| 404 icq_ChangeStatus(id->link, STATUS_ONLINE); |
406 icq_ChangeStatus(id->link, STATUS_ONLINE); |
| 405 else if (!strcmp(state, "Away")) { |
407 else if (!strcmp(state, "Away")) { |
| 406 icq_ChangeStatus(id->link, STATUS_AWAY); |
408 icq_ChangeStatus(id->link, STATUS_AWAY); |
| 407 gc->away = ""; |
409 gc->away = g_strdup(""); |
| 408 } else if (!strcmp(state, "Do Not Disturb")) { |
410 } else if (!strcmp(state, "Do Not Disturb")) { |
| 409 icq_ChangeStatus(id->link, STATUS_DND); |
411 icq_ChangeStatus(id->link, STATUS_DND); |
| 410 gc->away = ""; |
412 gc->away = g_strdup(""); |
| 411 } else if (!strcmp(state, "Not Available")) { |
413 } else if (!strcmp(state, "Not Available")) { |
| 412 icq_ChangeStatus(id->link, STATUS_NA); |
414 icq_ChangeStatus(id->link, STATUS_NA); |
| 413 gc->away = ""; |
415 gc->away = g_strdup(""); |
| 414 } else if (!strcmp(state, "Occupied")) { |
416 } else if (!strcmp(state, "Occupied")) { |
| 415 icq_ChangeStatus(id->link, STATUS_OCCUPIED); |
417 icq_ChangeStatus(id->link, STATUS_OCCUPIED); |
| 416 gc->away = ""; |
418 gc->away = g_strdup(""); |
| 417 } else if (!strcmp(state, "Free For Chat")) { |
419 } else if (!strcmp(state, "Free For Chat")) { |
| 418 icq_ChangeStatus(id->link, STATUS_FREE_CHAT); |
420 icq_ChangeStatus(id->link, STATUS_FREE_CHAT); |
| 419 gc->away = ""; |
421 gc->away = g_strdup(""); |
| 420 } else if (!strcmp(state, "Invisible")) { |
422 } else if (!strcmp(state, "Invisible")) { |
| 421 icq_ChangeStatus(id->link, STATUS_INVISIBLE); |
423 icq_ChangeStatus(id->link, STATUS_INVISIBLE); |
| 422 gc->away = ""; |
424 gc->away = g_strdup(""); |
| 423 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
425 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
| 424 if (msg) { |
426 if (msg) { |
| 425 icq_ChangeStatus(id->link, STATUS_NA); |
427 icq_ChangeStatus(id->link, STATUS_NA); |
| 426 gc->away = ""; |
428 gc->away = g_strdup(""); |
| 427 } else { |
429 } else { |
| 428 icq_ChangeStatus(id->link, STATUS_ONLINE); |
430 icq_ChangeStatus(id->link, STATUS_ONLINE); |
| 429 } |
431 } |
| 430 } |
432 } |
| 431 } |
433 } |