From: David ‘Bombe’ Roden Date: Thu, 14 Oct 2010 12:03:43 +0000 (+0200) Subject: Save replies on stopping. X-Git-Tag: 0.1-RC1~394 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=685be6a668a5ad675760d0d1b25e1bf945dadbfb Save replies on stopping. --- 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);