From: David ‘Bombe’ Roden Date: Wed, 7 Dec 2011 06:22:39 +0000 (+0100) Subject: Parse avatar ID from downloaded Sone. X-Git-Tag: 0.7.6^2~1^2~15 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=490ee2861e0b125667a14845f0f04fe56809c2e3;p=Sone.git Parse avatar ID from downloaded Sone. --- 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) {