pidgin: 8da8d3c2: Added some comments and debug logging to...

evands at pidgin.im evands at pidgin.im
Wed Mar 5 19:10:44 EST 2008


-----------------------------------------------------------------
Revision: 8da8d3c2a708d8bd00fe907d35de61998fb20125
Ancestor: 9a5b9a755769ed5ce1855edc6f94e7a1afc35313
Author: evands at pidgin.im
Date: 2008-03-06T00:04:03
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/8da8d3c2a708d8bd00fe907d35de61998fb20125

Modified files:
        libpurple/protocols/yahoo/yahoo.c

ChangeLog: 

Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo.c	6ca375f9f1715ebc3447d4faf2139d43a107db60
+++ libpurple/protocols/yahoo/yahoo.c	05d48ed74d9f4b92dc58dd479740f84eef584aa0
@@ -2035,9 +2035,9 @@ static void yahoo_process_ignore(PurpleC
 	PurpleBuddy *b;
 	GSList *l;
 	gchar *who = NULL;
-	gchar *sn = NULL;
+	gchar *me = NULL;
 	gchar buf[BUF_LONG];
-	gint ignore = 0;
+	gboolean ignore = TRUE;
 	gint status = 0;
 
 	for (l = pkt->hash; l; l = l->next) {
@@ -2047,10 +2047,11 @@ static void yahoo_process_ignore(PurpleC
 			who = pair->value;
 			break;
 		case 1:
-			sn = pair->value;
+			me = pair->value;
 			break;
 		case 13:
-			ignore = strtol(pair->value, NULL, 10);
+			/* 1 == ignore, 2 == unignore */
+			ignore = (strtol(pair->value, NULL, 10) == 1);
 			break;
 		case 66:
 			status = strtol(pair->value, NULL, 10);
@@ -2060,23 +2061,40 @@ static void yahoo_process_ignore(PurpleC
 		}
 	}
 
+	/*
+	 * status
+	 * 0  - ok
+	 * 2  - already in ignore list, could not add
+	 * 3  - not in ignore list, could not delete
+	 * 12 - is a buddy, could not add (and possibly also a not-in-ignore list condition?)
+	 */
 	switch (status) {
-	case 12:
-		b = purple_find_buddy(gc->account, who);
-		g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the "
-					"user is on your buddy list.  Clicking \"Yes\" "
-					"will remove and ignore the buddy."), who);
-		purple_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0,
-						gc->account, who, NULL,
-						b,
-						G_CALLBACK(ignore_buddy),
-						G_CALLBACK(keep_buddy));
-		break;
-	case 2:
-	case 3:
-	case 0:
-	default:
-		break;
+		case 12:
+			purple_debug_info("yahoo", "Server reported \"is a buddy\" for %s while %s"
+							  who, (ignore ? "ignoring" : "unignoring"));
+
+			if (ignore) {
+				b = purple_find_buddy(gc->account, who);
+				g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the "
+											   "user is on your buddy list.  Clicking \"Yes\" "
+											   "will remove and ignore the buddy."), who);
+				purple_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0,
+									  gc->account, who, NULL,
+									  b,
+									  G_CALLBACK(ignore_buddy),
+									  G_CALLBACK(keep_buddy));
+				break;
+			}
+		case 2:
+			purple_debug_info("yahoo", "Server reported that %s is already in the ignore list.",
+							  who);
+			break;
+		case 3:
+			purple_debug_info("yahoo", "Server reported that %s is not in the ignore list; could not delete",
+							  who);
+		case 0:
+		default:
+			break;
 	}
 }
 


More information about the Commits mailing list