im.pidgin.cpw.resiak.disconnectreason: 3bf36d05f31cdaa9f0a3d9ad2b752a86ffc3e61f

resiak at soc.pidgin.im resiak at soc.pidgin.im
Wed Oct 3 13:56:24 EDT 2007


revision:            3bf36d05f31cdaa9f0a3d9ad2b752a86ffc3e61f
date:                2007-10-03T17:23:02
author:              resiak at soc.pidgin.im
branch:              im.pidgin.cpw.resiak.disconnectreason
changelog:
Add disconnection reasons to SIMPLE.

manifest:
format_version "1"

new_manifest [c12f3c7cc60082fc057474ea17e50a139c957170]

old_revision [22f81dcf0b879694d702cf62e553645025734319]

patch "libpurple/protocols/simple/simple.c"
 from [63ca9cac31b37929cccc15543b928ed8ec5e3291]
   to [b2f8a49b8acefebc2f84a38f166ce077922bec19]
-------------- next part --------------
#
#
# patch "libpurple/protocols/simple/simple.c"
#  from [63ca9cac31b37929cccc15543b928ed8ec5e3291]
#    to [b2f8a49b8acefebc2f84a38f166ce077922bec19]
#
============================================================
--- libpurple/protocols/simple/simple.c	63ca9cac31b37929cccc15543b928ed8ec5e3291
+++ libpurple/protocols/simple/simple.c	b2f8a49b8acefebc2f84a38f166ce077922bec19
@@ -413,7 +413,8 @@ static void simple_canwrite_cb(gpointer 
 		written = 0;
 	else if(written <= 0) {
 		/*TODO: do we really want to disconnect on a failure to write?*/
-		purple_connection_error(gc, _("Could not write"));
+		purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR,
+			_("Could not write"));
 		return;
 	}
 
@@ -435,7 +436,8 @@ static void send_later_cb(gpointer data,
 	}
 
 	if(source < 0) {
-		purple_connection_error(gc, _("Could not connect"));
+		purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR,
+			_("Could not connect"));
 		return;
 	}
 
@@ -461,7 +463,7 @@ static void sendlater(PurpleConnection *
 	if(!sip->connecting) {
 		purple_debug_info("simple", "connecting to %s port %d\n", sip->realhostname ? sip->realhostname : "{NULL}", sip->realport);
 		if (purple_proxy_connect(gc, sip->account, sip->realhostname, sip->realport, send_later_cb, gc) == NULL) {
-			purple_connection_error(gc, _("Couldn't create socket"));
+			purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR, _("Couldn't create socket"));
 		}
 		sip->connecting = TRUE;
 	}
@@ -1042,7 +1044,9 @@ gboolean process_register_response(struc
 				if(sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) {
 					purple_debug_info("simple", "Setting wants_to_die to true.\n");
 					sip->gc->wants_to_die = TRUE;
-					purple_connection_error(sip->gc, _("Incorrect password."));
+					purple_connection_error_reason(sip->gc,
+						PURPLE_REASON_AUTHENTICATION_FAILED,
+						_("Incorrect password."));
 					return TRUE;
 				}
 				tmp = sipmsg_find_header(msg, "WWW-Authenticate");
@@ -1056,7 +1060,8 @@ gboolean process_register_response(struc
 				purple_debug_info("simple", "Unrecognized return code for REGISTER.\n");
 				if (sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) {
 					sip->gc->wants_to_die = TRUE;
-					purple_connection_error(sip->gc, _("Unknown server response."));
+					purple_connection_error_reason(sip->gc, PURPLE_REASON_OTHER_ERROR,
+						_("Unknown server response."));
 					return TRUE;
 				}
 				sip->registerstatus = SIMPLE_REGISTER_RETRY;
@@ -1526,7 +1531,8 @@ static void login_cb(gpointer data, gint
 	}
 
 	if(source < 0) {
-		purple_connection_error(gc, _("Could not connect"));
+		purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR,
+			_("Could not connect"));
 		return;
 	}
 
@@ -1560,7 +1566,8 @@ static void simple_udp_host_resolved_lis
 	sip->listen_data = NULL;
 
 	if(listenfd == -1) {
-		purple_connection_error(sip->gc, _("Could not create listen socket"));
+		purple_connection_error_reason(sip->gc, PURPLE_REASON_NETWORK_ERROR,
+			_("Could not create listen socket"));
 		return;
 	}
 
@@ -1583,7 +1590,9 @@ static void simple_udp_host_resolved(GSL
 	sip->query_data = NULL;
 
 	if (!hosts || !hosts->data) {
-		purple_connection_error(sip->gc, _("Couldn't resolve host"));
+		purple_connection_error_reason(sip->gc,
+			PURPLE_REASON_NETWORK_ERROR,
+			_("Couldn't resolve host"));
 		return;
 	}
 
@@ -1602,7 +1611,9 @@ static void simple_udp_host_resolved(GSL
 	sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_DGRAM,
 				simple_udp_host_resolved_listen_cb, sip);
 	if (sip->listen_data == NULL) {
-		purple_connection_error(sip->gc, _("Could not create listen socket"));
+		purple_connection_error_reason(sip->gc,
+			PURPLE_REASON_NETWORK_ERROR,
+			_("Could not create listen socket"));
 		return;
 	}
 }
@@ -1615,7 +1626,9 @@ simple_tcp_connect_listen_cb(int listenf
 
 	sip->listenfd = listenfd;
 	if(sip->listenfd == -1) {
-		purple_connection_error(sip->gc, _("Could not create listen socket"));
+		purple_connection_error_reason(sip->gc,
+			PURPLE_REASON_NETWORK_ERROR,
+			_("Could not create listen socket"));
 		return;
 	}
 
@@ -1628,7 +1641,9 @@ simple_tcp_connect_listen_cb(int listenf
 	/* open tcp connection to the server */
 	if (purple_proxy_connect(sip->gc, sip->account, sip->realhostname,
 			sip->realport, login_cb, sip->gc) == NULL) {
-		purple_connection_error(sip->gc, _("Couldn't create socket"));
+		purple_connection_error_reason(sip->gc,
+			PURPLE_REASON_NETWORK_ERROR,
+			_("Couldn't create socket"));
 	}
 }
 
@@ -1666,7 +1681,8 @@ static void srvresolved(PurpleSrvRespons
 		sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_STREAM,
 					simple_tcp_connect_listen_cb, sip);
 		if (sip->listen_data == NULL) {
-			purple_connection_error(sip->gc, _("Could not create listen socket"));
+			purple_connection_error_reason(sip->gc, PURPLE_REASON_NETWORK_ERROR,
+				_("Could not create listen socket"));
 			return;
 		}
 	} else { /* UDP */
@@ -1674,7 +1690,8 @@ static void srvresolved(PurpleSrvRespons
 
 		sip->query_data = purple_dnsquery_a(hostname, port, simple_udp_host_resolved, sip);
 		if (sip->query_data == NULL) {
-			purple_connection_error(sip->gc, _("Could not resolve hostname"));
+			purple_connection_error_reason(sip->gc, PURPLE_REASON_NETWORK_ERROR,
+				_("Could not resolve hostname"));
 		}
 	}
 }
@@ -1691,7 +1708,8 @@ static void simple_login(PurpleAccount *
 
 	if (strpbrk(username, " \t\v\r\n") != NULL) {
 		gc->wants_to_die = TRUE;
-		purple_connection_error(gc, _("SIP screen names may not contain whitespaces or @ symbols"));
+		purple_connection_error_reason(gc, PURPLE_REASON_INVALID_SETTINGS,
+			_("SIP screen names may not contain whitespaces or @ symbols"));
 		return;
 	}
 


More information about the Commits mailing list