diff options
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/isode/stroke/roster/XMPPRosterImpl.java | 6 | ||||
-rw-r--r-- | src/com/isode/stroke/roster/XMPPRosterItem.java | 10 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/com/isode/stroke/roster/XMPPRosterImpl.java b/src/com/isode/stroke/roster/XMPPRosterImpl.java index d87a20e..7b80104 100644 --- a/src/com/isode/stroke/roster/XMPPRosterImpl.java +++ b/src/com/isode/stroke/roster/XMPPRosterImpl.java @@ -73,7 +73,11 @@ public class XMPPRosterImpl extends XMPPRoster { @Override public Collection<XMPPRosterItem> getItems() { - return entries_.values(); + Collection<XMPPRosterItem> items = new ArrayList<XMPPRosterItem>(entries_.size()); + for (XMPPRosterItem item : entries_.values()) { + items.add(new XMPPRosterItem(item)); + } + return items; } @Override diff --git a/src/com/isode/stroke/roster/XMPPRosterItem.java b/src/com/isode/stroke/roster/XMPPRosterItem.java index 1412f83..25ebc47 100644 --- a/src/com/isode/stroke/roster/XMPPRosterItem.java +++ b/src/com/isode/stroke/roster/XMPPRosterItem.java @@ -5,6 +5,7 @@ package com.isode.stroke.roster; import java.util.Collection; +import java.util.ArrayList; import com.isode.stroke.elements.RosterItemPayload; import com.isode.stroke.jid.JID; @@ -21,6 +22,15 @@ public class XMPPRosterItem { this.groups = groups; this.subscription = subscription; } + + // Copy constructor + public XMPPRosterItem(XMPPRosterItem from) { + this(from.jid, from.name, null, from.subscription); + if (from.groups != null) { + groups = new ArrayList<String>(from.groups.size()); + groups.addAll(from.groups); + } + } public final JID getJID() { return jid; |