aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/xmpp/time/TimePacketGenerator.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/xmpp/time/TimePacketGenerator.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/xmpp/time/TimePacketGenerator.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/time/TimePacketGenerator.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/time/TimePacketGenerator.java
new file mode 100644
index 00000000..344beb9e
--- /dev/null
+++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/time/TimePacketGenerator.java
@@ -0,0 +1,38 @@
+package de.thedevstack.conversationsplus.xmpp.time;
+
+import de.thedevstack.conversationsplus.xmpp.iqversion.IqVersionPacket;
+import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket;
+
+/**
+ * Generates the IQ Packets for Entity Time
+ * as defined in XEP-0202.
+ * @see <a href="http://xmpp.org/extensions/xep-0202.html">http://xmpp.org/extensions/xep-0202.html</a>
+ */
+public final class TimePacketGenerator {
+
+ /**
+ * Generates the IqPacket to reply the entity time.
+ * <pre>
+ * <iq type='result'
+ * from='juliet@capulet.com/balcony'
+ * to='romeo@montague.net/orchard'
+ * id='time_1'>
+ * <time xmlns='urn:xmpp:time'>
+ * <tzo>-06:00</tzo>
+ * <utc>2006-12-19T17:58:35Z</utc>
+ * </time>
+ * </iq>
+ * </pre>
+ * @param packet
+ * @return
+ */
+ public static TimePacket generateResponse(IqPacket packet) {
+ TimePacket timePacket = new TimePacket();
+ timePacket.setTo(packet.getFrom());
+ timePacket.setId(packet.getId());
+
+ return timePacket;
+ }
+
+ private TimePacketGenerator() {}
+}