aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/connector/oc/OkapiClient.java
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-10-13 19:43:48 +0200
committerBananeweizen <bananeweizen@gmx.de>2013-10-13 19:43:48 +0200
commitd2f9b17a80008fba6e6c47ff47b8eaeb8702c4a2 (patch)
tree984f0977678478f49d3f7dc0ad1c9b1535519e06 /main/src/cgeo/geocaching/connector/oc/OkapiClient.java
parented2eceba1f6d06106e6289b0b5c3b9fbe45f4d41 (diff)
downloadcgeo-d2f9b17a80008fba6e6c47ff47b8eaeb8702c4a2.zip
cgeo-d2f9b17a80008fba6e6c47ff47b8eaeb8702c4a2.tar.gz
cgeo-d2f9b17a80008fba6e6c47ff47b8eaeb8702c4a2.tar.bz2
fix #3289: Filter for whereigo and letterbox shows all OC caches
Diffstat (limited to 'main/src/cgeo/geocaching/connector/oc/OkapiClient.java')
-rw-r--r--main/src/cgeo/geocaching/connector/oc/OkapiClient.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/connector/oc/OkapiClient.java b/main/src/cgeo/geocaching/connector/oc/OkapiClient.java
index 350b167..8d05e4b 100644
--- a/main/src/cgeo/geocaching/connector/oc/OkapiClient.java
+++ b/main/src/cgeo/geocaching/connector/oc/OkapiClient.java
@@ -171,6 +171,11 @@ final class OkapiClient {
}
private static List<Geocache> requestCaches(final OCApiConnector connector, final Parameters params, final Map<String, String> valueMap) {
+ // if a global type filter is set, and OKAPI does not know that type, then return an empty list instead of all caches
+ if (Settings.getCacheType() != CacheType.ALL && StringUtils.isBlank(getFilterFromType())) {
+ return Collections.emptyList();
+ }
+
addFilterParams(valueMap, connector);
params.add("search_params", new JSONObject(valueMap).toString());
addRetrieveParams(params, connector);
@@ -658,7 +663,7 @@ final class OkapiClient {
valueMap.put("found_status", "notfound_only");
}
if (Settings.getCacheType() != CacheType.ALL) {
- valueMap.put("type", getFilterFromType(Settings.getCacheType()));
+ valueMap.put("type", getFilterFromType());
}
}
@@ -668,8 +673,8 @@ final class OkapiClient {
params.add("wrap", "true");
}
- private static String getFilterFromType(final CacheType cacheType) {
- switch (cacheType) {
+ private static String getFilterFromType() {
+ switch (Settings.getCacheType()) {
case EVENT:
return "Event";
case MULTI: