From 2738d834b450e1c0bfd2756ea2ab1900cc3aae59 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Tue, 1 Jul 2014 13:31:14 +0200 Subject: fixed #216 --- src/eu/siacs/conversations/services/XmppConnectionService.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/eu') diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 64acc3ea..3db52753 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -1,11 +1,14 @@ package eu.siacs.conversations.services; import java.security.SecureRandom; +import java.text.SimpleDateFormat; import java.util.Collections; import java.util.Comparator; +import java.util.Date; import java.util.Hashtable; import java.util.List; import java.util.Locale; +import java.util.TimeZone; import org.openintents.openpgp.util.OpenPgpApi; import org.openintents.openpgp.util.OpenPgpServiceConnection; @@ -1082,9 +1085,10 @@ public class XmppConnectionService extends Service { packet.addChild("x", "jabber:x:signed").setContent(sig); } if (conversation.getMessages().size() != 0) { - long lastMsgTime = conversation.getLatestMessage().getTimeSent(); - long diff = (System.currentTimeMillis() - lastMsgTime) / 1000 - 1; - x.addChild("history").setAttribute("seconds", diff + ""); + final SimpleDateFormat mDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",Locale.US); + mDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + Date date = new Date(conversation.getLatestMessage().getTimeSent() + 1000); + x.addChild("history").setAttribute("since",mDateFormat.format(date)); } packet.addChild(x); account.getXmppConnection().sendPresencePacket(packet); -- cgit v1.2.3