summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/isode/stroke/elements')
-rw-r--r--src/com/isode/stroke/elements/ChatState.java4
-rw-r--r--src/com/isode/stroke/elements/Idle.java29
-rw-r--r--src/com/isode/stroke/elements/MUCInvitationPayload.java24
-rw-r--r--src/com/isode/stroke/elements/Presence.java10
-rw-r--r--src/com/isode/stroke/elements/PrivateStorage.java10
-rw-r--r--src/com/isode/stroke/elements/Replace.java31
-rw-r--r--src/com/isode/stroke/elements/RosterItemPayload.java14
-rw-r--r--src/com/isode/stroke/elements/RosterPayload.java18
-rw-r--r--src/com/isode/stroke/elements/SecurityLabel.java62
-rw-r--r--src/com/isode/stroke/elements/SecurityLabelsCatalog.java83
-rw-r--r--src/com/isode/stroke/elements/Stanza.java18
-rw-r--r--src/com/isode/stroke/elements/StatusShow.java33
-rw-r--r--src/com/isode/stroke/elements/VCard.java311
13 files changed, 608 insertions, 39 deletions
diff --git a/src/com/isode/stroke/elements/ChatState.java b/src/com/isode/stroke/elements/ChatState.java
index 151eec4..b602b8e 100644
--- a/src/com/isode/stroke/elements/ChatState.java
+++ b/src/com/isode/stroke/elements/ChatState.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2015 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -51,4 +51,4 @@ public class ChatState extends Payload {
NotNull.exceptIfNull(state, "state");
state_ = state;
}
-} \ No newline at end of file
+}
diff --git a/src/com/isode/stroke/elements/Idle.java b/src/com/isode/stroke/elements/Idle.java
new file mode 100644
index 0000000..f76cf8a
--- /dev/null
+++ b/src/com/isode/stroke/elements/Idle.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015, Isode Limited, London, England.
+ * All rights reserved.
+ */
+/*
+ * Copyright (c) 2013 Tobias Markmann
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+package com.isode.stroke.elements;
+
+import java.util.Date;
+
+public class Idle extends Payload {
+ public Idle() {}
+ public Idle(Date since) {
+ since_ = since;
+ }
+
+ public void setSince(Date since) {
+ since_ = since;
+ }
+
+ public Date getSince() {
+ return since_;
+ }
+
+ private Date since_;
+}
diff --git a/src/com/isode/stroke/elements/MUCInvitationPayload.java b/src/com/isode/stroke/elements/MUCInvitationPayload.java
index 9d0195b..464e5ff 100644
--- a/src/com/isode/stroke/elements/MUCInvitationPayload.java
+++ b/src/com/isode/stroke/elements/MUCInvitationPayload.java
@@ -1,9 +1,5 @@
/*
- * Copyright (c) 2012, Isode Limited, London, England.
- * All rights reserved.
- */
-/*
- * Copyright (c) 2011, Kevin Smith
+ * Copyright (c) 2011-2015, Isode Limited, London, England.
* All rights reserved.
*/
package com.isode.stroke.elements;
@@ -20,6 +16,8 @@ public class MUCInvitationPayload extends Payload {
private String password_;
private String reason_;
private String thread_;
+ private boolean impromptu_;
+
/**
* Create the payload
@@ -45,6 +43,22 @@ public class MUCInvitationPayload extends Payload {
}
/**
+ * Set the impromptu value
+ * @param b value to set
+ */
+ public void setIsImpromptu(boolean b) {
+ impromptu_ = b;
+ }
+
+ /**
+ * Get the impromptu value
+ * @return impromptu value
+ */
+ public boolean getIsImpromptu() {
+ return impromptu_;
+ }
+
+ /**
* Set the jabber ID
* @param jid jabber Id, not null
*/
diff --git a/src/com/isode/stroke/elements/Presence.java b/src/com/isode/stroke/elements/Presence.java
index 392573f..ff3b0df 100644
--- a/src/com/isode/stroke/elements/Presence.java
+++ b/src/com/isode/stroke/elements/Presence.java
@@ -1,9 +1,5 @@
/*
- * 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;
@@ -119,6 +115,10 @@ public class Presence extends Stanza {
public void setPriority(int priority) {
updatePayload(new Priority(priority));
}
+
+ public boolean isAvailable() {
+ return type_ != null && type_ == Type.Available;
+ }
@Override
public String toString() {
diff --git a/src/com/isode/stroke/elements/PrivateStorage.java b/src/com/isode/stroke/elements/PrivateStorage.java
index 171e56e..09e173f 100644
--- a/src/com/isode/stroke/elements/PrivateStorage.java
+++ b/src/com/isode/stroke/elements/PrivateStorage.java
@@ -1,9 +1,5 @@
/*
- * Copyright (c) 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;
@@ -15,7 +11,9 @@ package com.isode.stroke.elements;
*/
public class PrivateStorage extends Payload {
- /**
+ public PrivateStorage() {}
+
+ /**
* Constructor
* @param p payload, not null
*/
diff --git a/src/com/isode/stroke/elements/Replace.java b/src/com/isode/stroke/elements/Replace.java
new file mode 100644
index 0000000..65c5216
--- /dev/null
+++ b/src/com/isode/stroke/elements/Replace.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2015, Isode Limited, London, England.
+ * All rights reserved.
+ */
+/*
+ * Copyright (c) 2011 Vlad Voicu
+ * Licensed under the Simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+package com.isode.stroke.elements;
+
+public class Replace extends Payload {
+ private String replaceID_;
+
+ public Replace() {
+ this("");
+ }
+
+ public Replace(String id) {
+ replaceID_ = id;
+ }
+
+ public String getID() {
+ return replaceID_;
+ }
+
+ public void setID(String id) {
+ replaceID_ = id;
+ }
+
+}
diff --git a/src/com/isode/stroke/elements/RosterItemPayload.java b/src/com/isode/stroke/elements/RosterItemPayload.java
index a80ecc6..c080915 100644
--- a/src/com/isode/stroke/elements/RosterItemPayload.java
+++ b/src/com/isode/stroke/elements/RosterItemPayload.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Isode Limited, London, England.
+ * Copyright (c) 2010-2015, Isode Limited, London, England.
* All rights reserved.
*/
/*
@@ -23,15 +23,23 @@ public class RosterItemPayload {
};
public RosterItemPayload() {
+ jid_ = new JID();
+ name_ = "";
subscription_ = Subscription.None;
ask_ = false;
+ groups_ = new ArrayList<String>();
}
- public RosterItemPayload(JID jid, String name, Subscription subscription) {
+ public RosterItemPayload(JID jid, String name, Subscription subscription, Collection<String> groups) {
jid_ = jid;
name_ = name;
subscription_ = subscription;
ask_ = false;
+ groups_ = groups;
+ }
+
+ public RosterItemPayload(JID jid, String name, Subscription subscription) {
+ this(jid, name, subscription, new ArrayList<String>());
}
public void setJID(JID jid) {
@@ -81,6 +89,6 @@ public class RosterItemPayload {
private JID jid_;
private String name_;
private Subscription subscription_;
- private ArrayList<String> groups_ = new ArrayList<String>();
+ private Collection<String> groups_;
private boolean ask_;
}
diff --git a/src/com/isode/stroke/elements/RosterPayload.java b/src/com/isode/stroke/elements/RosterPayload.java
index 6208216..5ca32f8 100644
--- a/src/com/isode/stroke/elements/RosterPayload.java
+++ b/src/com/isode/stroke/elements/RosterPayload.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Isode Limited, London, England.
+ * Copyright (c) 2010-2015, Isode Limited, London, England.
* All rights reserved.
*/
/*
@@ -9,13 +9,16 @@
package com.isode.stroke.elements;
import com.isode.stroke.jid.JID;
+
import java.util.ArrayList;
-import java.util.Collection;
+import java.util.List;
/**
* Roster.
*/
public class RosterPayload extends Payload {
+ private final ArrayList<RosterItemPayload> items_ = new ArrayList<RosterItemPayload>();
+ private String version_;
public RosterPayload() {
}
@@ -33,9 +36,16 @@ public class RosterPayload extends Payload {
items_.add(item);
}
- public Collection<RosterItemPayload> getItems() {
+ public List<RosterItemPayload> getItems() {
return items_;
}
- private final ArrayList<RosterItemPayload> items_ = new ArrayList<RosterItemPayload>();
+ public String getVersion() {
+ return version_;
+ }
+
+ public void setVersion(String version) {
+ this.version_ = version;
+ }
+
}
diff --git a/src/com/isode/stroke/elements/SecurityLabel.java b/src/com/isode/stroke/elements/SecurityLabel.java
new file mode 100644
index 0000000..8134811
--- /dev/null
+++ b/src/com/isode/stroke/elements/SecurityLabel.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2010-2015, Isode Limited, London, England.
+ * All rights reserved.
+ */
+package com.isode.stroke.elements;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class SecurityLabel extends Payload {
+
+ private Collection<String> equivalentLabels = new ArrayList<String>();
+ private String foregroundColor;
+ private String displayMarking;
+ private String backgroundColor;
+ private String label;
+
+ final Collection<String> getEquivalentLabels() {
+ return equivalentLabels;
+ }
+
+ void setEquivalentLabels(final Collection<String> value) {
+ this.equivalentLabels = value ;
+ }
+
+ void addEquivalentLabel(final String value) {
+ this.equivalentLabels.add(value);
+ }
+
+ final String getForegroundColor() {
+ return foregroundColor;
+ }
+
+ void setForegroundColor(final String value) {
+ this.foregroundColor = value ;
+ }
+
+ final String getDisplayMarking() {
+ return displayMarking;
+ }
+
+ void setDisplayMarking(final String value) {
+ this.displayMarking = value ;
+ }
+
+ final String getBackgroundColor() {
+ return backgroundColor;
+ }
+
+ void setBackgroundColor(final String value) {
+ this.backgroundColor = value ;
+ }
+
+ final String getLabel() {
+ return label;
+ }
+
+ void setLabel(final String value) {
+ this.label = value ;
+ }
+
+}
diff --git a/src/com/isode/stroke/elements/SecurityLabelsCatalog.java b/src/com/isode/stroke/elements/SecurityLabelsCatalog.java
new file mode 100644
index 0000000..4bb9493
--- /dev/null
+++ b/src/com/isode/stroke/elements/SecurityLabelsCatalog.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2010-2015, Isode Limited, London, England.
+ * All rights reserved.
+ */
+package com.isode.stroke.elements;
+
+import java.util.Collection;
+
+import com.isode.stroke.jid.JID;
+
+public class SecurityLabelsCatalog extends Payload {
+ private JID to_;
+ private String name_;
+ private String description_;
+ private Collection<Item> items_;
+
+ public class Item {
+ private SecurityLabel label_;
+ private String selector_;
+ private boolean default_;
+
+ public SecurityLabel getLabel() {
+ return label_;
+ }
+
+ void setLabel(SecurityLabel label) {
+ label_ = label;
+ }
+
+ final String getSelector() { return selector_; }
+
+ void setSelector(final String selector) {
+ selector_ = selector;
+ }
+
+ boolean getIsDefault() { return default_; }
+
+ void setIsDefault(boolean isDefault) {
+ default_ = isDefault;
+ }
+ };
+
+ public SecurityLabelsCatalog() {
+ this(new JID());
+ }
+
+ public SecurityLabelsCatalog(final JID to) {
+ to_ = to;
+ }
+
+ public final Collection<Item> getItems() {
+ return items_;
+ }
+
+ public void addItem(final Item item) {
+ items_.add(item);
+ }
+
+ public final JID getTo() {
+ return to_;
+ }
+
+ public void setTo(final JID to) {
+ to_ = to;
+ }
+
+ public final String getName() {
+ return name_;
+ }
+
+ public void setName(final String name) {
+ name_ = name;
+ }
+
+ public final String getDescription() {
+ return description_;
+ }
+
+ public void setDescription(final String description) {
+ description_ = description;
+ }
+
+}
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;
+ }
}
diff --git a/src/com/isode/stroke/elements/StatusShow.java b/src/com/isode/stroke/elements/StatusShow.java
index 14cfe2c..c6b2b14 100644
--- a/src/com/isode/stroke/elements/StatusShow.java
+++ b/src/com/isode/stroke/elements/StatusShow.java
@@ -1,9 +1,5 @@
/*
- * Copyright (c) 2010, 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;
@@ -25,11 +21,11 @@ public class StatusShow extends Payload {
type_ = type;
}
- void setType(Type type) {
+ public void setType(Type type) {
type_ = type;
}
- Type getType() {
+ public Type getType() {
return type_;
}
@@ -50,4 +46,27 @@ public class StatusShow extends Payload {
}
return "Unknown";
}
+
+ /**
+ * Can be used for rough ordering of Types.
+ * Greater magnitude = more available.
+ */
+ public static int typeToAvailabilityOrdering(Type type) {
+ switch (type) {
+ case Online: return 4;
+ case FFC: return 5;
+ case Away: return 2;
+ case XA: return 1;
+ case DND: return 3;
+ case None: return 0;
+ }
+ assert(false);
+ return 0;
+ }
+
+ @Override
+ public String toString() {
+ return "StatusShow : " + type_.toString();
+ }
+
}
diff --git a/src/com/isode/stroke/elements/VCard.java b/src/com/isode/stroke/elements/VCard.java
new file mode 100644
index 0000000..f9b294b
--- /dev/null
+++ b/src/com/isode/stroke/elements/VCard.java
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 2010-2015, Isode Limited, London, England.
+ * All rights reserved.
+ */
+package com.isode.stroke.elements;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.isode.stroke.base.ByteArray;
+import com.isode.stroke.jid.JID;
+
+public class VCard extends Payload implements Serializable {
+ private String version_ = "";
+ private String fullName_ = "";
+ private String familyName_ = "";
+ private String givenName_ = "";
+ private String middleName_ = "";
+ private String prefix_ = "";
+ private String suffix_ = "";
+// private //String email_;
+ private ByteArray photo_;
+ private String photoType_ = "";
+ private String nick_ = "";
+ private Date birthday_;
+ private String unknownContent_ = "";
+ private List<EMailAddress> emailAddresses_;
+ private List<Telephone> telephones_;
+ private List<Address> addresses_;
+ private List<AddressLabel> addressLabels_;
+ private List<JID> jids_;
+ private String description_ = "";
+ private List<Organization> organizations_;
+ private List<String> titles_;
+ private List<String> roles_;
+ private List<String> urls_;
+
+ public static class EMailAddress {
+ public boolean isHome;
+ public boolean isWork;
+ public boolean isInternet;
+ public boolean isPreferred;
+ public boolean isX400;
+ public String address;
+ };
+
+ public static class Telephone {
+ public boolean isHome;
+ public boolean isWork;
+ public boolean isVoice;
+ public boolean isFax;
+ public boolean isPager;
+ public boolean isMSG;
+ public boolean isCell;
+ public boolean isVideo;
+ public boolean isBBS;
+ public boolean isModem;
+ public boolean isISDN;
+ public boolean isPCS;
+ public boolean isPreferred;
+ public String number;
+ };
+
+ public static enum DeliveryType {
+ DomesticDelivery,
+ InternationalDelivery,
+ None
+ };
+
+ public static class Address {
+ public boolean isHome;
+ public boolean isWork;
+ public boolean isPostal;
+ public boolean isParcel;
+ public DeliveryType deliveryType;
+ public boolean isPreferred;
+
+ public String poBox;
+ public String addressExtension;
+ public String street;
+ public String locality;
+ public String region;
+ public String postalCode;
+ public String country;
+ };
+
+ public static class AddressLabel {
+ public boolean isHome;
+ public boolean isWork;
+ public boolean isPostal;
+ public boolean isParcel;
+ public DeliveryType deliveryType;
+ public boolean isPreferred;
+ public List<String> lines = new ArrayList<String>();
+ };
+
+ public static class Organization {
+ public String name;
+ public List<String> units = new ArrayList<String>();
+ };
+
+ public VCard() {}
+
+ public void setVersion(final String version) { version_ = version; }
+ public final String getVersion() { return version_; }
+
+ public void setFullName(final String fullName) { fullName_ = fullName; }
+ public final String getFullName() { return fullName_; }
+
+ public void setFamilyName(final String familyName) { familyName_ = familyName; }
+ public final String getFamilyName() { return familyName_; }
+
+ public void setGivenName(final String givenName) { givenName_ = givenName; }
+ public final String getGivenName() { return givenName_; }
+
+ public void setMiddleName(final String middleName) { middleName_ = middleName; }
+ public final String getMiddleName() { return middleName_; }
+
+ public void setPrefix(final String prefix) { prefix_ = prefix; }
+ public final String getPrefix() { return prefix_; }
+
+ public void setSuffix(final String suffix) { suffix_ = suffix; }
+ public final String getSuffix() { return suffix_; }
+
+
+ //void setEMailAddress(final String email) { email_ = email; }
+ //final String getEMailAddress() { return email_; }
+
+ public void setNickname(final String nick) { nick_ = nick; }
+ public final String getNickname() { return nick_; }
+
+ public void setPhoto(final ByteArray photo) { photo_ = photo; }
+ public final ByteArray getPhoto() { return photo_; }
+
+ public void setPhotoType(final String photoType) { photoType_ = photoType; }
+ public final String getPhotoType() { return photoType_; }
+
+ public final String getUnknownContent() { return unknownContent_; }
+ public void addUnknownContent(final String c) {
+ unknownContent_ += c;
+ }
+
+ public final List<EMailAddress> getEMailAddresses() {
+ return emailAddresses_;
+ }
+
+ public void addEMailAddress(final EMailAddress email) {
+ if (emailAddresses_ == null) emailAddresses_ = new ArrayList<EMailAddress>();
+ emailAddresses_.add(email);
+ }
+
+ public void clearEMailAddresses() {
+ if (emailAddresses_ != null) emailAddresses_.clear();
+ }
+
+ public void setBirthday(final Date birthday) {
+ birthday_ = birthday;
+ }
+
+ public final Date getBirthday() {
+ return birthday_;
+ }
+
+ public void addTelephone(final Telephone phone) {
+ if (telephones_ == null) telephones_ = new ArrayList<Telephone>();
+ telephones_.add(phone);
+ }
+
+ public void clearTelephones() {
+ if (telephones_ != null) telephones_.clear();
+ }
+
+ public final List<Address> getAddresses() {
+ return addresses_;
+ }
+
+ public void addAddress(final Address address) {
+ if (addresses_ == null) addresses_ = new ArrayList<Address>();
+ addresses_.add(address);
+ }
+
+ public void clearAddresses() {
+ if (addresses_ != null) addresses_.clear();
+ }
+
+ public final List<AddressLabel> getAddressLabels() {
+ return addressLabels_;
+ }
+
+ public void addAddressLabel(final AddressLabel addressLabel) {
+ if (addressLabels_ == null) addressLabels_ = new ArrayList<AddressLabel>();
+ addressLabels_.add(addressLabel);
+ }
+
+ public void clearAddressLabels() {
+ if (addressLabels_ != null) addressLabels_.clear();
+ }
+
+ public final List<JID> getJIDs() {
+ if (jids_ == null) jids_ = new ArrayList<JID>();
+ return jids_;
+ }
+
+ public void clearJIDs() {
+ if (jids_ != null) jids_.clear();
+ }
+
+ public final String getDescription() {
+ return description_;
+ }
+
+ public void setDescription(final String description) {
+ this.description_ = description;
+ }
+
+ public final List<Organization> getOrganizations() {
+ return organizations_;
+ }
+
+ public void addOrganization(final Organization organization) {
+ if (organizations_ == null) organizations_ = new ArrayList<Organization>();
+ organizations_.add(organization);
+ }
+
+ public void clearOrganizations() {
+ if (organizations_ != null) organizations_.clear();
+ }
+
+ public final List<String> getTitles() {
+ return titles_;
+ }
+
+ public void addTitle(final String title) {
+ if (titles_ == null) titles_ = new ArrayList<String>();
+ titles_.add(title);
+ }
+
+ public void clearTitles() {
+ if (titles_ != null) titles_.clear();
+ }
+
+ public final List<String> getRoles() {
+ return roles_;
+ }
+
+ public void addRole(final String role) {
+ if (roles_ == null) roles_ = new ArrayList<String>();
+ roles_.add(role);
+ }
+
+ public void clearRoles() {
+ if (roles_ != null) roles_.clear();
+ }
+
+ public final List<String> getURLs() {
+ return urls_;
+ }
+
+ public void addURL(final String url) {
+ if (urls_ == null) urls_ = new ArrayList<String>();
+ urls_.add(url);
+ }
+
+ public void clearURLs() {
+ if (urls_ != null) urls_.clear();
+ }
+
+ public boolean isEmpty() {
+ boolean empty = version_.isEmpty() && fullName_.isEmpty() && familyName_.isEmpty() && givenName_.isEmpty() && middleName_.isEmpty() && prefix_.isEmpty() && suffix_.isEmpty();
+ empty &= photo_ == null || photo_.isEmpty();
+ empty &= photoType_.isEmpty();
+ empty &= nick_.isEmpty();
+ empty &= birthday_ == null;
+ empty &= unknownContent_.isEmpty();
+ empty &= emailAddresses_ == null || emailAddresses_.isEmpty();
+ empty &= telephones_ == null || telephones_.isEmpty();
+ empty &= addresses_ == null || addresses_.isEmpty();
+ empty &= addressLabels_ == null || addressLabels_.isEmpty();
+ empty &= jids_ == null || jids_.isEmpty();
+ empty &= description_.isEmpty();
+ empty &= organizations_ == null || organizations_.isEmpty();
+ empty &= titles_ == null || titles_.isEmpty();
+ empty &= roles_ == null || roles_.isEmpty();
+ empty &= urls_ == null || urls_.isEmpty();
+ return empty;
+ }
+
+ public EMailAddress getPreferredEMailAddress() {
+ for (final EMailAddress address : emailAddresses_) {
+ if (address.isPreferred) {
+ return address;
+ }
+ }
+ if (emailAddresses_ != null && !emailAddresses_.isEmpty()) {
+ return emailAddresses_.get(0);
+ }
+ return new EMailAddress();
+ }
+
+ public void addJID(JID jid) {
+ jids_.add(jid);
+
+ }
+
+ public List<Telephone> getTelephones() {
+ return telephones_;
+ }
+
+}