add a i2psnark StartAll button

This commit is contained in:
zzz
2008-03-05 14:20:02 +00:00
parent 71ddfa42e1
commit 0a9114fc2f

View File

@ -107,6 +107,9 @@ public class I2PSnarkServlet extends HttpServlet {
if (I2PSnarkUtil.instance().connected()) if (I2PSnarkUtil.instance().connected())
out.write("<a href=\"" + uri + "?action=StopAll&nonce=" + _nonce + out.write("<a href=\"" + uri + "?action=StopAll&nonce=" + _nonce +
"\" title=\"Stop all torrents and the i2p tunnel\">Stop All</a>"); "\" title=\"Stop all torrents and the i2p tunnel\">Stop All</a>");
else if (snarks.size() > 0)
out.write("<a href=\"" + uri + "?action=StartAll&nonce=" + _nonce +
"\" title=\"Start all torrents and the i2p tunnel\">Start All</a>");
else else
out.write("&nbsp;"); out.write("&nbsp;");
out.write("</th></tr></thead>\n"); out.write("</th></tr></thead>\n");
@ -338,6 +341,14 @@ public class I2PSnarkServlet extends HttpServlet {
I2PSnarkUtil.instance().disconnect(); I2PSnarkUtil.instance().disconnect();
_manager.addMessage("I2P tunnel closed"); _manager.addMessage("I2P tunnel closed");
} }
} else if ("StartAll".equals(action)) {
_manager.addMessage("Opening the I2P tunnel and starting all torrents");
List snarks = getSortedSnarks(req);
for (int i = 0; i < snarks.size(); i++) {
Snark snark = (Snark)snarks.get(i);
if (snark.stopped)
snark.startTorrent();
}
} }
} }