From 490ee2861e0b125667a14845f0f04fe56809c2e3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 7 Dec 2011 07:22:39 +0100 Subject: [PATCH] Parse avatar ID from downloaded Sone. --- src/main/java/net/pterodactylus/sone/core/SoneDownloader.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java index b085ade..d8b924f 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java @@ -332,6 +332,8 @@ public class SoneDownloader extends AbstractService { Integer profileBirthYear = Numbers.safeParseInteger(profileXml.getValue("birth-year", null)); Profile profile = new Profile().setFirstName(profileFirstName).setMiddleName(profileMiddleName).setLastName(profileLastName); profile.setBirthDay(profileBirthDay).setBirthMonth(profileBirthMonth).setBirthYear(profileBirthYear); + /* avatar is processed after images are loaded. */ + String avatarId = profileXml.getValue("avatar", null); /* parse profile fields. */ SimpleXML profileFieldsXml = profileXml.getNode("fields"); @@ -495,6 +497,11 @@ public class SoneDownloader extends AbstractService { } } + /* process avatar. */ + if (avatarId != null) { + sone.setAvatar(core.getImage(avatarId, false)); + } + /* okay, apparently everything was parsed correctly. Now import. */ /* atomic setter operation on the Sone. */ synchronized (sone) { -- 2.7.4