diff libpurple/protocols/simple/simple.c @ 21358:ba41f2a60253

Rename: * PurpleDisconnectReason to PurpleConnectionError; * elements of that enum from PURPLE_REASON_* to PURPLE_CONNECTION_ERROR_*; * purple_connection_reason_is_fatal to purple_connection_error_is_fatal.
author Will Thompson <will.thompson@collabora.co.uk>
date Sun, 14 Oct 2007 21:08:42 +0000
parents efa448405f3d
children e747ac0c42d6
line wrap: on
line diff
--- a/libpurple/protocols/simple/simple.c	Sun Oct 14 12:19:20 2007 +0000
+++ b/libpurple/protocols/simple/simple.c	Sun Oct 14 21:08:42 2007 +0000
@@ -413,7 +413,8 @@
 		written = 0;
 	else if(written <= 0) {
 		/*TODO: do we really want to disconnect on a failure to write?*/
-		purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR,
+		purple_connection_error_reason(gc,
+			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Could not write"));
 		return;
 	}
@@ -436,7 +437,8 @@
 	}
 
 	if(source < 0) {
-		purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR,
+		purple_connection_error_reason(gc,
+			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Could not connect"));
 		return;
 	}
@@ -463,7 +465,7 @@
 	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_reason(gc, PURPLE_REASON_NETWORK_ERROR, _("Couldn't create socket"));
+			purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Couldn't create socket"));
 		}
 		sip->connecting = TRUE;
 	}
@@ -1045,7 +1047,7 @@
 					if (!purple_account_get_remember_password(sip->gc->account))
 						purple_account_set_password(sip->gc->account, NULL);
 					purple_connection_error_reason(sip->gc,
-						PURPLE_REASON_AUTHENTICATION_FAILED,
+						PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED,
 						_("Incorrect password."));
 					return TRUE;
 				}
@@ -1059,7 +1061,8 @@
 			if (sip->registerstatus != SIMPLE_REGISTER_RETRY) {
 				purple_debug_info("simple", "Unrecognized return code for REGISTER.\n");
 				if (sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) {
-					purple_connection_error_reason(sip->gc, PURPLE_REASON_OTHER_ERROR,
+					purple_connection_error_reason(sip->gc,
+						PURPLE_CONNECTION_ERROR_OTHER_ERROR,
 						_("Unknown server response."));
 					return TRUE;
 				}
@@ -1530,7 +1533,8 @@
 	}
 
 	if(source < 0) {
-		purple_connection_error_reason(gc, PURPLE_REASON_NETWORK_ERROR,
+		purple_connection_error_reason(gc,
+			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Could not connect"));
 		return;
 	}
@@ -1565,7 +1569,8 @@
 	sip->listen_data = NULL;
 
 	if(listenfd == -1) {
-		purple_connection_error_reason(sip->gc, PURPLE_REASON_NETWORK_ERROR,
+		purple_connection_error_reason(sip->gc,
+			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Could not create listen socket"));
 		return;
 	}
@@ -1590,7 +1595,7 @@
 
 	if (!hosts || !hosts->data) {
 		purple_connection_error_reason(sip->gc,
-			PURPLE_REASON_NETWORK_ERROR,
+			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Couldn't resolve host"));
 		return;
 	}
@@ -1611,7 +1616,7 @@
 				simple_udp_host_resolved_listen_cb, sip);
 	if (sip->listen_data == NULL) {
 		purple_connection_error_reason(sip->gc,
-			PURPLE_REASON_NETWORK_ERROR,
+			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Could not create listen socket"));
 		return;
 	}
@@ -1626,7 +1631,7 @@
 	sip->listenfd = listenfd;
 	if(sip->listenfd == -1) {
 		purple_connection_error_reason(sip->gc,
-			PURPLE_REASON_NETWORK_ERROR,
+			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Could not create listen socket"));
 		return;
 	}
@@ -1641,7 +1646,7 @@
 	if (purple_proxy_connect(sip->gc, sip->account, sip->realhostname,
 			sip->realport, login_cb, sip->gc) == NULL) {
 		purple_connection_error_reason(sip->gc,
-			PURPLE_REASON_NETWORK_ERROR,
+			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 			_("Couldn't create socket"));
 	}
 }
@@ -1680,7 +1685,8 @@
 		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_reason(sip->gc, PURPLE_REASON_NETWORK_ERROR,
+			purple_connection_error_reason(sip->gc,
+				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 				_("Could not create listen socket"));
 			return;
 		}
@@ -1689,7 +1695,8 @@
 
 		sip->query_data = purple_dnsquery_a(hostname, port, simple_udp_host_resolved, sip);
 		if (sip->query_data == NULL) {
-			purple_connection_error_reason(sip->gc, PURPLE_REASON_NETWORK_ERROR,
+			purple_connection_error_reason(sip->gc,
+				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 				_("Could not resolve hostname"));
 		}
 	}
@@ -1706,7 +1713,8 @@
 	gc = purple_account_get_connection(account);
 
 	if (strpbrk(username, " \t\v\r\n") != NULL) {
-		purple_connection_error_reason(gc, PURPLE_REASON_INVALID_SETTINGS,
+		purple_connection_error_reason(gc,
+			PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,
 			_("SIP screen names may not contain whitespaces or @ symbols"));
 		return;
 	}