comparison plugins/yay/yay.c @ 1401:bf041349b11e

[gaim-migrate @ 1411] abliity to set accounts away independent of each other. also allows for all the other states (like in yahoo and icq). probably breaks MSN, so don't use it until rob fixes it. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 10 Jan 2001 22:15:24 +0000
parents 476b24cdfa32
children 65f4a0325022
comparison
equal deleted inserted replaced
1400:476b24cdfa32 1401:bf041349b11e
297 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; 297 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
298 298
299 yahoo_cmd_msg(yd->ctxt, gc->username, who, message); 299 yahoo_cmd_msg(yd->ctxt, gc->username, who, message);
300 } 300 }
301 301
302 static void yahoo_set_away(struct gaim_connection *gc, 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 (msg) { 305 if (msg) {
306 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_CUSTOM, msg); 306 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_CUSTOM, msg);
307 yd->current_status = YAHOO_STATUS_CUSTOM; 307 yd->current_status = YAHOO_STATUS_CUSTOM;
308 } else if (state) {
309 if (!strcmp(state, "Available")) {
310 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_AVAILABLE, msg);
311 yd->current_status = YAHOO_STATUS_AVAILABLE;
312 } else if (!strcmp(state, "Be Right Back")) {
313 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_BRB, msg);
314 yd->current_status = YAHOO_STATUS_BRB;
315 } else if (!strcmp(state, "Busy")) {
316 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_BUSY, msg);
317 yd->current_status = YAHOO_STATUS_BUSY;
318 } else if (!strcmp(state, "Not At Home")) {
319 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_NOTATHOME, msg);
320 yd->current_status = YAHOO_STATUS_NOTATHOME;
321 } else if (!strcmp(state, "Not At Desk")) {
322 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_NOTATDESK, msg);
323 yd->current_status = YAHOO_STATUS_NOTATDESK;
324 } else if (!strcmp(state, "Not In Office")) {
325 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_NOTINOFFICE, msg);
326 yd->current_status = YAHOO_STATUS_NOTINOFFICE;
327 } else if (!strcmp(state, "On Phone")) {
328 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_ONPHONE, msg);
329 yd->current_status = YAHOO_STATUS_ONPHONE;
330 } else if (!strcmp(state, "On Vacation")) {
331 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_ONVACATION, msg);
332 yd->current_status = YAHOO_STATUS_ONVACATION;
333 } else if (!strcmp(state, "Out To Lunch")) {
334 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_OUTTOLUNCH, msg);
335 yd->current_status = YAHOO_STATUS_OUTTOLUNCH;
336 } else if (!strcmp(state, "Stepped Out")) {
337 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_STEPPEDOUT, msg);
338 yd->current_status = YAHOO_STATUS_STEPPEDOUT;
339 } else if (!strcmp(state, "Invisible")) {
340 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_INVISIBLE, msg);
341 yd->current_status = YAHOO_STATUS_INVISIBLE;
342 }
308 } else if (gc->is_idle) { 343 } else if (gc->is_idle) {
309 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_IDLE, NULL); 344 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_IDLE, NULL);
310 yd->current_status = YAHOO_STATUS_IDLE; 345 yd->current_status = YAHOO_STATUS_IDLE;
311 } else { 346 } else {
312 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_AVAILABLE, NULL); 347 yahoo_cmd_set_away_mode(yd->ctxt, YAHOO_STATUS_AVAILABLE, NULL);
397 button = gtk_menu_item_new_with_label(buf); 432 button = gtk_menu_item_new_with_label(buf);
398 gtk_menu_append(GTK_MENU(menu), button); 433 gtk_menu_append(GTK_MENU(menu), button);
399 gtk_widget_show(button); 434 gtk_widget_show(button);
400 } 435 }
401 436
437 static GList *yahoo_away_states() {
438 GList *m = NULL;
439
440 m = g_list_append(m, "Available");
441 m = g_list_append(m, "Be Right Back");
442 m = g_list_append(m, "Busy");
443 m = g_list_append(m, "Not At Home");
444 m = g_list_append(m, "Not At Desk");
445 m = g_list_append(m, "Not In Office");
446 m = g_list_append(m, "On Phone");
447 m = g_list_append(m, "On Vacation");
448 m = g_list_append(m, "Out To Lunch");
449 m = g_list_append(m, "Stepped Out");
450 m = g_list_append(m, "Invisible");
451 m = g_list_append(m, GAIM_AWAY_CUSTOM);
452
453 return m;
454 }
455
402 static struct prpl *my_protocol = NULL; 456 static struct prpl *my_protocol = NULL;
403 457
404 void Yahoo_init(struct prpl *ret) { 458 void Yahoo_init(struct prpl *ret) {
405 /* the NULL's aren't required but they're nice to have */ 459 /* the NULL's aren't required but they're nice to have */
406 ret->protocol = PROTO_YAHOO; 460 ret->protocol = PROTO_YAHOO;
407 ret->name = yahoo_name; 461 ret->name = yahoo_name;
408 ret->list_icon = yahoo_list_icon; 462 ret->list_icon = yahoo_list_icon;
463 ret->away_states = yahoo_away_states;
409 ret->action_menu = yahoo_action_menu; 464 ret->action_menu = yahoo_action_menu;
410 ret->user_opts = NULL; 465 ret->user_opts = NULL;
411 ret->login = yahoo_login; 466 ret->login = yahoo_login;
412 ret->close = yahoo_close; 467 ret->close = yahoo_close;
413 ret->send_im = yahoo_send_im; 468 ret->send_im = yahoo_send_im;