From 1a85bd54e7a3d4e5bf7ad28269416fcc92563565 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 10 Mar 2015 19:19:20 +0100 Subject: [PATCH] Also replace IPv6 announce server address with domain (fixes #231). --- .../syncthingandroid/util/ConfigXml.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java b/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java index b9683b05..0c30f50e 100644 --- a/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java +++ b/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java @@ -129,12 +129,19 @@ public class ConfigXml { } // Hardcode default globalAnnounceServer ip. - Element globalAnnounceServer = (Element) - options.getElementsByTagName("globalAnnounceServer").item(0); - if (globalAnnounceServer.getTextContent().equals("udp4://announce.syncthing.net:22026")) { - Log.i(TAG, "Replacing globalAnnounceServer host with ip"); - globalAnnounceServer.setTextContent("udp4://194.126.249.5:22026"); - changed = true; + NodeList globalAnnounceServer = options.getElementsByTagName("globalAnnounceServer"); + for (int i = 0; i < globalAnnounceServer.getLength(); i++) { + Element g = (Element) globalAnnounceServer.item(i); + if (g.getTextContent().equals("udp4://announce.syncthing.net:22026")) { + Log.i(TAG, "Replacing globalAnnounceServer address with ip"); + g.setTextContent("udp4://194.126.249.5:22026"); + changed = true; + } + if (g.getTextContent().equals("udp6://announce-v6.syncthing.net:22026")) { + Log.i(TAG, "Replacing IPv6 globalAnnounceServer address with ip"); + g.setTextContent("udp6://[2001:470:28:4d6::5]:22026"); + changed = true; + } } NodeList folders = mConfig.getDocumentElement().getElementsByTagName("folder");