changeset 6761:ddbe06989d46

[gaim-migrate @ 7293] Tim Ringenbach (marv_sf) added better error messages for some yahoo errors committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sat, 06 Sep 2003 01:24:50 +0000
parents e7e21e5d1d16
children 818ce550d2ce
files src/protocols/yahoo/yahoo.c
diffstat 1 files changed, 33 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoo.c	Sat Sep 06 01:21:30 2003 +0000
+++ b/src/protocols/yahoo/yahoo.c	Sat Sep 06 01:24:50 2003 +0000
@@ -695,7 +695,7 @@
 	char *sn   = NULL;
 	GSList *l = pkt->hash;
 	struct yahoo_data *yd = gc->proto_data;
-	
+
 	while (l) {
 		struct yahoo_pair *pair = l->data;
 		if (pair->key == 94)
@@ -899,6 +899,35 @@
 	}
 }
 
+static void yahoo_process_authresp(GaimConnection *gc, struct yahoo_packet *pkt)
+{
+	GSList *l = pkt->hash;
+	int err = 0;
+	char *msg;
+
+	while (l) {
+		struct yahoo_pair *pair = l->data;
+
+		if (pair->key == 66)
+			err = strtol(pair->value, NULL, 10);
+
+		l = l->next;
+	}
+
+	switch (err) {
+	case 3:
+		msg = _("Invalid username.");
+		break;
+	case 13:
+		msg = _("Incorrect password.");
+		break;
+	default:
+		msg = _("Unknown error.");
+	}
+
+	gaim_connection_error(gc, msg);
+}
+
 static void yahoo_packet_process(GaimConnection *gc, struct yahoo_packet *pkt)
 {
 	switch (pkt->service) {
@@ -935,6 +964,9 @@
 	case YAHOO_SERVICE_IGNORECONTACT:
 		yahoo_process_ignore(gc, pkt);
 		break;
+	case YAHOO_SERVICE_AUTHRESP:
+		yahoo_process_authresp(gc, pkt);
+		break;
 	case YAHOO_SERVICE_CONFINVITE:
 	case YAHOO_SERVICE_CONFADDINVITE:
 		yahoo_process_conference_invite(gc, pkt);