From 066c47675194a5295a9861b1c9c289c44219a740 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 14 Sep 2014 18:03:56 +0200 Subject: [PATCH] Load avatar image correctly. --- .../java/net/pterodactylus/sone/core/ConfigurationSoneParser.java | 6 ++++++ src/main/java/net/pterodactylus/sone/core/Core.java | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) 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. */ -- 2.7.4