Save replies on stopping.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 14 Oct 2010 12:03:43 +0000 (14:03 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 14 Oct 2010 12:03:43 +0000 (14:03 +0200)
src/main/java/net/pterodactylus/sone/core/Core.java

index 932f3e7..d906055 100644 (file)
@@ -30,6 +30,7 @@ import java.util.logging.Logger;
 import net.pterodactylus.sone.core.SoneException.Type;
 import net.pterodactylus.sone.data.Post;
 import net.pterodactylus.sone.data.Profile;
+import net.pterodactylus.sone.data.Reply;
 import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.util.config.Configuration;
 import net.pterodactylus.util.config.ConfigurationException;
@@ -299,6 +300,15 @@ public class Core extends AbstractService {
                                        configuration.getLongValue(postPrefix + "/Time").setValue(post.getTime());
                                        configuration.getStringValue(postPrefix + "/Text").setValue(post.getText());
                                }
+                               int replyId = 0;
+                               for (Reply reply : sone.getReplies()) {
+                                       String replyPrefix = sonePrefix + "/Reply." + replyId++;
+                                       configuration.getStringValue(replyPrefix + "/ID").setValue(reply.getId());
+                                       configuration.getStringValue(replyPrefix + "/Sone").setValue(reply.getSone().getId());
+                                       configuration.getStringValue(replyPrefix + "/Post").setValue(reply.getPost().getId());
+                                       configuration.getLongValue(replyPrefix + "/Time").setValue(reply.getTime());
+                                       configuration.getStringValue(replyPrefix + "/Text").setValue(reply.getText());
+                               }
                        }
                } catch (ConfigurationException ce1) {
                        logger.log(Level.WARNING, "Could not store configuration!", ce1);