You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
2.0 KiB
55 lines
2.0 KiB
16 years ago
|
|
||
|
import java.io.File;
|
||
|
import java.util.List;
|
||
|
|
||
|
import de.anomic.data.listManager;
|
||
|
import de.anomic.http.httpRequestHeader;
|
||
|
import de.anomic.server.serverObjects;
|
||
|
import de.anomic.server.serverSwitch;
|
||
|
|
||
|
public class blacklists {
|
||
|
|
||
|
public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) {
|
||
|
final serverObjects prop = new serverObjects();
|
||
16 years ago
|
|
||
16 years ago
|
listManager.listsPath = new File(listManager.switchboard.getRootPath(),listManager.switchboard.getConfig("listManager.listsPath", "DATA/LISTS"));
|
||
|
final List<String> dirlist = listManager.getDirListing(listManager.listsPath);
|
||
|
int blacklistCount=0;
|
||
16 years ago
|
|
||
16 years ago
|
final String blackListName = (post == null) ? "" : post.get("listname", "");
|
||
16 years ago
|
|
||
|
List<String> list;
|
||
|
int count;
|
||
|
if (dirlist != null) {
|
||
|
for (String element : dirlist) {
|
||
16 years ago
|
if (blackListName.equals("") || element.equals(blackListName)) {
|
||
|
prop.putXML("lists_" + blacklistCount + "_name", element);
|
||
|
|
||
|
if (listManager.listSetContains("BlackLists.Shared", element)) {
|
||
16 years ago
|
|
||
16 years ago
|
list = listManager.getListArray(new File(listManager.listsPath, element));
|
||
16 years ago
|
|
||
16 years ago
|
count=0;
|
||
|
for (int j=0;j<list.size();++j){
|
||
|
final String nextEntry = list.get(j);
|
||
16 years ago
|
|
||
16 years ago
|
if (nextEntry.length() == 0) continue;
|
||
|
if (nextEntry.startsWith("#")) continue;
|
||
16 years ago
|
|
||
16 years ago
|
prop.putXML("lists_" + blacklistCount + "_items_" + count + "_item", nextEntry);
|
||
|
count++;
|
||
|
}
|
||
|
prop.put("lists_" + blacklistCount + "_items", count);
|
||
|
blacklistCount++;
|
||
16 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
prop.put("lists", blacklistCount);
|
||
|
|
||
|
// return rewrite properties
|
||
|
return prop;
|
||
|
}
|
||
|
|
||
|
}
|