summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Young <consult.awy@gmail.com>2014-11-13 06:42:37 (GMT)
committerAlan Young <consult.awy@gmail.com>2015-04-10 06:50:58 (GMT)
commit7d2101b93b6253c3ea15b663f7f3dc385cb21364 (patch)
treed81338baf0d117e83cdc07f882cbedd9471e834d /src/com/isode/stroke/elements/Stanza.java
parenta20ca7ba40d837abe228462be0aba5d32d6831e3 (diff)
downloadstroke-7d2101b93b6253c3ea15b663f7f3dc385cb21364.zip
stroke-7d2101b93b6253c3ea15b663f7f3dc385cb21364.tar.bz2
Checkpoint - A bunch of initial stuff for Android
MemoryStorages, Storages NickManager, NickResolver CryptoProvider, Hash, SafeByteArray, JavaCryptoProvider CapsInfoGenerator, CapsManager, CapsMemoryStorage, CapsProvider, CapsStorage, CapsInfo CapsInfoSerializer, CapsInfoParser ClientDiscoManager, DiscoInfoResponder, EntityCapsManager, EntityCapsProvider GetDiscoInfoRequest ChatState, Idle Presence, PayloadAddingPresenceSender, PresenceOracle, SubscriptionManager StatusSerializer, StatusShowSerializer, StatusParser, StatusShowParser, Replace, ReplaceParser, ReplaceSerializer SecurityLabel, SecurityLabelsCatalog, GetSecurityLabelsCatalogRequest VCard, GetVCardRequest, SetVCardRequest, VCardManager, VCardMemoryStorage, VCardStorage RosterMemoryStorage, RosterPushResponder, RosterStorage, SetRosterRequest XMPPRoster, XMPPRosterController, XMPPRosterImpl, XMPPRosterItem GetRosterRequest, SetResponder Add parsers and serializers for Idle, VCard, PrivateStorage & Stroage. Add parser for Subject. Add impromptu flag to MUCInvitation. Update copyrights. Change-Id: I9949f506b70e60b3a64f1dadde8f9b235b322e1d
Diffstat (limited to 'src/com/isode/stroke/elements/Stanza.java')
-rw-r--r--src/com/isode/stroke/elements/Stanza.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/com/isode/stroke/elements/Stanza.java b/src/com/isode/stroke/elements/Stanza.java
index c542e8b..9a4b907 100644
--- a/src/com/isode/stroke/elements/Stanza.java
+++ b/src/com/isode/stroke/elements/Stanza.java
@@ -1,15 +1,13 @@
/*
- * Copyright (c) 2010-2012, Isode Limited, London, England.
- * All rights reserved.
- */
-/*
- * Copyright (c) 2010, Remko Tronçon.
+ * Copyright (c) 2010-2015, Isode Limited, London, England.
* All rights reserved.
*/
package com.isode.stroke.elements;
import com.isode.stroke.jid.JID;
+
+import java.util.Date;
import java.util.Vector;
/**
@@ -48,7 +46,8 @@ public abstract class Stanza implements Element {
* @param type payload type object instance, not null
* @return payload of given type, can be null
*/
- public <T extends Payload> T getPayload(T type) {
+ @SuppressWarnings("unchecked")
+ public <T extends Payload> T getPayload(T type) {
for (Payload payload : payloads_) {
if (payload.getClass().isAssignableFrom(type.getClass())) {
return (T)payload;
@@ -63,7 +62,8 @@ public abstract class Stanza implements Element {
* @param type payload type object instance, not null
* @return list of payloads of given type, not null but can be empty
*/
- public <T extends Payload> Vector<T> getPayloads(T type) {
+ @SuppressWarnings("unchecked")
+ public <T extends Payload> Vector<T> getPayloads(T type) {
Vector<T> results = new Vector<T>();
for (Payload payload : payloads_) {
if (payload.getClass().isAssignableFrom(type.getClass())) {
@@ -168,4 +168,8 @@ public abstract class Stanza implements Element {
" id=\"" + id_ + "\"";
}
+ public Date getTimestamp() {
+ Delay delay = getPayload(new Delay());
+ return delay != null ? delay.getStamp() : null;
+ }
}