blob: 508aab470ae6d106258d9855ff7917189098f2cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
package cgeo.geocaching.connector.oc;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.Settings;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.connector.capability.ISearchByGeocode;
import cgeo.geocaching.network.Parameters;
import cgeo.geocaching.utils.CancellableHandler;
import cgeo.geocaching.utils.CryptUtils;
public class OCApiConnector extends OCConnector implements ISearchByGeocode {
private final String cK;
public OCApiConnector(String name, String host, String prefix, String cK) {
super(name, host, prefix);
this.cK = cK;
}
public void addAuthentication(final Parameters params) {
params.put(CryptUtils.rot13("pbafhzre_xrl"), CryptUtils.rot13(cK));
}
@Override
public String getLicenseText(final cgCache cache) {
// NOT TO BE TRANSLATED
return "<a href=\"" + getCacheUrl(cache) + "\">" + getName() + "</a> data licensed under the Creative Commons BY-SA 3.0 License";
}
@Override
public SearchResult searchByGeocode(final String geocode, final String guid, final CancellableHandler handler) {
final cgCache cache = OkapiClient.getCache(geocode);
if (cache == null) {
return null;
}
final SearchResult searchResult = new SearchResult(cache);
return searchResult.filterSearchResults(false, false, Settings.getCacheType());
}
}
|