From: David ‘Bombe’ Roden Date: Sun, 14 Nov 2010 11:01:17 +0000 (+0100) Subject: Parse client information from downloaded Sones. X-Git-Tag: 0.3-RC1~92 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=5b54d9007b20d2cd8f52decdeb2baaf1445f33cb;p=Sone.git Parse client information from downloaded Sones. --- diff --git a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java index 7133797..42f6702 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java @@ -26,6 +26,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import net.pterodactylus.sone.core.Core.SoneStatus; +import net.pterodactylus.sone.data.Client; import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.Profile; import net.pterodactylus.sone.data.Reply; @@ -215,6 +216,17 @@ public class SoneDownloader extends AbstractService { return null; } + SimpleXML clientXml = soneXml.getNode("client"); + if (clientXml != null) { + String clientName = clientXml.getValue("name", null); + String clientVersion = clientXml.getValue("version", null); + if ((clientName == null) || (clientVersion == null)) { + logger.log(Level.WARNING, "Download Sone %s with client XML but missing name or version!", sone); + return null; + } + sone.setClient(new Client(clientName, clientVersion)); + } + String soneRequestUri = soneXml.getValue("request-uri", null); if (soneRequestUri != null) { try {