yes we can, by checking .lastModified() on the file with a timer, but why would we need it?
the only one we'd be interested in watching is the permissions-file, but that is changed as soon as someone logs on, so that's not needed.
*/
synchronized(groupLock) {
User user = getUser(username);
if (groupname == null) {
groupname = "default";
}
if (checkAvailability) {
if (leech) {
Group group = getGroup(groupname);
List<LeechEntry> l = leechers.getLeechersForGroup(groupname);
if (l.size() < group.getLeechSlots()) {
// we can add without a problem
leechers.addLeecher(new LeechEntry(username, groupname));
} else {
// we can't add
return false;
// we could have checked if the user was in the list, and returned true then, but it doesn't matter, so we just return false.
}
} else {
leechers.removeLeecher(new LeechEntry(username, groupname));
return true;
}
} else {
// this also implies that we are using the general or whole site 'group'
if (leech) {
leechers.addLeecher(new LeechEntry(username, groupname));
} else {
// remove the user from the leech users for the general group
leechers.removeLeecher(new LeechEntry(username, groupname));
}
}
user.setLeech(leechers.hasLeech(username));
leechers.save();
return true;
}
}