changeset 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 585e26835e00
children 8ff00a834e30
files ChangeLog plugins/msn/msn.c plugins/yay/yay.c
diffstat 3 files changed, 73 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu May 24 21:14:50 2001 +0000
+++ b/ChangeLog	Thu May 24 21:34:26 2001 +0000
@@ -16,6 +16,7 @@
 	* Improved proxy options
 	* Fixed a small issue with HTML not being stripped from
 	  log files properly (Thanks, faceprint and David Stoddard)
+	* Can turn on/off Yahoo! Mail announcements
 
 version 0.11.0-pre11 (04/30/2001):
 	* Zephyr updates and additions, thanks Neil Sanchala (nsanch)
--- a/plugins/msn/msn.c	Thu May 24 21:14:50 2001 +0000
+++ b/plugins/msn/msn.c	Thu May 24 21:34:26 2001 +0000
@@ -109,17 +109,17 @@
 	char *txqueue;
 };
 
-GSList *msn_connections = NULL;
+static GSList *msn_connections = NULL;
 
-unsigned long long globalc = 0;
+static unsigned long long globalc = 0;
 static void msn_callback(gpointer data, gint source, GdkInputCondition condition);
 static void msn_add_permit(struct gaim_connection *gc, char *who);
 static void process_hotmail_msg(struct gaim_connection *gc, gchar *msgdata);
-void msn_des_win(GtkWidget *a, GtkWidget *b);
-void msn_newmail_dialog(const char *text);
+static void msn_des_win(GtkWidget *a, GtkWidget *b);
+static void msn_newmail_dialog(const char *text);
 static char *msn_normalize(const char *s);
 
-char tochar(char *h)
+static char tochar(char *h)
 {
 	char tmp;
 	char b = 0;
@@ -143,7 +143,7 @@
 	return v;
 }
 
-char *url_decode(char *text)
+static char *url_decode(char *text)
 {
 	static char newtext[MSN_BUF_LEN];
 	char *buf;
@@ -181,7 +181,7 @@
 	return newtext;
 }
 
-void msn_accept_add_permit(gpointer w, struct msn_ask_add_permit *ap)
+static void msn_accept_add_permit(gpointer w, struct msn_ask_add_permit *ap)
 {
 	msn_add_permit(ap->gc, ap->user);
 	/* leak if we don't free these? */
@@ -190,14 +190,14 @@
 	g_free(ap);
 }
 
-void msn_cancel_add_permit(gpointer w, struct msn_ask_add_permit *ap)
+static void msn_cancel_add_permit(gpointer w, struct msn_ask_add_permit *ap)
 {
 	g_free(ap->user);
 	g_free(ap->friendly);
 	g_free(ap);
 }
 
-void free_msn_conn(struct msn_conn *mc)
+static void free_msn_conn(struct msn_conn *mc)
 {
 	if (mc->user)
 		free(mc->user);
@@ -220,7 +220,7 @@
 }
 
 
-struct msn_conn *find_msn_conn_by_user(gchar * user)
+static struct msn_conn *find_msn_conn_by_user(gchar * user)
 {
 	struct msn_conn *mc;
 	GSList *conns = msn_connections;
@@ -240,7 +240,7 @@
 	return NULL;
 }
 
-struct msn_conn *find_msn_conn_by_trid(time_t trid)
+static struct msn_conn *find_msn_conn_by_trid(time_t trid)
 {
 	struct msn_conn *mc;
 	GSList *conns = msn_connections;
@@ -277,19 +277,19 @@
 	return "Allows gaim to use the MSN protocol.  For some reason, this frightens me.";
 }
 
-time_t trId(struct msn_data *md)
+static time_t trId(struct msn_data *md)
 {
 	md->last_trid = time((time_t *)NULL) + globalc++;
 	return md->last_trid;
 }
 
-void msn_write(int fd, char *buf)
+static void msn_write(int fd, char *buf)
 {
 	write(fd, buf, strlen(buf));
 	debug_printf("MSN(%d) <== %s", fd, buf);
 }
 
-void msn_add_request(struct gaim_connection *gc, char *buf)
+static void msn_add_request(struct gaim_connection *gc, char *buf)
 {
 	char **res;
 
@@ -875,7 +875,7 @@
 	}
 }
 
-void msn_login(struct aim_user *user)
+static void msn_login(struct aim_user *user)
 {
 	struct gaim_connection *gc = new_gaim_conn(user);
 	struct msn_data *md = gc->proto_data = g_new0(struct msn_data, 1);
@@ -901,7 +901,7 @@
 	}
 }
 
-void msn_send_im(struct gaim_connection *gc, char *who, char *message, int away)
+static void msn_send_im(struct gaim_connection *gc, char *who, char *message, int away)
 {
 	struct msn_conn *mc;
 	struct msn_data *md = (struct msn_data *)gc->proto_data;
@@ -1125,7 +1125,7 @@
 	gtk_widget_show(button);	
 }
 
-void msn_newmail_dialog(const char *text)
+static void msn_newmail_dialog(const char *text)
 {
 	GtkWidget *window;
 	GtkWidget *vbox;
@@ -1157,7 +1157,7 @@
 	gtk_widget_show_all(window);
 }
 
-void msn_des_win(GtkWidget *a, GtkWidget *b)
+static void msn_des_win(GtkWidget *a, GtkWidget *b)
 {
 	gtk_widget_destroy(b);
 }
@@ -1274,7 +1274,7 @@
 	return buf;
 }
 
-void do_change_name(GtkWidget *w, struct msn_name_dlg *b)
+static void do_change_name(GtkWidget *w, struct msn_name_dlg *b)
 {
 	struct gaim_connection *gc = b->user->gc;
 	struct msn_data *md = (struct msn_data *)gc->proto_data;
@@ -1292,7 +1292,7 @@
 	return;
 }
 
-void show_change_name(struct gaim_connection *gc)
+static void show_change_name(struct gaim_connection *gc)
 {
 	GtkWidget *label;
 	GtkWidget *vbox;
@@ -1385,7 +1385,7 @@
 
 static struct prpl *my_protocol = NULL;
 
-void msn_init(struct prpl *ret)
+static void msn_init(struct prpl *ret)
 {
 	ret->protocol = PROTO_MSN;
 	ret->name = msn_name;
--- a/plugins/yay/yay.c	Thu May 24 21:14:50 2001 +0000
+++ b/plugins/yay/yay.c	Thu May 24 21:34:26 2001 +0000
@@ -49,6 +49,8 @@
 
 #include "pixmaps/cancel.xpm"
 
+#define USEROPT_MAIL 0
+
 struct conn {
 	int socket;
 	int type;
@@ -216,6 +218,9 @@
 	count = va_arg(ap, int);
 	va_end(ap);
 
+	if (gc->user->proto_opt[USEROPT_MAIL][0] != '1')
+		return 1;
+
 	if (count) {
 		g_snprintf(buf, sizeof buf, "%s has %d new message%s on Yahoo Mail.",
 				gc->username, count, count == 1 ? "" : "s");
@@ -676,6 +681,51 @@
 	return m;
 }
 
+struct mod_usr_opt {
+	struct aim_user *user;
+	int opt;
+};
+
+static void mod_opt(GtkWidget *b, struct mod_usr_opt *m)
+{
+	if (m->user->proto_opt[m->opt][0] == '1')
+		m->user->proto_opt[m->opt][0] = '\0';
+	else
+		strcpy(m->user->proto_opt[m->opt],"1");
+}
+
+static void free_muo(GtkWidget *b, struct mod_usr_opt *m)
+{
+	g_free(m);
+}
+
+static GtkWidget *yahoo_protoopt_button(const char *text, struct aim_user *u, int option, GtkWidget *box)
+{
+	GtkWidget *button;
+	struct mod_usr_opt *muo = g_new0(struct mod_usr_opt, 1);
+	button = gtk_check_button_new_with_label(text);
+	gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (u->proto_opt[option][0] == '1'));
+	gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0);
+	muo->user = u;
+	muo->opt = option;
+	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_opt), muo);
+	gtk_signal_connect(GTK_OBJECT(button), "destroy", GTK_SIGNAL_FUNC(free_muo), muo);
+	gtk_widget_show(button);
+	return button;
+}
+
+static void yahoo_user_opts(GtkWidget *book, struct aim_user *user)
+{
+	GtkWidget *vbox;
+
+	vbox = gtk_vbox_new(FALSE, 5);
+	gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
+	gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("Yahoo Options"));
+	gtk_widget_show(vbox);
+
+	yahoo_protoopt_button("Notify me of new Yahoo! Mail", user, USEROPT_MAIL, vbox);
+}
+
 static struct prpl *my_protocol = NULL;
 
 void Yahoo_init(struct prpl *ret) {
@@ -687,7 +737,7 @@
 	ret->actions = yahoo_actions;
 	ret->do_action = yahoo_do_action;
 	ret->buddy_menu = yahoo_buddy_menu;
-	ret->user_opts = NULL;
+	ret->user_opts = yahoo_user_opts;
 	ret->login = yahoo_login;
 	ret->close = yahoo_close;
 	ret->send_im = yahoo_send_im;