diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2011-09-20 21:51:07 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2011-09-20 21:51:07 +0200 |
| commit | b3da6401d9b51c9526c821b0e0907c63f4fddc67 (patch) | |
| tree | b216bc06fdb53a789470973649487115e55ff7b2 /main/src/cgeo/geocaching/cgBase.java | |
| parent | 383e20e40cb6c22d9fc124386abf3d9f83972a66 (diff) | |
| download | cgeo-b3da6401d9b51c9526c821b0e0907c63f4fddc67.zip cgeo-b3da6401d9b51c9526c821b0e0907c63f4fddc67.tar.gz cgeo-b3da6401d9b51c9526c821b0e0907c63f4fddc67.tar.bz2 | |
initial support of OpenCaching.DE/.PL/.US
* search for geocode can fetch online from those sites (but no other
search method!) when testing, search for codes like OU0001, OP0001,
OC0001.
* show CC license for those caches
* disable user actions, disable caches around for non GC caches
open issues:
* other search methods not yet implemented (but available in API)
* CC license and mentioning of the OpenCaching network in about dialog
Diffstat (limited to 'main/src/cgeo/geocaching/cgBase.java')
| -rw-r--r-- | main/src/cgeo/geocaching/cgBase.java | 67 |
1 files changed, 2 insertions, 65 deletions
diff --git a/main/src/cgeo/geocaching/cgBase.java b/main/src/cgeo/geocaching/cgBase.java index 1e9eb7a..edccd2c 100644 --- a/main/src/cgeo/geocaching/cgBase.java +++ b/main/src/cgeo/geocaching/cgBase.java @@ -1,6 +1,7 @@ package cgeo.geocaching; import cgeo.geocaching.activity.ActivityMixin; +import cgeo.geocaching.connector.ConnectorFactory; import cgeo.geocaching.enumerations.CacheSize; import cgeo.geocaching.enumerations.CacheType; import cgeo.geocaching.enumerations.WaypointType; @@ -2583,71 +2584,7 @@ public class cgBase { return search.getCurrentId(); } - final String host = "www.geocaching.com"; - final String path = "/seek/cache_details.aspx"; - final String method = "GET"; - final Map<String, String> params = new HashMap<String, String>(); - if (StringUtils.isNotBlank(geocode)) { - params.put("wp", geocode); - } else if (StringUtils.isNotBlank(guid)) { - params.put("guid", guid); - } - params.put("decrypt", "y"); - - String page = requestLogged(false, host, path, method, params, false, false, false); - - if (StringUtils.isEmpty(page)) { - if (app.isThere(geocode, guid, true, false)) { - if (StringUtils.isBlank(geocode) && StringUtils.isNotBlank(guid)) { - Log.i(cgSettings.tag, "Loading old cache from cache."); - - geocode = app.getGeocode(guid); - } - - final List<cgCache> cacheList = new ArrayList<cgCache>(); - cacheList.add(app.getCacheByGeocode(geocode)); - search.addGeocode(geocode); - search.error = null; - - app.addSearch(search, cacheList, false, reason); - - cacheList.clear(); - - return search.getCurrentId(); - } - - Log.e(cgSettings.tag, "cgeoBase.searchByGeocode: No data from server"); - return null; - } - - final cgCacheWrap caches = parseCache(page, reason); - if (caches == null || caches.cacheList == null || caches.cacheList.isEmpty()) { - if (caches != null && StringUtils.isNotBlank(caches.error)) { - search.error = caches.error; - } - if (caches != null && StringUtils.isNotBlank(caches.url)) { - search.url = caches.url; - } - - app.addSearch(search, null, true, reason); - - Log.e(cgSettings.tag, "cgeoBase.searchByGeocode: No cache parsed"); - return null; - } - - if (app == null) { - Log.e(cgSettings.tag, "cgeoBase.searchByGeocode: No application found"); - return null; - } - - List<cgCache> cacheList = processSearchResults(search, caches, 0, 0, null); - - app.addSearch(search, cacheList, true, reason); - - page = null; - cacheList.clear(); - - return search.getCurrentId(); + return ConnectorFactory.getConnector(geocode).searchByGeocode(this, geocode, guid, app, search, reason); } public UUID searchByOffline(Map<String, Object> parameters) { |
