From bb7d0287d99aa76692c1be011e69af9eface5350 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Thu, 24 Feb 2011 15:45:18 +0000
Subject: [PATCH]     * i2psnark:       - Fix delete and remove buttons for
 Opera and w3m (thx xiake)       - Stop torrent if no valid trackers       -
 Fix war build dependencies

---
 apps/i2psnark/java/build.xml                         |  2 +-
 .../java/src/org/klomp/snark/TrackerClient.java      |  6 ++++--
 .../src/org/klomp/snark/web/I2PSnarkServlet.java     | 12 ++++++++----
 history.txt                                          |  6 ++++++
 router/java/src/net/i2p/router/RouterVersion.java    |  2 +-
 5 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/apps/i2psnark/java/build.xml b/apps/i2psnark/java/build.xml
index b05b7339a..f2df5bc71 100644
--- a/apps/i2psnark/java/build.xml
+++ b/apps/i2psnark/java/build.xml
@@ -86,7 +86,7 @@
     
     <target name="warUpToDate">
         <uptodate property="war.uptodate" targetfile="../i2psnark.war" >
-            <srcfiles dir= "." includes="build/obj/web/**/*.class ../_icons/* ../web.xml" />
+            <srcfiles dir= "." includes="build/obj/org/klomp/snark/web/*.class ../_icons/* ../web.xml" />
         </uptodate>
     </target>
     
diff --git a/apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java b/apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java
index ad4cdae39..85a39f748 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java
@@ -185,10 +185,12 @@ public class TrackerClient extends I2PAppThread
     }
 
     if (trackers.isEmpty()) {
-        // FIXME really need to get this message to the gui
         stop = true;
-        _log.error("No valid trackers for infoHash: " + infoHash);
+        // FIXME translate
+        SnarkManager.instance().addMessage("No valid trackers for " + this.snark.getBaseName() + " - enable opentrackers?");
+        _log.error("No valid trackers for " + this.snark.getBaseName());
         // FIXME keep going if DHT enabled
+        this.snark.stopTorrent();
         return;
     }
 
diff --git a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
index 77207ec08..92a82de3e 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
@@ -348,8 +348,9 @@ public class I2PSnarkServlet extends Default {
         out.write("</th>\n<th align=\"center\">");
 
         // Opera and text-mode browsers: no &thinsp; and no input type=image values submitted
+        // Using a unique name fixes Opera, except for the buttons with js confirms, see below
         String ua = req.getHeader("User-Agent");
-        boolean isDegraded = ua != null && (ua.startsWith("Lynx") ||
+        boolean isDegraded = ua != null && (ua.startsWith("Lynx") || ua.startsWith("w3m") ||
                                             ua.startsWith("ELinks") || ua.startsWith("Dillo"));
 
         boolean noThinsp = isDegraded || ua.startsWith("Opera");
@@ -960,7 +961,8 @@ public class I2PSnarkServlet extends Default {
             if (isDegraded)
                 out.write("</a>");
         } else {
-                if (isDegraded)
+                // This works in Opera but it's displayed a little differently, so use noThinsp here too so all 3 icons are consistent
+                if (noThinsp)
                     out.write("<a href=\"/i2psnark/?action=Start_" + b64 + "&amp;nonce=" + _nonce + "\"><img title=\"");
                 else
                     out.write("<input type=\"image\" name=\"action_Start_" + b64 + "\" value=\"foo\" title=\"");
@@ -972,7 +974,8 @@ public class I2PSnarkServlet extends Default {
                     out.write("</a>");
 
             if (isValid) {
-                if (isDegraded)
+                // Doesnt work with Opera so use noThinsp instead of isDegraded
+                if (noThinsp)
                     out.write("<a href=\"/i2psnark/?action=Remove_" + b64 + "&amp;nonce=" + _nonce + "\"><img title=\"");
                 else
                     out.write("<input type=\"image\" name=\"action\" value=\"Remove_" + b64 + "\" title=\"");
@@ -990,7 +993,8 @@ public class I2PSnarkServlet extends Default {
                     out.write("</a>");
             }
 
-            if (isDegraded)
+            // Doesnt work with Opera so use noThinsp instead of isDegraded
+            if (noThinsp)
                 out.write("<a href=\"/i2psnark/?action=Delete_" + b64 + "&amp;nonce=" + _nonce + "\"><img title=\"");
             else
                 out.write("<input type=\"image\" name=\"action_Delete_" + b64 + "\" value=\"foo\" title=\"");
diff --git a/history.txt b/history.txt
index 03891b8fc..cb0b395ff 100644
--- a/history.txt
+++ b/history.txt
@@ -1,3 +1,9 @@
+2011-02-24 zzz
+    * i2psnark:
+      - Fix delete and remove buttons for Opera and w3m
+      - Stop torrent if no valid trackers
+      - Fix war build dependencies
+
 2011-02-23 zzz
     * BuildHandler:
       - Lower participating throttler max limit
diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java
index 987fc2f75..78754ef28 100644
--- a/router/java/src/net/i2p/router/RouterVersion.java
+++ b/router/java/src/net/i2p/router/RouterVersion.java
@@ -18,7 +18,7 @@ public class RouterVersion {
     /** deprecated */
     public final static String ID = "Monotone";
     public final static String VERSION = CoreVersion.VERSION;
-    public final static long BUILD = 19;
+    public final static long BUILD = 20;
 
     /** for example "-test" */
     public final static String EXTRA = "-rc";
-- 
GitLab