Author: toad
Date: 2008-04-29 19:15:48 +0000 (Tue, 29 Apr 2008)
New Revision: 19620

Modified:
   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
   trunk/freenet/src/freenet/node/IPDetectorPluginManager.java
Log:
Show in the alert whether we are confident that the ports haven't been 
forwarded.

Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-04-29 
19:05:35 UTC (rev 19619)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-04-29 
19:15:48 UTC (rev 19620)
@@ -494,10 +494,15 @@
 IPDetectorPluginManager.symmetricTitle=Symmetric firewall detected
 IPDetectorPluginManager.seriousConnectionProblems=Serious connection problems:
 IPDetectorPluginManager.connectionProblems=Connection problems:
-IPDetectorPluginManager.forwardPortShort=Please forward UDP port ${port}.
-IPDetectorPluginManager.forwardTwoPortsShort=Please forward UDP ports ${port1} 
and ${port2}.
-IPDetectorPluginManager.forwardPort=Your node appears to be behind some sort 
of NAT (see the connectivity page for details). You should forward UDP (not 
TCP) port ${port} if possible to improve connectivity. It is possible you have 
already done this; it takes a while for Freenet to detect a port forward. See 
${link}here${/link} for some more information.
-IPDetectorPluginManager.forwardTwoPorts=Your node appears to be behind some 
sort of NAT (see the connectivity page for details). You should forward UDP 
(not TCP) ports ${port1} and ${port2} if possible to improve connectivity. It 
is possible you have already done this; it takes a while for Freenet to detect 
a port forward. See ${link}here${/link} for some more information.
+IPDetectorPluginManager.forwardPortShortMaybeForwarded=Please forward UDP port 
${port} (you may have already done this).
+IPDetectorPluginManager.forwardPortShortNotForwarded=Please forward UDP port 
${port} (it appears not to be forwarded).
+IPDetectorPluginManager.forwardTwoPortsShortMaybeForwarded=Please forward UDP 
ports ${port1} and ${port2} (you may have already done this).
+IPDetectorPluginManager.forwardTwoPortsShortNotForwarded=Please forward UDP 
ports ${port1} and ${port2} (they appears not to be forwarded).
+IPDetectorPluginManager.forwardPortMaybeForwarded=Your node appears to be 
behind some sort of NAT (see the connectivity page for details). You should 
forward UDP (not TCP) port ${port} if possible to improve connectivity. It is 
possible you have already done this; it takes a while for Freenet to detect a 
port forward. See ${link}here${/link} for some more information.
+IPDetectorPluginManager.forwardPortNotForwarded=Your node appears to be behind 
some sort of NAT (see the connectivity page for details). You should forward 
UDP (not TCP) port ${port} if possible to improve connectivity. It appears that 
the port has not been forwarded, although Freenet cannot be sure. See 
${link}here${/link} for some more information.
+IPDetectorPluginManager.maybeAlreadyForwarded=You may have already done this 
(it is hard for Freenet to detect).
+IPDetectorPluginManager.forwardTwoPortsMaybeForwarded=Your node appears to be 
behind some sort of NAT (see the connectivity page for details). You should 
forward UDP (not TCP) ports ${port1} and ${port2} if possible to improve 
connectivity. It is possible you have already done this; it takes a while for 
Freenet to detect a port forward. See ${link}here${/link} for some more 
information.
+IPDetectorPluginManager.forwardTwoPortsNotForwarded=Your node appears to be 
behind some sort of NAT (see the connectivity page for details). You should 
forward UDP (not TCP) ports ${port1} and ${port2} if possible to improve 
connectivity. It appears that the ports have not been forwarded, although 
Freenet cannot be sure. See ${link}here${/link} for some more information.
 
IPDetectorPluginManager.portForwardHelpURL=http://wiki.freenetproject.org/FirewallAndRouterIssues
 IPDetectorPluginManager.symmetricPS=Your node is behind a symmetric NAT, which 
is especially problematic, so if you don't forward the port(s), you may not be 
able to connect to most nodes!
 IPUndetectedUserAlert.detecting=Freenet is currently attempting to detect your 
external IP address. If this takes more than a few minutes there is something 
wrong...

Modified: trunk/freenet/src/freenet/node/IPDetectorPluginManager.java
===================================================================
--- trunk/freenet/src/freenet/node/IPDetectorPluginManager.java 2008-04-29 
19:05:35 UTC (rev 19619)
+++ trunk/freenet/src/freenet/node/IPDetectorPluginManager.java 2008-04-29 
19:15:48 UTC (rev 19620)
@@ -56,12 +56,17 @@
                public HTMLNode getHTMLText() {
                        HTMLNode div = new HTMLNode("div");
                        String url = 
GenericReadFilterCallback.escapeURL(HTMLEncoder.encode(l10n("portForwardHelpURL")));
+                       boolean maybeForwarded = true;
+                       for(int i=0;i<portsNotForwarded.length;i++) {
+                               if(portsNotForwarded[i] < 0) maybeForwarded = 
false;
+                       }
+                       String keySuffix = maybeForwarded ? "MaybeForwarded" : 
"NotForwarded";
                        if(portsNotForwarded.length == 1) {
-                               L10n.addL10nSubstitution(div, 
"IPDetectorPluginManager.forwardPort", 
+                               L10n.addL10nSubstitution(div, 
"IPDetectorPluginManager.forwardPort"+keySuffix, 
                                                new String[] { "port", "link", 
"/link" }, 
                                                new String[] { 
Integer.toString(Math.abs(portsNotForwarded[0])), "<a href=\""+url+"\">", 
"</a>" });
                        } else if(portsNotForwarded.length == 2) {
-                               L10n.addL10nSubstitution(div, 
"IPDetectorPluginManager.forwardTwoPorts", 
+                               L10n.addL10nSubstitution(div, 
"IPDetectorPluginManager.forwardTwoPorts"+keySuffix, 
                                                new String[] { "port1", 
"port2", "link", "/link" }, 
                                                new String[] { 
Integer.toString(Math.abs(portsNotForwarded[0])), 
Integer.toString(Math.abs(portsNotForwarded[1])), "<a href=\""+url+"\">", 
"</a>" });
                        } else {
@@ -92,10 +97,15 @@
                        String prefix = innerGetPriorityClass() == 
UserAlert.ERROR ?
                                        l10n("seriousConnectionProblems") : 
l10n("connectionProblems");
                        prefix += " ";
+                       boolean maybeForwarded = true;
+                       for(int i=0;i<portsNotForwarded.length;i++) {
+                               if(portsNotForwarded[i] < 0) maybeForwarded = 
false;
+                       }
+                       String keySuffix = maybeForwarded ? "MaybeForwarded" : 
"NotForwarded";
                        if(portsNotForwarded.length == 1) {
-                               return prefix + l10n("forwardPortShort", 
"port", Integer.toString(Math.abs(portsNotForwarded[0])));
+                               return prefix + 
l10n("forwardPortShort"+keySuffix, "port", 
Integer.toString(Math.abs(portsNotForwarded[0])));
                        } else if(portsNotForwarded.length == 2) {
-                               return prefix + l10n("forwardTwoPortsShort", 
new String[] { "port1", "port2" },
+                               return prefix + 
l10n("forwardTwoPortsShort"+keySuffix, new String[] { "port1", "port2" },
                                                new String[] { 
Integer.toString(Math.abs(portsNotForwarded[0])), 
Integer.toString(Math.abs(portsNotForwarded[1])) });
                        } else {
                                Logger.error(this, "Unknown number of ports to 
forward: "+portsNotForwarded.length);
@@ -105,11 +115,16 @@

                public String getText() {
                        String url = l10n("portForwardHelpURL");
+                       boolean maybeForwarded = true;
+                       for(int i=0;i<portsNotForwarded.length;i++) {
+                               if(portsNotForwarded[i] < 0) maybeForwarded = 
false;
+                       }
+                       String keySuffix = maybeForwarded ? "MaybeForwarded" : 
"NotForwarded";
                        if(portsNotForwarded.length == 1) {
-                               return l10n("forwardPort", new String[] { 
"port", "link", "/link" }, 
+                               return l10n("forwardPort"+keySuffix, new 
String[] { "port", "link", "/link" }, 
                                                new String[] { 
Integer.toString(Math.abs(portsNotForwarded[0])), "", " ("+url+")" });
                        } else if(portsNotForwarded.length == 2) {
-                               return l10n("forwardTwoPorts", new String[] { 
"port1", "port2", "link", "/link" },
+                               return l10n("forwardTwoPorts"+keySuffix, new 
String[] { "port1", "port2", "link", "/link" },
                                                new String[] { 
Integer.toString(Math.abs(portsNotForwarded[0])), 
Integer.toString(Math.abs(portsNotForwarded[1])), "", " ("+url+")" });
                        } else {
                                Logger.error(this, "Unknown number of ports to 
forward: "+portsNotForwarded.length);


Reply via email to