Hi,

I've finally decided to take care of these messages, which will appear
at info column in the Gnet/Upload/Download pane, I'm not sure which part
could be related these messages I've been frequently seeing and whether
it breaks internal security, so this patch might be wrong. What I don't
want Gtk-Gnutella to do is that it'll send/show i18n messages to the
other servents/users.

I'd like to emphasize if these last English strings will be translatable,
Gtk-Gnutella would be a little more appealing for non-English user (of
course there needs translators though).

-- 
Daichi
Index: downloads.c
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/core/downloads.c,v
retrieving revision 1.50
diff -u -r1.50 downloads.c
--- downloads.c	26 May 2005 12:49:43 -0000	1.50
+++ downloads.c	29 May 2005 06:18:14 -0000
@@ -539,7 +542,7 @@
 						 * queued for that host as well.
 						 */
 
-						download_unavailable(d, GTA_DL_ERROR, "Timeout");
+						download_unavailable(d, GTA_DL_ERROR, _("Timeout"));
 						download_remove_all_from_peer(
 							download_guid(d), download_ip(d), download_port(d),
 							TRUE);
@@ -2992,26 +2995,29 @@
 				download_guid(d), download_ip(d), download_port(d), TRUE);
 		} else
 			download_queue_hold(d, download_retry_refused_delay,
-				"No direct connection yet (%d retr%s)",
-				d->retries, d->retries == 1 ? "y" : "ies");
+				NG_("No direct connection yet (%d retry)",
+					"No direct connection yet (%d retries)", d->retries),
+					 d->retries);
 	} else if (d->retries < download_max_retries) {
 		d->retries++;
 		if (on_timeout)
 			download_queue_hold(d, download_retry_timeout_delay,
-				"Timeout (%d retr%s)",
-				d->retries, d->retries == 1 ? "y" : "ies");
+				NG_("Timeout (%d retry)",
+					"Timeout (%d retries)", d->retries), d->retries);
 		else
 			download_queue_hold(d, download_retry_refused_delay,
-				"Connection refused (%d retr%s)",
-				d->retries, d->retries == 1 ? "y" : "ies");
+				NG_("Connection refused (%d retry)",
+					"Connection refused (%d retries)", d->retries),
+					 d->retries);
 	} else {
 		/*
 		 * Looks like this host is down.  Abort the download, and remove all
 		 * the ones queued for the same host.
 		 */
 
-		download_unavailable(d, GTA_DL_ERROR, "Timeout (%d retr%s)",
-				d->retries, d->retries == 1 ? "y" : "ies");
+		download_unavailable(d, GTA_DL_ERROR,
+				NG_("Timeout (%d retry)",
+					"Timeout (%d retries)", d->retries), d->retries);
 
 		download_remove_all_from_peer(
 			download_guid(d), download_ip(d), download_port(d), TRUE);
Index: nodes.c
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/core/nodes.c,v
retrieving revision 1.95
diff -u -r1.95 nodes.c
--- nodes.c	16 May 2005 05:00:41 -0000	1.95
+++ nodes.c	29 May 2005 06:18:28 -0000
@@ -3100,7 +3103,7 @@
 		if (n->status == GTA_NODE_REMOVING)
 			continue;
 
-		node_bye_if_writable(n, 202, "User going offline");
+		node_bye_if_writable(n, 202, _("User going offline"));
 	}
 }
 
@@ -3529,7 +3532,7 @@
 			if (handshaking && node_leaf_count >= max_leaves) {
 				node_send_error(n, 503,
 					"Too many leaf connections (%d max)", max_leaves);
-				node_remove(n, "Too many leaves (%d max)", max_leaves);
+				node_remove(n, _("Too many leaves (%d max)"), max_leaves);
 				return FALSE;
 			}
 			if (!handshaking && node_leaf_count > max_leaves) {
@@ -3566,7 +3569,7 @@
 			) {
 				node_send_error(n, 503,
 					"Too many ultra connections (%d max)", ultra_max);
-				node_remove(n, "Too many ultra nodes (%d max)", ultra_max);
+				node_remove(n, _("Too many ultra nodes (%d max)"), ultra_max);
 				return FALSE;
 			}
 			if (!handshaking && node_ultra_count > ultra_max) {
@@ -3633,7 +3636,7 @@
 			if (connected >= max_connections) {
 				node_send_error(n, 503,
 					"Too many Gnet connections (%d max)", max_connections);
-				node_remove(n, "Too many nodes (%d max)", max_connections);
+				node_remove(n, _("Too many nodes (%d max)"), max_connections);
 				return FALSE;
 			}
 			if (
@@ -3682,7 +3685,7 @@
 			if (node_ultra_count >= max_ultrapeers) {
 				node_send_error(n, 503,
 					"Too many ultra connections (%d max)", max_ultrapeers);
-				node_remove(n, "Too many ultra nodes (%d max)", max_ultrapeers);
+				node_remove(n, _("Too many ultra nodes (%d max)"), max_ultrapeers);
 				return FALSE;
 			}
 
@@ -4476,7 +4479,7 @@
 
 	if (node_reserve_slot(n)) {
 		node_send_error(n, 409, "Reserved slot");
-		node_remove(n, "Reserved slot");
+		node_remove(n, _("Reserved slot"));
 		return;
 	}
 
@@ -4893,7 +4896,7 @@
 	n->hops_flow = MAX_HOP_COUNT;
 	n->last_update = n->last_tx = n->last_rx = time(NULL);
 	n->routing_data = NULL;
-	n->vendor = atom_str_get("Pseudo UDP node");
+	n->vendor = atom_str_get(_("Pseudo UDP node"));
 	n->status = GTA_NODE_CONNECTED;
 	n->flags = NODE_F_ESTABLISHED | \
 		NODE_F_READABLE | NODE_F_WRITABLE | NODE_F_VALID;
Index: uploads.c
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/core/uploads.c,v
retrieving revision 1.43
diff -u -r1.43 uploads.c
--- uploads.c	20 May 2005 13:32:26 -0000	1.43
+++ uploads.c	29 May 2005 06:18:38 -0000
@@ -2746,7 +2746,7 @@
 					upload_error_remove(u, reqfile, 503, "Queue full");
 				} else {
 					upload_error_remove(u, reqfile,	503,
-						"Queued (slot %d, ETA: %s)",
+						_("Queued (slot %d, ETA: %s)"),
 						parq_upload_lookup_position(u),
 						short_time(parq_upload_lookup_eta(u)));
 				}
@@ -2766,8 +2766,9 @@
 
 		if (!is_followup && !parq_upload_ip_can_proceed(u)) {
 			upload_error_remove(u, reqfile, 503,
-				"Only %d upload%s per IP address",
-				max_uploads_ip, max_uploads_ip == 1 ? "" : "s");
+				NG_("Only %d upload per IP address",
+					"Only %d uploads per IP address", max_uploads_ip),
+					 max_uploads_ip);
 			return;
 		}
 

Reply via email to