From 685be6a668a5ad675760d0d1b25e1bf945dadbfb Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 14 Oct 2010 14:03:43 +0200 Subject: [PATCH] Save replies on stopping. --- src/main/java/net/pterodactylus/sone/core/Core.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 932f3e7..d906055 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -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); -- 2.7.4