comparison plugins/yay/yay.c @ 1891:1c977d995da9

[gaim-migrate @ 1901] yahoo doesn't have to notify you of mail. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 24 May 2001 21:34:26 +0000
parents a02584b98823
children ac9dd6b00b34
comparison
equal deleted inserted replaced
1890:585e26835e00 1891:1c977d995da9
47 #include "pixmaps/status-here.xpm" 47 #include "pixmaps/status-here.xpm"
48 #include "pixmaps/status-idle.xpm" 48 #include "pixmaps/status-idle.xpm"
49 49
50 #include "pixmaps/cancel.xpm" 50 #include "pixmaps/cancel.xpm"
51 51
52 #define USEROPT_MAIL 0
53
52 struct conn { 54 struct conn {
53 int socket; 55 int socket;
54 int type; 56 int type;
55 int inpa; 57 int inpa;
56 }; 58 };
213 int count; 215 int count;
214 216
215 va_start(ap, sess); 217 va_start(ap, sess);
216 count = va_arg(ap, int); 218 count = va_arg(ap, int);
217 va_end(ap); 219 va_end(ap);
220
221 if (gc->user->proto_opt[USEROPT_MAIL][0] != '1')
222 return 1;
218 223
219 if (count) { 224 if (count) {
220 g_snprintf(buf, sizeof buf, "%s has %d new message%s on Yahoo Mail.", 225 g_snprintf(buf, sizeof buf, "%s has %d new message%s on Yahoo Mail.",
221 gc->username, count, count == 1 ? "" : "s"); 226 gc->username, count, count == 1 ? "" : "s");
222 if (!yd->email_win) { 227 if (!yd->email_win) {
674 m = g_list_append(m, "Activate ID"); 679 m = g_list_append(m, "Activate ID");
675 680
676 return m; 681 return m;
677 } 682 }
678 683
684 struct mod_usr_opt {
685 struct aim_user *user;
686 int opt;
687 };
688
689 static void mod_opt(GtkWidget *b, struct mod_usr_opt *m)
690 {
691 if (m->user->proto_opt[m->opt][0] == '1')
692 m->user->proto_opt[m->opt][0] = '\0';
693 else
694 strcpy(m->user->proto_opt[m->opt],"1");
695 }
696
697 static void free_muo(GtkWidget *b, struct mod_usr_opt *m)
698 {
699 g_free(m);
700 }
701
702 static GtkWidget *yahoo_protoopt_button(const char *text, struct aim_user *u, int option, GtkWidget *box)
703 {
704 GtkWidget *button;
705 struct mod_usr_opt *muo = g_new0(struct mod_usr_opt, 1);
706 button = gtk_check_button_new_with_label(text);
707 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (u->proto_opt[option][0] == '1'));
708 gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0);
709 muo->user = u;
710 muo->opt = option;
711 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_opt), muo);
712 gtk_signal_connect(GTK_OBJECT(button), "destroy", GTK_SIGNAL_FUNC(free_muo), muo);
713 gtk_widget_show(button);
714 return button;
715 }
716
717 static void yahoo_user_opts(GtkWidget *book, struct aim_user *user)
718 {
719 GtkWidget *vbox;
720
721 vbox = gtk_vbox_new(FALSE, 5);
722 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
723 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("Yahoo Options"));
724 gtk_widget_show(vbox);
725
726 yahoo_protoopt_button("Notify me of new Yahoo! Mail", user, USEROPT_MAIL, vbox);
727 }
728
679 static struct prpl *my_protocol = NULL; 729 static struct prpl *my_protocol = NULL;
680 730
681 void Yahoo_init(struct prpl *ret) { 731 void Yahoo_init(struct prpl *ret) {
682 /* the NULL's aren't required but they're nice to have */ 732 /* the NULL's aren't required but they're nice to have */
683 ret->protocol = PROTO_YAHOO; 733 ret->protocol = PROTO_YAHOO;
685 ret->list_icon = yahoo_list_icon; 735 ret->list_icon = yahoo_list_icon;
686 ret->away_states = yahoo_away_states; 736 ret->away_states = yahoo_away_states;
687 ret->actions = yahoo_actions; 737 ret->actions = yahoo_actions;
688 ret->do_action = yahoo_do_action; 738 ret->do_action = yahoo_do_action;
689 ret->buddy_menu = yahoo_buddy_menu; 739 ret->buddy_menu = yahoo_buddy_menu;
690 ret->user_opts = NULL; 740 ret->user_opts = yahoo_user_opts;
691 ret->login = yahoo_login; 741 ret->login = yahoo_login;
692 ret->close = yahoo_close; 742 ret->close = yahoo_close;
693 ret->send_im = yahoo_send_im; 743 ret->send_im = yahoo_send_im;
694 ret->set_info = NULL; 744 ret->set_info = NULL;
695 ret->get_info = NULL; 745 ret->get_info = NULL;