diff options
author | Tarun Gupta <tarun1995gupta@gmail.com> | 2015-06-26 08:20:59 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2015-07-06 13:52:48 (GMT) |
commit | fcdff3f162995170469833a82f607903e660812d (patch) | |
tree | e9d3cc18c8454b43ebdc1e9b9568d1f4456b59eb /src | |
parent | 79b532d8b6702a5599e7a3eac1416f562405668e (diff) | |
download | stroke-fcdff3f162995170469833a82f607903e660812d.zip stroke-fcdff3f162995170469833a82f607903e660812d.tar.bz2 |
Minor Fixes for Elements.
Adds Block Element, BlockList, and Unblock Element.
Updates some Elements just for consistency.
Updates Last Element, its Parser and Serializer for consistency with Swiften.
License:
This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Test-Information:
None.
Change-Id: If40c2516b944b1939db08721bb4de4554c3264f6
Diffstat (limited to 'src')
58 files changed, 259 insertions, 112 deletions
diff --git a/src/com/isode/stroke/elements/BlockListPayload.java b/src/com/isode/stroke/elements/BlockListPayload.java new file mode 100644 index 0000000..5c6904d --- /dev/null +++ b/src/com/isode/stroke/elements/BlockListPayload.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2011 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ +/* + * Copyright (c) 2015 Tarun Gupta. + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +package com.isode.stroke.elements; + +import com.isode.stroke.base.NotNull; +import com.isode.stroke.elements.Payload; +import com.isode.stroke.jid.JID; +import java.util.Vector; + +public class BlockListPayload extends Payload { + + Vector<JID> items = new Vector<JID>(); + + public BlockListPayload() { + + } + + /** + * Parameterized Constructor. + * @param items, Not NUll. + */ + public BlockListPayload(Vector<JID> items) { + NotNull.exceptIfNull(items, "items"); + this.items = items; + } + + /** + * @param item, NotNull. + */ + public void addItem(JID item) { + NotNull.exceptIfNull(item, "item"); + items.add(item); + } + + /** + * @return items, NotNull. + */ + public Vector<JID> getItems() { + return items; + } +}
\ No newline at end of file diff --git a/src/com/isode/stroke/elements/BlockPayload.java b/src/com/isode/stroke/elements/BlockPayload.java new file mode 100644 index 0000000..8ce8620 --- /dev/null +++ b/src/com/isode/stroke/elements/BlockPayload.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2011 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ +/* + * Copyright (c) 2015 Tarun Gupta. + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +package com.isode.stroke.elements; + +import com.isode.stroke.base.NotNull; +import com.isode.stroke.elements.Payload; +import com.isode.stroke.jid.JID; +import java.util.Vector; + +public class BlockPayload extends Payload { + + Vector<JID> items = new Vector<JID>(); + + public BlockPayload() { + + } + + /** + * Parameterized Constructor. + * @param items, Not NUll. + */ + public BlockPayload(Vector<JID> items) { + NotNull.exceptIfNull(items, "items"); + this.items = items; + } + + /** + * @param item, NotNull. + */ + public void addItem(JID item) { + NotNull.exceptIfNull(item, "item"); + items.add(item); + } + + /** + * @return items, NotNull. + */ + public Vector<JID> getItems() { + return items; + } +}
\ No newline at end of file diff --git a/src/com/isode/stroke/elements/Command.java b/src/com/isode/stroke/elements/Command.java index 91ce828..b9aedb8 100644 --- a/src/com/isode/stroke/elements/Command.java +++ b/src/com/isode/stroke/elements/Command.java @@ -261,8 +261,8 @@ public class Command extends Payload { public final Type type; }; - private String node_; - private String sessionID_; + private String node_ = ""; + private String sessionID_ = ""; private Action action_; private Status status_; private Action executeAction_; diff --git a/src/com/isode/stroke/elements/Last.java b/src/com/isode/stroke/elements/Last.java index b2b2805..e25994c 100644 --- a/src/com/isode/stroke/elements/Last.java +++ b/src/com/isode/stroke/elements/Last.java @@ -10,19 +10,19 @@ package com.isode.stroke.elements; public class Last extends Payload { - Long seconds_; + private int seconds_ = 0; public Last() {} - public Last(final Long seconds) { + public Last(final int seconds) { setSeconds(seconds); } - public void setSeconds(final Long seconds) { + public void setSeconds(final int seconds) { seconds_ = seconds; } - public Long getSeconds() { + public int getSeconds() { return seconds_; } } diff --git a/src/com/isode/stroke/elements/MAMResult.java b/src/com/isode/stroke/elements/MAMResult.java index aa83c88..d90fa35 100644 --- a/src/com/isode/stroke/elements/MAMResult.java +++ b/src/com/isode/stroke/elements/MAMResult.java @@ -27,6 +27,6 @@ public class MAMResult extends ContainerPayload<Forwarded> { return queryID_; } - private String id_; + private String id_ = ""; private String queryID_; } diff --git a/src/com/isode/stroke/elements/MUCDestroyPayload.java b/src/com/isode/stroke/elements/MUCDestroyPayload.java index 86e7fa1..62d17bc 100644 --- a/src/com/isode/stroke/elements/MUCDestroyPayload.java +++ b/src/com/isode/stroke/elements/MUCDestroyPayload.java @@ -16,7 +16,7 @@ import com.isode.stroke.jid.JID; */ public class MUCDestroyPayload extends Payload{ private JID newVenue_; - private String reason_; + private String reason_ = ""; /** * Create the Destroy payload diff --git a/src/com/isode/stroke/elements/MUCInvitationPayload.java b/src/com/isode/stroke/elements/MUCInvitationPayload.java index 464e5ff..cbe6e39 100644 --- a/src/com/isode/stroke/elements/MUCInvitationPayload.java +++ b/src/com/isode/stroke/elements/MUCInvitationPayload.java @@ -13,9 +13,9 @@ import com.isode.stroke.jid.JID; public class MUCInvitationPayload extends Payload { private boolean continuation_; private JID jid_; - private String password_; - private String reason_; - private String thread_; + private String password_ = ""; + private String reason_ = ""; + private String thread_ = ""; private boolean impromptu_; diff --git a/src/com/isode/stroke/elements/Message.java b/src/com/isode/stroke/elements/Message.java index 7760ff5..1bb601a 100644 --- a/src/com/isode/stroke/elements/Message.java +++ b/src/com/isode/stroke/elements/Message.java @@ -6,7 +6,7 @@ package com.isode.stroke.elements; public class Message extends Stanza { - Type type_ = Type.Chat; + private Type type_ = Type.Chat; public enum Type { diff --git a/src/com/isode/stroke/elements/Priority.java b/src/com/isode/stroke/elements/Priority.java index ea0f8b9..c6947ac 100644 --- a/src/com/isode/stroke/elements/Priority.java +++ b/src/com/isode/stroke/elements/Priority.java @@ -13,7 +13,7 @@ package com.isode.stroke.elements; * Resource priority from presence stanzas. */ public class Priority extends Payload { - int priority_ = 0; + private int priority_ = 0; public Priority(){ diff --git a/src/com/isode/stroke/elements/PubSubAffiliation.java b/src/com/isode/stroke/elements/PubSubAffiliation.java index f6f74de..a4d0ea7 100644 --- a/src/com/isode/stroke/elements/PubSubAffiliation.java +++ b/src/com/isode/stroke/elements/PubSubAffiliation.java @@ -41,7 +41,7 @@ public void setType(Type type) { type_ = type; } -String node_; -Type type_; +private String node_ = ""; +private Type type_; } diff --git a/src/com/isode/stroke/elements/PubSubAffiliations.java b/src/com/isode/stroke/elements/PubSubAffiliations.java index 883f078..caf4668 100644 --- a/src/com/isode/stroke/elements/PubSubAffiliations.java +++ b/src/com/isode/stroke/elements/PubSubAffiliations.java @@ -37,7 +37,7 @@ public void addAffiliation(PubSubAffiliation value) { affiliations_.add(value); } -String node_; -ArrayList<PubSubAffiliation> affiliations_ = new ArrayList<PubSubAffiliation>(); +private String node_; +private ArrayList<PubSubAffiliation> affiliations_ = new ArrayList<PubSubAffiliation>(); } diff --git a/src/com/isode/stroke/elements/PubSubConfigure.java b/src/com/isode/stroke/elements/PubSubConfigure.java index 2b54374..008dbff 100644 --- a/src/com/isode/stroke/elements/PubSubConfigure.java +++ b/src/com/isode/stroke/elements/PubSubConfigure.java @@ -25,6 +25,6 @@ public void setData(Form data) { data_ = data; } -Form data_; +private Form data_; } diff --git a/src/com/isode/stroke/elements/PubSubCreate.java b/src/com/isode/stroke/elements/PubSubCreate.java index e1ac6c0..d0973a7 100644 --- a/src/com/isode/stroke/elements/PubSubCreate.java +++ b/src/com/isode/stroke/elements/PubSubCreate.java @@ -32,7 +32,7 @@ public void setConfigure(PubSubConfigure configure) { configure_ = configure; } -String node_; -PubSubConfigure configure_; +private String node_ = ""; +private PubSubConfigure configure_; } diff --git a/src/com/isode/stroke/elements/PubSubDefault.java b/src/com/isode/stroke/elements/PubSubDefault.java index f5b075a..5ac1855 100644 --- a/src/com/isode/stroke/elements/PubSubDefault.java +++ b/src/com/isode/stroke/elements/PubSubDefault.java @@ -38,7 +38,7 @@ public void setType(Type type) { type_ = type; } -String node_; -Type type_; +private String node_; +private Type type_; } diff --git a/src/com/isode/stroke/elements/PubSubError.java b/src/com/isode/stroke/elements/PubSubError.java index cd6aadf..31c0ef9 100644 --- a/src/com/isode/stroke/elements/PubSubError.java +++ b/src/com/isode/stroke/elements/PubSubError.java @@ -103,6 +103,6 @@ public class PubSubError extends Payload { unsupportedType_ = unsupportedType; } - Type type_; - UnsupportedFeatureType unsupportedType_; + private Type type_; + private UnsupportedFeatureType unsupportedType_; } diff --git a/src/com/isode/stroke/elements/PubSubEventAssociate.java b/src/com/isode/stroke/elements/PubSubEventAssociate.java index 0ba4204..f78ea4a 100644 --- a/src/com/isode/stroke/elements/PubSubEventAssociate.java +++ b/src/com/isode/stroke/elements/PubSubEventAssociate.java @@ -24,6 +24,6 @@ public void setNode(String node) { node_ = node; } -String node_; +private String node_ = ""; } diff --git a/src/com/isode/stroke/elements/PubSubEventCollection.java b/src/com/isode/stroke/elements/PubSubEventCollection.java index 95a7119..544ad5c 100644 --- a/src/com/isode/stroke/elements/PubSubEventCollection.java +++ b/src/com/isode/stroke/elements/PubSubEventCollection.java @@ -40,8 +40,8 @@ public void setDisassociate(PubSubEventDisassociate disassociate) { disassociate_ = disassociate; } -PubSubEventAssociate associate_; -String node_; -PubSubEventDisassociate disassociate_; +private PubSubEventAssociate associate_; +private String node_; +private PubSubEventDisassociate disassociate_; } diff --git a/src/com/isode/stroke/elements/PubSubEventConfiguration.java b/src/com/isode/stroke/elements/PubSubEventConfiguration.java index 0d13daa..0e7c7f4 100644 --- a/src/com/isode/stroke/elements/PubSubEventConfiguration.java +++ b/src/com/isode/stroke/elements/PubSubEventConfiguration.java @@ -33,7 +33,7 @@ public void setNode(String node) { node_ = node; } -Form data_; -String node_; +private Form data_; +private String node_ = ""; } diff --git a/src/com/isode/stroke/elements/PubSubEventDelete.java b/src/com/isode/stroke/elements/PubSubEventDelete.java index 5c6418d..aac2163 100644 --- a/src/com/isode/stroke/elements/PubSubEventDelete.java +++ b/src/com/isode/stroke/elements/PubSubEventDelete.java @@ -32,7 +32,7 @@ public void setNode(String node) { node_ = node; } -PubSubEventRedirect redirects_; -String node_; +private PubSubEventRedirect redirects_; +private String node_ = ""; } diff --git a/src/com/isode/stroke/elements/PubSubEventDisassociate.java b/src/com/isode/stroke/elements/PubSubEventDisassociate.java index d6fcb97..1f79eeb 100644 --- a/src/com/isode/stroke/elements/PubSubEventDisassociate.java +++ b/src/com/isode/stroke/elements/PubSubEventDisassociate.java @@ -24,6 +24,6 @@ public void setNode(String node) { node_ = node; } -String node_; +private String node_ = ""; } diff --git a/src/com/isode/stroke/elements/PubSubEventItem.java b/src/com/isode/stroke/elements/PubSubEventItem.java index 2086106..ab2a23b 100644 --- a/src/com/isode/stroke/elements/PubSubEventItem.java +++ b/src/com/isode/stroke/elements/PubSubEventItem.java @@ -53,9 +53,9 @@ public void setID(String id) { id_ = id; } -String publisher_; -ArrayList<Payload> data_ = new ArrayList<Payload>(); -String node_; -String id_; +private String publisher_; +private ArrayList<Payload> data_ = new ArrayList<Payload>(); +private String node_; +private String id_; } diff --git a/src/com/isode/stroke/elements/PubSubEventItems.java b/src/com/isode/stroke/elements/PubSubEventItems.java index f4865ff..9d2bf22 100644 --- a/src/com/isode/stroke/elements/PubSubEventItems.java +++ b/src/com/isode/stroke/elements/PubSubEventItems.java @@ -49,8 +49,8 @@ public void addRetract(PubSubEventRetract value) { retracts_.add(value); } -ArrayList<PubSubEventItem> items_ = new ArrayList<PubSubEventItem>(); -String node_; -ArrayList<PubSubEventRetract> retracts_ = new ArrayList<PubSubEventRetract>(); +private ArrayList<PubSubEventItem> items_ = new ArrayList<PubSubEventItem>(); +private String node_ = ""; +private ArrayList<PubSubEventRetract> retracts_ = new ArrayList<PubSubEventRetract>(); } diff --git a/src/com/isode/stroke/elements/PubSubEventPurge.java b/src/com/isode/stroke/elements/PubSubEventPurge.java index 451ce09..94125df 100644 --- a/src/com/isode/stroke/elements/PubSubEventPurge.java +++ b/src/com/isode/stroke/elements/PubSubEventPurge.java @@ -24,6 +24,6 @@ public void setNode(String node) { node_ = node; } -String node_; +private String node_ = ""; } diff --git a/src/com/isode/stroke/elements/PubSubEventRedirect.java b/src/com/isode/stroke/elements/PubSubEventRedirect.java index 5f99b19..3378e5e 100644 --- a/src/com/isode/stroke/elements/PubSubEventRedirect.java +++ b/src/com/isode/stroke/elements/PubSubEventRedirect.java @@ -24,6 +24,6 @@ public void setURI(String uri) { uri_ = uri; } -String uri_; +private String uri_ = ""; } diff --git a/src/com/isode/stroke/elements/PubSubEventRetract.java b/src/com/isode/stroke/elements/PubSubEventRetract.java index 4eba5ca..7c37140 100644 --- a/src/com/isode/stroke/elements/PubSubEventRetract.java +++ b/src/com/isode/stroke/elements/PubSubEventRetract.java @@ -24,6 +24,6 @@ public void setID(String id) { id_ = id; } -String id_; +private String id_ = ""; } diff --git a/src/com/isode/stroke/elements/PubSubEventSubscription.java b/src/com/isode/stroke/elements/PubSubEventSubscription.java index 7864a65..332670a 100644 --- a/src/com/isode/stroke/elements/PubSubEventSubscription.java +++ b/src/com/isode/stroke/elements/PubSubEventSubscription.java @@ -65,10 +65,10 @@ public void setExpiry(Date expiry) { expiry_ = expiry; } -SubscriptionType subscription_; -String subscriptionID_; -String node_; -JID jid_; -Date expiry_; +private SubscriptionType subscription_; +private String subscriptionID_; +private String node_ = ""; +private JID jid_; +private Date expiry_; } diff --git a/src/com/isode/stroke/elements/PubSubItem.java b/src/com/isode/stroke/elements/PubSubItem.java index 91d0fe1..1562017 100644 --- a/src/com/isode/stroke/elements/PubSubItem.java +++ b/src/com/isode/stroke/elements/PubSubItem.java @@ -37,7 +37,7 @@ public void setID(String id) { id_ = id; } -ArrayList<Payload> data_ = new ArrayList<Payload>(); -String id_; +private ArrayList<Payload> data_ = new ArrayList<Payload>(); +private String id_; } diff --git a/src/com/isode/stroke/elements/PubSubItems.java b/src/com/isode/stroke/elements/PubSubItems.java index ae675e4..273b0e8 100644 --- a/src/com/isode/stroke/elements/PubSubItems.java +++ b/src/com/isode/stroke/elements/PubSubItems.java @@ -53,9 +53,9 @@ public void setNode(String node) { node_ = node; } -Long maximumItems_; -ArrayList<PubSubItem> items_ = new ArrayList<PubSubItem>(); -String subscriptionID_; -String node_; +private Long maximumItems_; +private ArrayList<PubSubItem> items_ = new ArrayList<PubSubItem>(); +private String subscriptionID_; +private String node_; } diff --git a/src/com/isode/stroke/elements/PubSubOptions.java b/src/com/isode/stroke/elements/PubSubOptions.java index 085baa7..f53aaea 100644 --- a/src/com/isode/stroke/elements/PubSubOptions.java +++ b/src/com/isode/stroke/elements/PubSubOptions.java @@ -50,9 +50,9 @@ public void setJID(JID jid) { jid_ = jid; } -Form data_; -String subscriptionID_; -String node_; -JID jid_; +private Form data_; +private String subscriptionID_; +private String node_ = ""; +private JID jid_; } diff --git a/src/com/isode/stroke/elements/PubSubOwnerAffiliation.java b/src/com/isode/stroke/elements/PubSubOwnerAffiliation.java index d08bd3d..751b734 100644 --- a/src/com/isode/stroke/elements/PubSubOwnerAffiliation.java +++ b/src/com/isode/stroke/elements/PubSubOwnerAffiliation.java @@ -42,7 +42,7 @@ public void setType(Type type) { type_ = type; } -JID jid_; -Type type_; +private JID jid_; +private Type type_; } diff --git a/src/com/isode/stroke/elements/PubSubOwnerAffiliations.java b/src/com/isode/stroke/elements/PubSubOwnerAffiliations.java index 25973f8..a48ba10 100644 --- a/src/com/isode/stroke/elements/PubSubOwnerAffiliations.java +++ b/src/com/isode/stroke/elements/PubSubOwnerAffiliations.java @@ -37,7 +37,7 @@ public void addAffiliation(PubSubOwnerAffiliation value) { affiliations_.add(value); } -String node_; -ArrayList<PubSubOwnerAffiliation> affiliations_ = new ArrayList<PubSubOwnerAffiliation>(); +private String node_ = ""; +private ArrayList<PubSubOwnerAffiliation> affiliations_ = new ArrayList<PubSubOwnerAffiliation>(); } diff --git a/src/com/isode/stroke/elements/PubSubOwnerConfigure.java b/src/com/isode/stroke/elements/PubSubOwnerConfigure.java index 2807039..b8245bd 100644 --- a/src/com/isode/stroke/elements/PubSubOwnerConfigure.java +++ b/src/com/isode/stroke/elements/PubSubOwnerConfigure.java @@ -33,7 +33,7 @@ public void setNode(String node) { node_ = node; } -Form data_; -String node_; +private Form data_; +private String node_; } diff --git a/src/com/isode/stroke/elements/PubSubOwnerDefault.java b/src/com/isode/stroke/elements/PubSubOwnerDefault.java index 5f9c179..2c907c8 100644 --- a/src/com/isode/stroke/elements/PubSubOwnerDefault.java +++ b/src/com/isode/stroke/elements/PubSubOwnerDefault.java @@ -25,6 +25,6 @@ public void setData(Form data) { data_ = data; } -Form data_; +private Form data_; } diff --git a/src/com/isode/stroke/elements/PubSubOwnerDelete.java b/src/com/isode/stroke/elements/PubSubOwnerDelete.java index a791fad..4fcac25 100644 --- a/src/com/isode/stroke/elements/PubSubOwnerDelete.java +++ b/src/com/isode/stroke/elements/PubSubOwnerDelete.java @@ -32,7 +32,7 @@ public void setNode(String node) { node_ = node; } -PubSubOwnerRedirect redirect_; -String node_; +private PubSubOwnerRedirect redirect_; +private String node_ = ""; } diff --git a/src/com/isode/stroke/elements/PubSubOwnerPurge.java b/src/com/isode/stroke/elements/PubSubOwnerPurge.java index 0a9abc7..e5bfd26 100644 --- a/src/com/isode/stroke/elements/PubSubOwnerPurge.java +++ b/src/com/isode/stroke/elements/PubSubOwnerPurge.java @@ -24,6 +24,6 @@ public void setNode(String node) { node_ = node; } -String node_; +private String node_ = ""; } diff --git a/src/com/isode/stroke/elements/PubSubOwnerRedirect.java b/src/com/isode/stroke/elements/PubSubOwnerRedirect.java index c5bda3c..de9fbc7 100644 --- a/src/com/isode/stroke/elements/PubSubOwnerRedirect.java +++ b/src/com/isode/stroke/elements/PubSubOwnerRedirect.java @@ -24,6 +24,6 @@ public void setURI(String uri) { uri_ = uri; } -String uri_; +private String uri_ = ""; } diff --git a/src/com/isode/stroke/elements/PubSubOwnerSubscription.java b/src/com/isode/stroke/elements/PubSubOwnerSubscription.java index 2845ffc..bcb3227 100644 --- a/src/com/isode/stroke/elements/PubSubOwnerSubscription.java +++ b/src/com/isode/stroke/elements/PubSubOwnerSubscription.java @@ -40,7 +40,7 @@ public void setJID(JID jid) { jid_ = jid; } -SubscriptionType subscription_; -JID jid_; +private SubscriptionType subscription_; +private JID jid_; } diff --git a/src/com/isode/stroke/elements/PubSubOwnerSubscriptions.java b/src/com/isode/stroke/elements/PubSubOwnerSubscriptions.java index bd84a2d..e393bb7 100644 --- a/src/com/isode/stroke/elements/PubSubOwnerSubscriptions.java +++ b/src/com/isode/stroke/elements/PubSubOwnerSubscriptions.java @@ -37,7 +37,7 @@ public void setNode(String node) { node_ = node; } -ArrayList<PubSubOwnerSubscription> subscriptions_ = new ArrayList<PubSubOwnerSubscription>(); -String node_; +private ArrayList<PubSubOwnerSubscription> subscriptions_ = new ArrayList<PubSubOwnerSubscription>(); +private String node_ = ""; } diff --git a/src/com/isode/stroke/elements/PubSubPublish.java b/src/com/isode/stroke/elements/PubSubPublish.java index 987ba83..4ff1438 100644 --- a/src/com/isode/stroke/elements/PubSubPublish.java +++ b/src/com/isode/stroke/elements/PubSubPublish.java @@ -37,7 +37,7 @@ public void setNode(String node) { node_ = node; } -ArrayList<PubSubItem> items_ = new ArrayList<PubSubItem>(); -String node_; +private ArrayList<PubSubItem> items_ = new ArrayList<PubSubItem>(); +private String node_ = ""; } diff --git a/src/com/isode/stroke/elements/PubSubRetract.java b/src/com/isode/stroke/elements/PubSubRetract.java index d8349ea..beb8a7b 100644 --- a/src/com/isode/stroke/elements/PubSubRetract.java +++ b/src/com/isode/stroke/elements/PubSubRetract.java @@ -45,8 +45,8 @@ public void setNotify(boolean notify) { notify_ = notify; } -ArrayList<PubSubItem> items_ = new ArrayList<PubSubItem>(); -String node_; -boolean notify_; +private ArrayList<PubSubItem> items_ = new ArrayList<PubSubItem>(); +private String node_ = ""; +private boolean notify_; } diff --git a/src/com/isode/stroke/elements/PubSubSubscribe.java b/src/com/isode/stroke/elements/PubSubSubscribe.java index d822bd5..118e0ca 100644 --- a/src/com/isode/stroke/elements/PubSubSubscribe.java +++ b/src/com/isode/stroke/elements/PubSubSubscribe.java @@ -41,8 +41,8 @@ public void setOptions(PubSubOptions options) { options_ = options; } -String node_; -JID jid_; -PubSubOptions options_; +private String node_; +private JID jid_; +private PubSubOptions options_; } diff --git a/src/com/isode/stroke/elements/PubSubSubscribeOptions.java b/src/com/isode/stroke/elements/PubSubSubscribeOptions.java index 54fd72e..5386a4b 100644 --- a/src/com/isode/stroke/elements/PubSubSubscribeOptions.java +++ b/src/com/isode/stroke/elements/PubSubSubscribeOptions.java @@ -24,6 +24,6 @@ public void setRequired(boolean required) { required_ = required; } -boolean required_; +private boolean required_; } diff --git a/src/com/isode/stroke/elements/PubSubSubscription.java b/src/com/isode/stroke/elements/PubSubSubscription.java index 78d9c17..602efa7 100644 --- a/src/com/isode/stroke/elements/PubSubSubscription.java +++ b/src/com/isode/stroke/elements/PubSubSubscription.java @@ -64,10 +64,10 @@ public void setOptions(PubSubSubscribeOptions options) { options_ = options; } -SubscriptionType subscription_; -String subscriptionID_; -String node_; -JID jid_; -PubSubSubscribeOptions options_; +private SubscriptionType subscription_; +private String subscriptionID_; +private String node_; +private JID jid_; +private PubSubSubscribeOptions options_; } diff --git a/src/com/isode/stroke/elements/PubSubSubscriptions.java b/src/com/isode/stroke/elements/PubSubSubscriptions.java index 23bb223..34c21bd 100644 --- a/src/com/isode/stroke/elements/PubSubSubscriptions.java +++ b/src/com/isode/stroke/elements/PubSubSubscriptions.java @@ -37,7 +37,7 @@ public void setNode(String node) { node_ = node; } -ArrayList<PubSubSubscription> subscriptions_ = new ArrayList<PubSubSubscription>(); -String node_; +private ArrayList<PubSubSubscription> subscriptions_ = new ArrayList<PubSubSubscription>(); +private String node_; } diff --git a/src/com/isode/stroke/elements/PubSubUnsubscribe.java b/src/com/isode/stroke/elements/PubSubUnsubscribe.java index f8d1fae..ed9f407 100644 --- a/src/com/isode/stroke/elements/PubSubUnsubscribe.java +++ b/src/com/isode/stroke/elements/PubSubUnsubscribe.java @@ -41,8 +41,8 @@ public void setJID(JID jid) { jid_ = jid; } -String subscriptionID_; -String node_; -JID jid_; +private String subscriptionID_; +private String node_; +private JID jid_; } diff --git a/src/com/isode/stroke/elements/RawXMLPayload.java b/src/com/isode/stroke/elements/RawXMLPayload.java index 9700df7..30c9f74 100644 --- a/src/com/isode/stroke/elements/RawXMLPayload.java +++ b/src/com/isode/stroke/elements/RawXMLPayload.java @@ -13,7 +13,7 @@ package com.isode.stroke.elements; * Unparsed content. */ public class RawXMLPayload extends Payload { - private String rawXML_; + private String rawXML_ = ""; public void setRawXML(String data) { rawXML_ = data; diff --git a/src/com/isode/stroke/elements/Replace.java b/src/com/isode/stroke/elements/Replace.java index 65c5216..51279ef 100644 --- a/src/com/isode/stroke/elements/Replace.java +++ b/src/com/isode/stroke/elements/Replace.java @@ -10,7 +10,7 @@ package com.isode.stroke.elements; public class Replace extends Payload { - private String replaceID_; + private String replaceID_ = ""; public Replace() { this(""); diff --git a/src/com/isode/stroke/elements/RosterItemPayload.java b/src/com/isode/stroke/elements/RosterItemPayload.java index 1ede267..6655dbd 100644 --- a/src/com/isode/stroke/elements/RosterItemPayload.java +++ b/src/com/isode/stroke/elements/RosterItemPayload.java @@ -96,7 +96,7 @@ public class RosterItemPayload { } private JID jid_; - private String name_; + private String name_ = ""; private Subscription subscription_; private Collection<String> groups_; private boolean ask_; diff --git a/src/com/isode/stroke/elements/SoftwareVersion.java b/src/com/isode/stroke/elements/SoftwareVersion.java index 1576a29..9d2bc6e 100644 --- a/src/com/isode/stroke/elements/SoftwareVersion.java +++ b/src/com/isode/stroke/elements/SoftwareVersion.java @@ -11,9 +11,9 @@ package com.isode.stroke.elements; public class SoftwareVersion extends Payload { - private String name_; - private String version_; - private String os_; + private String name_ = ""; + private String version_ = ""; + private String os_ = ""; public SoftwareVersion(final String name, final String version, final String os) { name_ = name; diff --git a/src/com/isode/stroke/elements/Stanza.java b/src/com/isode/stroke/elements/Stanza.java index 8a5aadd..82fd41b 100644 --- a/src/com/isode/stroke/elements/Stanza.java +++ b/src/com/isode/stroke/elements/Stanza.java @@ -14,9 +14,9 @@ import java.util.Vector; * Base class for all types of XMPP stanza. */ public abstract class Stanza implements Element { - private String id_; - private JID from_; - private JID to_; + private String id_ = ""; + private JID from_ = new JID(); + private JID to_ = new JID(); private Vector<Payload> payloads_ = new Vector<Payload>(); /** diff --git a/src/com/isode/stroke/elements/Status.java b/src/com/isode/stroke/elements/Status.java index 215703b..4671b71 100644 --- a/src/com/isode/stroke/elements/Status.java +++ b/src/com/isode/stroke/elements/Status.java @@ -10,7 +10,7 @@ package com.isode.stroke.elements; public class Status extends Payload { - String text_ = ""; + private String text_ = ""; public Status() { } diff --git a/src/com/isode/stroke/elements/StreamError.java b/src/com/isode/stroke/elements/StreamError.java index 6cb7b47..397056a 100644 --- a/src/com/isode/stroke/elements/StreamError.java +++ b/src/com/isode/stroke/elements/StreamError.java @@ -71,5 +71,5 @@ public class StreamError implements Element { return text_; } private Type type_; - private String text_; + private String text_ = ""; }; diff --git a/src/com/isode/stroke/elements/StreamResume.java b/src/com/isode/stroke/elements/StreamResume.java index 6a614b3..85caea8 100644 --- a/src/com/isode/stroke/elements/StreamResume.java +++ b/src/com/isode/stroke/elements/StreamResume.java @@ -25,6 +25,6 @@ public class StreamResume implements Element { public void setHandledStanzasCount(long i) { handledStanzasCount = i; } - private String resumeID; + private String resumeID = ""; private Long handledStanzasCount; } diff --git a/src/com/isode/stroke/elements/StreamResumed.java b/src/com/isode/stroke/elements/StreamResumed.java index f62d26a..06a333b 100644 --- a/src/com/isode/stroke/elements/StreamResumed.java +++ b/src/com/isode/stroke/elements/StreamResumed.java @@ -25,6 +25,6 @@ public class StreamResumed implements Element { public void setHandledStanzasCount(long i) { handledStanzasCount = i; } - private String resumeID; + private String resumeID = ""; private Long handledStanzasCount; } diff --git a/src/com/isode/stroke/elements/Subject.java b/src/com/isode/stroke/elements/Subject.java index f395de8..e4cdef7 100644 --- a/src/com/isode/stroke/elements/Subject.java +++ b/src/com/isode/stroke/elements/Subject.java @@ -10,7 +10,7 @@ package com.isode.stroke.elements; public class Subject extends Payload { - String text_ = ""; + private String text_ = ""; public Subject() {} diff --git a/src/com/isode/stroke/elements/UnblockPayload.java b/src/com/isode/stroke/elements/UnblockPayload.java new file mode 100644 index 0000000..5a5c709 --- /dev/null +++ b/src/com/isode/stroke/elements/UnblockPayload.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2011-2015 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ +/* + * Copyright (c) 2015 Tarun Gupta. + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +package com.isode.stroke.elements; + +import com.isode.stroke.elements.Payload; +import com.isode.stroke.jid.JID; +import com.isode.stroke.base.NotNull; +import java.util.Vector; + +public class UnblockPayload extends Payload { + + private Vector<JID> items = new Vector<JID>(); + + public UnblockPayload() { + + } + + /** + * Parameterized Constructor. + * @param items, Not NUll. + */ + public UnblockPayload(Vector<JID> items) { + NotNull.exceptIfNull(items, "items"); + this.items = items; + } + + /** + * @param item, Not Null. + */ + public void addItem(JID item) { + NotNull.exceptIfNull(item, "item"); + items.add(item); + } + + /** + * @return items, Not Null. + */ + public Vector<JID> getItems() { + return items; + } +}
\ No newline at end of file diff --git a/src/com/isode/stroke/parser/payloadparsers/LastParser.java b/src/com/isode/stroke/parser/payloadparsers/LastParser.java index 62a7636..2dea769 100644 --- a/src/com/isode/stroke/parser/payloadparsers/LastParser.java +++ b/src/com/isode/stroke/parser/payloadparsers/LastParser.java @@ -23,10 +23,10 @@ public class LastParser extends GenericPayloadParser<Last> { public void handleStartElement(String element, String ns, AttributeMap attributes) { if (level_ == 0) { - Long seconds = null; + int seconds = 0; try { - seconds = Long.parseLong(attributes.getAttribute("seconds")); + seconds = Integer.parseInt(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 8eff41a..1d9c55c 100644 --- a/src/com/isode/stroke/serializer/payloadserializers/LastSerializer.java +++ b/src/com/isode/stroke/serializer/payloadserializers/LastSerializer.java @@ -19,9 +19,6 @@ public class LastSerializer extends GenericPayloadSerializer<Last> { @Override protected String serializePayload(Last last) { - if(last.getSeconds() == null) { - return "<query xmlns='jabber:iq:last'/>"; - } - return "<query xmlns='jabber:iq:last' seconds='" + Long.toString(last.getSeconds()) + "'/>"; + return "<query xmlns='jabber:iq:last' seconds='" + Integer.toString(last.getSeconds()) + "'/>"; } } |