Save friends.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 4 Nov 2010 21:42:57 +0000 (22:42 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 4 Nov 2010 21:42:57 +0000 (22:42 +0100)
src/main/java/net/pterodactylus/sone/core/Core.java

index 6cd6135..e44cf55 100644 (file)
@@ -644,6 +644,14 @@ public class Core implements IdentityListener {
                        }
                        configuration.getStringValue(sonePrefix + "/Likes/Reply/" + replyLikeCounter + "/ID").setValue(null);
 
+                       /* save friends. */
+                       int friendCounter = 0;
+                       for (Sone friend : sone.getFriends()) {
+                               configuration.getStringValue(sonePrefix + "/Friends/" + friendCounter + "/ID").setValue(friend.getId());
+                               configuration.getBooleanValue(sonePrefix + "/Friends/" + friendCounter++ + "/Local").setValue(friend.getInsertUri() != null);
+                       }
+                       configuration.getStringValue(sonePrefix + "/Friends/" + friendCounter + "/ID").setValue(null);
+
                        logger.log(Level.INFO, "Sone %s saved.", sone);
                } catch (ConfigurationException ce1) {
                        logger.log(Level.WARNING, "Could not save Sone: " + sone, ce1);