From: David ‘Bombe’ Roden Date: Sun, 14 Sep 2014 16:03:56 +0000 (+0200) Subject: Load avatar image correctly. X-Git-Tag: 0.9-rc1^2~3^2~129 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=066c47675194a5295a9861b1c9c289c44219a740;p=Sone.git Load avatar image correctly. --- diff --git a/src/main/java/net/pterodactylus/sone/core/ConfigurationSoneParser.java b/src/main/java/net/pterodactylus/sone/core/ConfigurationSoneParser.java index 3d384c1..a29856b 100644 --- a/src/main/java/net/pterodactylus/sone/core/ConfigurationSoneParser.java +++ b/src/main/java/net/pterodactylus/sone/core/ConfigurationSoneParser.java @@ -37,6 +37,7 @@ public class ConfigurationSoneParser { private final String sonePrefix; private final Map albums = new HashMap(); private final List topLevelAlbums = new ArrayList(); + private final Map images = new HashMap(); public ConfigurationSoneParser(Configuration configuration, Sone sone) { this.configuration = configuration; @@ -270,9 +271,14 @@ public class ConfigurationSoneParser { .setHeight(height) .update(); album.addImage(image); + images.put(image.getId(), image); } } + public Map getImages() { + return images; + } + private boolean albumAttributesAreInvalid(String albumId, String key, String title, String description, Long creationTime, Integer width, Integer height) { diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 9a5d983..8c1aeed 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -1162,7 +1162,9 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, /* load avatar. */ String avatarId = configuration.getStringValue(sonePrefix + "/Profile/Avatar").getValue(null); if (avatarId != null) { - profile.setAvatar(getImage(avatarId, false)); + final Map images = + configurationSoneParser.getImages(); + profile.setAvatar(images.get(avatarId)); } /* load options. */