changeset 20125:3e8531514ad7

Add disconnection reasons to qq.
author Will Thompson <will.thompson@collabora.co.uk>
date Tue, 02 Oct 2007 00:14:12 +0000
parents 05726ea2dd89
children 5eb52c076a2f
files libpurple/protocols/qq/keep_alive.c libpurple/protocols/qq/login_logout.c libpurple/protocols/qq/qq.c
diffstat 3 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/qq/keep_alive.c	Mon Oct 01 16:07:14 2007 +0000
+++ b/libpurple/protocols/qq/keep_alive.c	Tue Oct 02 00:14:12 2007 +0000
@@ -84,7 +84,8 @@
 		/* segments[0] and segment[1] are all 0x30 ("0") */
 		qd->all_online = strtol(segments[2], NULL, 10);
 		if(0 == qd->all_online)
-			purple_connection_error(gc, _("Keep alive error"));
+			purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR,
+					_("Keep alive error"));
 		g_free(qd->my_ip);
 		qd->my_ip = g_strdup(segments[3]);
 		qd->my_port = strtol(segments[4], NULL, 10);
--- a/libpurple/protocols/qq/login_logout.c	Mon Oct 01 16:07:14 2007 +0000
+++ b/libpurple/protocols/qq/login_logout.c	Tue Oct 02 00:14:12 2007 +0000
@@ -405,7 +405,7 @@
 				">>> %d bytes -> [default] decrypt and dump\n%s",
 				buf_len, hex_dump);
 		try_dump_as_gbk(buf, buf_len);
-		purple_connection_error(gc, _("Error requesting login token"));
+		purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, _("Error requesting login token"));
 	}
 	g_free(hex_dump);
 }
@@ -480,10 +480,12 @@
 	switch (ret) {
 	case QQ_LOGIN_REPLY_PWD_ERROR:
 		gc->wants_to_die = TRUE;
-		purple_connection_error(gc, _("Incorrect password."));
+		purple_connection_error_reason(gc,
+			PURPLE_REASON_AUTHENTICATION_FAILED, _("Incorrect password."));
 		break;
 	case QQ_LOGIN_REPLY_MISC_ERROR:
-		purple_connection_error(gc, _("Unable to login, check debug log"));
+		purple_connection_error_reason(gc,
+			PURPLE_REASON_NETWORK_ERROR, _("Unable to login, check debug log"));
 		break;
 	case QQ_LOGIN_REPLY_OK:
 		purple_debug(PURPLE_DEBUG_INFO, "QQ", "Login replys OK, everything is fine\n");
--- a/libpurple/protocols/qq/qq.c	Mon Oct 01 16:07:14 2007 +0000
+++ b/libpurple/protocols/qq/qq.c	Tue Oct 02 00:14:12 2007 +0000
@@ -136,7 +136,8 @@
 	purple_connection_update_progress(gc, _("Connecting"), 0, QQ_CONNECT_STEPS);
 
 	if (qq_connect(account, qq_server, strtol(qq_port, NULL, 10), use_tcp, FALSE) < 0)
-		purple_connection_error(gc, _("Unable to connect."));
+		purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR,
+			_("Unable to connect."));
 }
 
 /* directly goes for qq_disconnect */