aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrsudev <rasch@munin-soft.de>2015-03-12 21:39:36 +0100
committerrsudev <rasch@munin-soft.de>2015-03-12 21:39:36 +0100
commit60d60ec338e5b889d0bb9bcd38a71d706a2f0016 (patch)
treeb976424f57463377dfb79aa210a86d1921c0992f /main
parente685f1a95cee461b38b4fe3a9d2ed261b552dbce (diff)
parent13a402c9134e1c27376edccfc5bb4830c317fcfb (diff)
downloadcgeo-60d60ec338e5b889d0bb9bcd38a71d706a2f0016.zip
cgeo-60d60ec338e5b889d0bb9bcd38a71d706a2f0016.tar.gz
cgeo-60d60ec338e5b889d0bb9bcd38a71d706a2f0016.tar.bz2
Merge branch 'release'
Diffstat (limited to 'main')
-rw-r--r--main/res/values/changelog_release.xml3
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCConstants.java1
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCParser.java24
3 files changed, 19 insertions, 9 deletions
diff --git a/main/res/values/changelog_release.xml b/main/res/values/changelog_release.xml
index a5603d2..df9cee0 100644
--- a/main/res/values/changelog_release.xml
+++ b/main/res/values/changelog_release.xml
@@ -3,7 +3,8 @@
<!-- changelog for the release branch -->
<string name="changelog_release" translatable="false">\n
<b>Next bugfix release</b>\n
- · Fix: Smilies in waypoints not shown\n
+ · Fix: Images from short description not shown in image gallery\n
+ · Fix: Smilies in waypoint descriptions not shown\n
\n
\n
<b>2015.02.23</b>\n
diff --git a/main/src/cgeo/geocaching/connector/gc/GCConstants.java b/main/src/cgeo/geocaching/connector/gc/GCConstants.java
index d56bebe..6e6c8b8 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCConstants.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCConstants.java
@@ -134,6 +134,7 @@ public final class GCConstants {
final static Pattern PATTERN_SEARCH_RECAPTCHA = Pattern.compile("<script[^>]*src=\"[^\"]*/recaptcha/api/challenge\\?k=([^\"]+)\"[^>]*>");
public final static Pattern PATTERN_SEARCH_RECAPTCHACHALLENGE = Pattern.compile("challenge : '([^']+)'");
final static Pattern PATTERN_SEARCH_HIDDEN_DATE = Pattern.compile("<td style=\"width:70px\">[^<]+<span class=\"small\">([^<]+)</span>");
+ final static Pattern PATTERN_SEARCH_POST_ACTION = Pattern.compile("<form name=\"aspnetForm\" method=\"post\" action=\"(.*)\" id=\"aspnetForm\"");
/**
* Patterns for waypoints
diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java
index bcc552b..d0a90bb 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCParser.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java
@@ -326,17 +326,25 @@ public abstract class GCParser {
params.put("recaptcha_challenge_field", recaptchaReceiver.getChallenge());
params.put("recaptcha_response_field", recaptchaText);
}
- params.put("ctl00$ContentBody$uxDownloadLoc", "Download Waypoints");
+ params.put("Download", "Download Waypoints");
- final String coordinates = Network.getResponseData(Network.postRequest("http://www.geocaching.com/seek/nearest.aspx", params), false);
+ // retrieve target url
+ final String queryUrl = TextUtils.getMatch(pageContent, GCConstants.PATTERN_SEARCH_POST_ACTION, "");
- if (StringUtils.contains(coordinates, "You have not agreed to the license agreement. The license agreement is required before you can start downloading GPX or LOC files from Geocaching.com")) {
- Log.i("User has not agreed to the license agreement. Can\'t download .loc file.");
- searchResult.setError(StatusCode.UNAPPROVED_LICENSE);
- return searchResult;
- }
+ if (StringUtils.isEmpty(queryUrl)) {
+ Log.w("Loc download url not found");
+ } else {
+
+ final String coordinates = Network.getResponseData(Network.postRequest("http://www.geocaching.com/seek/" + queryUrl, params), false);
- LocParser.parseLoc(searchResult, coordinates, storedCaches.toBlocking().single());
+ if (StringUtils.contains(coordinates, "You have not agreed to the license agreement. The license agreement is required before you can start downloading GPX or LOC files from Geocaching.com")) {
+ Log.i("User has not agreed to the license agreement. Can\'t download .loc file.");
+ searchResult.setError(StatusCode.UNAPPROVED_LICENSE);
+ return searchResult;
+ }
+
+ LocParser.parseLoc(searchResult, coordinates, storedCaches.toBlocking().single());
+ }
} catch (final RuntimeException e) {
Log.e("GCParser.parseSearch.CIDs", e);