From a892bb6f1685b84b74ba37e5a6a24ee8fb45eee7 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Mon, 7 Aug 2017 12:57:57 +0200 Subject: Simplifying introduction of new XEP implementations, implements FS#250 and FS#251 (Privacy and Security settings), refactoring of location of some interfaces --- .../conversationsplus/xmpp/time/TimePacket.java | 35 ---------------------- 1 file changed, 35 deletions(-) delete mode 100644 src/main/java/de/thedevstack/conversationsplus/xmpp/time/TimePacket.java (limited to 'src/main/java/de/thedevstack/conversationsplus/xmpp/time/TimePacket.java') diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/time/TimePacket.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/time/TimePacket.java deleted file mode 100644 index d8756d41..00000000 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/time/TimePacket.java +++ /dev/null @@ -1,35 +0,0 @@ -package de.thedevstack.conversationsplus.xmpp.time; - -import java.util.Locale; -import java.util.TimeZone; - -import de.thedevstack.conversationsplus.generator.AbstractGenerator; -import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; - -/** - * Representation of an software version packet as defined in XEP-0202. - * @see http://xmpp.org/extensions/xep-0202.html - */ -public class TimePacket extends IqPacket { - public static final String NAMESPACE = "urn:xmpp:time"; - - TimePacket() { - super(IqPacket.TYPE.RESULT); - Element time = this.addChild("time", NAMESPACE); - final long now = System.currentTimeMillis(); - time.addChild("utc").setContent(AbstractGenerator.getTimestamp(now)); - TimeZone ourTimezone = TimeZone.getDefault(); - long offsetSeconds = ourTimezone.getOffset(now) / 1000; - long offsetMinutes = Math.abs((offsetSeconds % 3600) / 60); - long offsetHours = offsetSeconds / 3600; - String hours; - if (offsetHours < 0) { - hours = String.format(Locale.US, "%03d", offsetHours); - } else { - hours = String.format(Locale.US, "%02d", offsetHours); - } - String minutes = String.format(Locale.US, "%02d", offsetMinutes); - time.addChild("tzo").setContent(hours + ":" + minutes); - } -} -- cgit v1.2.3