* i2psnark:

- Check for dup magnet torrent when adding torrent file
      - Add exotrack.i2p (ticket #403)
      - Disable spellcheck in textarea
This commit is contained in:
zzz
2011-02-07 19:27:55 +00:00
parent 86e663b2b4
commit 6c1f5dd5a9
5 changed files with 28 additions and 5 deletions

View File

@ -525,13 +525,13 @@ public class SnarkManager implements Snark.CompleteListener {
* Caller must verify this torrent is not already added.
* @throws RuntimeException via Snark.fatal()
*/
public void addTorrent(String filename) { addTorrent(filename, false); }
private void addTorrent(String filename) { addTorrent(filename, false); }
/**
* Caller must verify this torrent is not already added.
* @throws RuntimeException via Snark.fatal()
*/
public void addTorrent(String filename, boolean dontAutoStart) {
private void addTorrent(String filename, boolean dontAutoStart) {
if ((!dontAutoStart) && !_util.connected()) {
addMessage(_("Connecting to I2P"));
boolean ok = _util.connect();
@ -578,6 +578,15 @@ public class SnarkManager implements Snark.CompleteListener {
fis = null;
} catch (IOException e) {}
// This test may be a duplicate, but not if we were called
// from the DirMonitor, which only checks for dup torrent file names.
Snark snark = getTorrentByInfoHash(info.getInfoHash());
if (snark != null) {
// TODO - if the existing one is a magnet, delete it and add the metainfo instead?
addMessage(_("Torrent with this info hash is already running: {0}", snark.getBaseName()));
return;
}
if (!TrackerClient.isValidAnnounce(info.getAnnounce())) {
if (_util.shouldUseOpenTrackers() && _util.getOpenTrackers() != null) {
addMessage(_("Warning - No I2P trackers in \"{0}\", will announce to I2P open trackers and DHT only.", info.getName()));
@ -1180,6 +1189,9 @@ public class SnarkManager implements Snark.CompleteListener {
}
}
/**
* caller must synchronize on _snarks
*/
private void monitorTorrents(File dir) {
String fileNames[] = dir.list(TorrentFilenameFilter.instance());
List<String> foundNames = new ArrayList(0);
@ -1261,6 +1273,7 @@ public class SnarkManager implements Snark.CompleteListener {
"Postman", "http://tracker2.postman.i2p/announce.php=http://tracker2.postman.i2p/"
,"Welterde", "http://tracker.welterde.i2p/a=http://tracker.welterde.i2p/stats?mode=top5"
// , "CRSTRACK", "http://b4G9sCdtfvccMAXh~SaZrPqVQNyGQbhbYMbw6supq2XGzbjU4NcOmjFI0vxQ8w1L05twmkOvg5QERcX6Mi8NQrWnR0stLExu2LucUXg1aYjnggxIR8TIOGygZVIMV3STKH4UQXD--wz0BUrqaLxPhrm2Eh9Hwc8TdB6Na4ShQUq5Xm8D4elzNUVdpM~RtChEyJWuQvoGAHY3ppX-EJJLkiSr1t77neS4Lc-KofMVmgI9a2tSSpNAagBiNI6Ak9L1T0F9uxeDfEG9bBSQPNMOSUbAoEcNxtt7xOW~cNOAyMyGydwPMnrQ5kIYPY8Pd3XudEko970vE0D6gO19yoBMJpKx6Dh50DGgybLQ9CpRaynh2zPULTHxm8rneOGRcQo8D3mE7FQ92m54~SvfjXjD2TwAVGI~ae~n9HDxt8uxOecAAvjjJ3TD4XM63Q9TmB38RmGNzNLDBQMEmJFpqQU8YeuhnS54IVdUoVQFqui5SfDeLXlSkh4vYoMU66pvBfWbAAAA.i2p/tracker/announce.php=http://crstrack.i2p/tracker/"
,"Exotrack", "http://blbgywsjubw3d2zih2giokakhe3o2cko7jtte4risb3hohbcoyva.b32.i2p/announce.php=http://exotrack.i2p/"
};
/** comma delimited list of name=announceURL=baseURL for the trackers to be displayed */