aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsudev <rasch@munin-soft.de>2013-02-14 23:19:53 +0100
committerrsudev <rasch@munin-soft.de>2013-02-14 23:19:53 +0100
commit474e5318cde73b85cc8cbbbe025cff270d79d325 (patch)
tree2b8fe89c9e112171d87374cc8f9f37b45b27dcf5
parent0dbe6e3f884a1e4a5008fd97e8a91422bdf1f4a7 (diff)
downloadcgeo-474e5318cde73b85cc8cbbbe025cff270d79d325.zip
cgeo-474e5318cde73b85cc8cbbbe025cff270d79d325.tar.gz
cgeo-474e5318cde73b85cc8cbbbe025cff270d79d325.tar.bz2
Fixes #2441, sets oc userid as OwnerUserId
-rw-r--r--main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java15
-rw-r--r--main/src/cgeo/geocaching/connector/oc/OCXMLApiConnector.java2
-rw-r--r--tests/src/cgeo/geocaching/connector/opencaching/OCXMLTest.java1
3 files changed, 15 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java b/main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java
index e44b0a5..3c2a826 100644
--- a/main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java
+++ b/main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java
@@ -405,12 +405,23 @@ public class OC11XMLParser {
});
// cache.userid
- cacheNode.getChild("userid").setEndTextElementListener(new EndTextElementListener() {
+ final Element useridNode = cacheNode.getChild("userid");
+
+ useridNode.setStartElementListener(new StartElementListener() {
+
+ @Override
+ public void start(Attributes attributes) {
+ if (attributes.getIndex("id") > -1) {
+ cacheHolder.cache.setOwnerUserId(attributes.getValue("id"));
+ }
+ }
+ });
+
+ useridNode.setEndTextElementListener(new EndTextElementListener() {
@Override
public void end(String body) {
cacheHolder.cache.setOwnerDisplayName(body);
- cacheHolder.cache.setOwnerUserId(body);
}
});
diff --git a/main/src/cgeo/geocaching/connector/oc/OCXMLApiConnector.java b/main/src/cgeo/geocaching/connector/oc/OCXMLApiConnector.java
index d361a7e..678654f 100644
--- a/main/src/cgeo/geocaching/connector/oc/OCXMLApiConnector.java
+++ b/main/src/cgeo/geocaching/connector/oc/OCXMLApiConnector.java
@@ -54,7 +54,7 @@ public class OCXMLApiConnector extends OCConnector implements ISearchByGeocode,
@Override
public boolean isOwner(ICache cache) {
- return StringUtils.equalsIgnoreCase(cache.getOwnerUserId(), Settings.getOCConnectorUserName());
+ return StringUtils.equalsIgnoreCase(cache.getOwnerDisplayName(), Settings.getOCConnectorUserName());
}
}
diff --git a/tests/src/cgeo/geocaching/connector/opencaching/OCXMLTest.java b/tests/src/cgeo/geocaching/connector/opencaching/OCXMLTest.java
index 92c2063..52e5649 100644
--- a/tests/src/cgeo/geocaching/connector/opencaching/OCXMLTest.java
+++ b/tests/src/cgeo/geocaching/connector/opencaching/OCXMLTest.java
@@ -44,6 +44,7 @@ public class OCXMLTest extends CGeoTestCase {
assertNotNull(cache);
assertTrue(cache.isOwner());
+ assertEquals("180571", cache.getOwnerUserId());
} finally {
Settings.setOCConnectorUserName(oldOCName);
}