Load avatar image correctly.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 14 Sep 2014 16:03:56 +0000 (18:03 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 14 Sep 2014 16:03:56 +0000 (18:03 +0200)
src/main/java/net/pterodactylus/sone/core/ConfigurationSoneParser.java
src/main/java/net/pterodactylus/sone/core/Core.java

index 3d384c1..a29856b 100644 (file)
@@ -37,6 +37,7 @@ public class ConfigurationSoneParser {
        private final String sonePrefix;
        private final Map<String, Album> albums = new HashMap<String, Album>();
        private final List<Album> topLevelAlbums = new ArrayList<Album>();
+       private final Map<String, Image> images = new HashMap<String, Image>();
 
        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<String, Image> getImages() {
+               return images;
+       }
+
        private boolean albumAttributesAreInvalid(String albumId, String key,
                        String title, String description, Long creationTime,
                        Integer width, Integer height) {
index 9a5d983..8c1aeed 100644 (file)
@@ -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<String, Image> images =
+                                       configurationSoneParser.getImages();
+                       profile.setAvatar(images.get(avatarId));
                }
 
                /* load options. */