diff options
Diffstat (limited to 'src/com/isode')
3 files changed, 13 insertions, 10 deletions
diff --git a/src/com/isode/stroke/elements/Last.java b/src/com/isode/stroke/elements/Last.java index 8f12616..b2b2805 100644 --- a/src/com/isode/stroke/elements/Last.java +++ b/src/com/isode/stroke/elements/Last.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Isode Limited, London, England. + * Copyright (c) 2011-2013, Isode Limited, London, England. * All rights reserved. */ /* @@ -10,19 +10,19 @@ package com.isode.stroke.elements; public class Last extends Payload { - int seconds_; + Long seconds_; public Last() {} - public Last(final int seconds) { + public Last(final Long seconds) { setSeconds(seconds); } - public void setSeconds(final int seconds) { + public void setSeconds(final Long seconds) { seconds_ = seconds; } - public int getSeconds() { + public Long getSeconds() { return seconds_; } } diff --git a/src/com/isode/stroke/parser/payloadparsers/LastParser.java b/src/com/isode/stroke/parser/payloadparsers/LastParser.java index d2c2a82..62a7636 100644 --- a/src/com/isode/stroke/parser/payloadparsers/LastParser.java +++ b/src/com/isode/stroke/parser/payloadparsers/LastParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Isode Limited, London, England. + * Copyright (c) 2011-2013, Isode Limited, London, England. * All rights reserved. */ /* @@ -23,10 +23,10 @@ public class LastParser extends GenericPayloadParser<Last> { public void handleStartElement(String element, String ns, AttributeMap attributes) { if (level_ == 0) { - int seconds = 0; + Long seconds = null; try { - seconds = Integer.parseInt(attributes.getAttribute("seconds")); + seconds = Long.parseLong(attributes.getAttribute("seconds")); } catch (NumberFormatException ex) { } diff --git a/src/com/isode/stroke/serializer/payloadserializers/LastSerializer.java b/src/com/isode/stroke/serializer/payloadserializers/LastSerializer.java index e78a724..8eff41a 100644 --- a/src/com/isode/stroke/serializer/payloadserializers/LastSerializer.java +++ b/src/com/isode/stroke/serializer/payloadserializers/LastSerializer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Isode Limited, London, England. + * Copyright (c) 2011-2013 Isode Limited, London, England. * All rights reserved. */ /* @@ -19,6 +19,9 @@ public class LastSerializer extends GenericPayloadSerializer<Last> { @Override protected String serializePayload(Last last) { - return "<query xmlns='jabber:iq:last' seconds='" + Integer.toString(last.getSeconds()) + "'/>"; + if(last.getSeconds() == null) { + return "<query xmlns='jabber:iq:last'/>"; + } + return "<query xmlns='jabber:iq:last' seconds='" + Long.toString(last.getSeconds()) + "'/>"; } } |