changeset 1563:393b23c8f494

[gaim-migrate @ 1573] notify when people add you to their list committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 11 Mar 2001 00:38:37 +0000
parents 12f16a852540
children aa69b15d9403
files plugins/yay/rxhandlers.c plugins/yay/yay.c plugins/yay/yay.h
diffstat 3 files changed, 28 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/yay/rxhandlers.c	Sat Mar 10 23:59:53 2001 +0000
+++ b/plugins/yay/rxhandlers.c	Sun Mar 11 00:38:37 2001 +0000
@@ -196,9 +196,11 @@
 		yahoo_parse_status(sess, pkt);
 		break;
 	case YAHOO_SERVICE_NEWCONTACT:
-		if (yahoo_makeint(pkt->msgtype) == 3)
-			yahoo_parse_message(sess, pkt);
-		else
+		if (yahoo_makeint(pkt->msgtype) == 3) {
+			char **str_array = g_strsplit(pkt->content, ",,", 2);
+			CALLBACK(sess, YAHOO_HANDLE_BUDDYADDED, pkt->nick2, str_array[0], str_array[1]);
+			g_strfreev(str_array);
+		} else
 			yahoo_parse_status(sess, pkt);
 		break;
 	case YAHOO_SERVICE_IDACT:
--- a/plugins/yay/yay.c	Sat Mar 10 23:59:53 2001 +0000
+++ b/plugins/yay/yay.c	Sun Mar 11 00:38:37 2001 +0000
@@ -153,6 +153,26 @@
 	return 1;
 }
 
+static int yahoo_buddyadded(struct yahoo_session *sess, ...) {
+	va_list ap;
+	char *id;
+	char *who;
+	char *msg;
+	char buf[2048];
+
+	va_start(ap, sess);
+	id = va_arg(ap, char *);
+	who = va_arg(ap, char *);
+	msg = va_arg(ap, char *);
+	va_end(ap);
+
+	g_snprintf(buf, sizeof(buf), _("%s has made %s their buddy%s%s"), who, id,
+			msg ? ": " : "", msg ? msg : "");
+	do_error_dialog(buf, _("Gaim - Buddy"));
+
+	return 1;
+}
+
 static void des_win(GtkWidget *w, struct yahoo_data *yd) {
 	gtk_widget_destroy(yd->email_win);
 	if (yd->email_win == w)
@@ -344,6 +364,7 @@
 	yahoo_add_handler(yd->sess, YAHOO_HANDLE_MESSAGE, yahoo_message);
 	yahoo_add_handler(yd->sess, YAHOO_HANDLE_BOUNCE, yahoo_bounce);
 	yahoo_add_handler(yd->sess, YAHOO_HANDLE_STATUS, yahoo_status);
+	yahoo_add_handler(yd->sess, YAHOO_HANDLE_BUDDYADDED, yahoo_buddyadded);
 }
 
 static gboolean yahoo_destroy_hash(gpointer key, gpointer val, gpointer data) {
--- a/plugins/yay/yay.h	Sat Mar 10 23:59:53 2001 +0000
+++ b/plugins/yay/yay.h	Sun Mar 11 00:38:37 2001 +0000
@@ -103,7 +103,8 @@
 #define YAHOO_HANDLE_BOUNCE       8
 #define YAHOO_HANDLE_STATUS       9
 #define YAHOO_HANDLE_ACTIVATE    10
-#define YAHOO_HANDLE_MAX         11
+#define YAHOO_HANDLE_BUDDYADDED  11
+#define YAHOO_HANDLE_MAX         12
 
 struct callback {
 	yahoo_callback function;