forked from I2P_Developers/i2p.i2p
implement last-modified
This commit is contained in:
@ -221,7 +221,8 @@ public class NamingServiceBean extends AddressbookBean
|
||||
boolean changed = false;
|
||||
if (action.equals(_("Add")) || action.equals(_("Replace"))) {
|
||||
if(hostname != null && destination != null) {
|
||||
Destination oldDest = getNamingService().lookup(hostname, nsOptions, null);
|
||||
Properties outProperties= new Properties();
|
||||
Destination oldDest = getNamingService().lookup(hostname, nsOptions, outProperties);
|
||||
if (oldDest != null && destination.equals(oldDest.toBase64())) {
|
||||
message = _("Host name {0} is already in addressbook, unchanged.", hostname);
|
||||
} else if (oldDest != null && !action.equals(_("Replace"))) {
|
||||
@ -235,6 +236,10 @@ public class NamingServiceBean extends AddressbookBean
|
||||
} catch (IllegalArgumentException iae) {}
|
||||
}
|
||||
Destination dest = new Destination(destination);
|
||||
if (oldDest != null) {
|
||||
nsOptions.putAll(outProperties);
|
||||
nsOptions.setProperty("m", Long.toString(I2PAppContext.getGlobalContext().clock().now()));
|
||||
}
|
||||
nsOptions.setProperty("s", _("Manually added via SusiDNS"));
|
||||
boolean success = getNamingService().put(host, dest, nsOptions);
|
||||
if (success) {
|
||||
|
@ -408,7 +408,9 @@ public class BlockfileNamingService extends DummyNamingService {
|
||||
/**
|
||||
* @param options If non-null and contains the key "list", add to that list
|
||||
* (default "hosts.txt")
|
||||
* Use the key "s" for the source
|
||||
* Use the key "s" for the source.
|
||||
* Key "a" will be added with the current time, unless
|
||||
* "a" is present in options.
|
||||
*/
|
||||
@Override
|
||||
public boolean putIfAbsent(String hostname, Destination d, Properties options) {
|
||||
@ -419,6 +421,7 @@ public class BlockfileNamingService extends DummyNamingService {
|
||||
String key = hostname.toLowerCase();
|
||||
String listname = FALLBACK_LIST;
|
||||
Properties props = new Properties();
|
||||
props.setProperty(PROP_ADDED, Long.toString(_context.clock().now()));
|
||||
if (options != null) {
|
||||
props.putAll(options);
|
||||
String list = options.getProperty("list");
|
||||
@ -427,7 +430,6 @@ public class BlockfileNamingService extends DummyNamingService {
|
||||
props.remove("list");
|
||||
}
|
||||
}
|
||||
props.setProperty(PROP_ADDED, Long.toString(_context.clock().now()));
|
||||
synchronized(_bf) {
|
||||
if (_isClosed)
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user