diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-07-01 13:31:14 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-07-01 13:31:14 +0200 |
commit | 2738d834b450e1c0bfd2756ea2ab1900cc3aae59 (patch) | |
tree | e3d695ab0fe3d7df2893f85dd4943786b5db8597 /src/eu/siacs | |
parent | 4070c336056a3fefbbd7c19571557e2f1d908023 (diff) |
fixed #216
Diffstat (limited to 'src/eu/siacs')
-rw-r--r-- | src/eu/siacs/conversations/services/XmppConnectionService.java | 10 |
1 files changed, 7 insertions, 3 deletions
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); |