summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Young <consult.awy@gmail.com>2016-06-03 15:19:28 (GMT)
committerAlan Young <consult.awy@gmail.com>2016-06-03 15:19:28 (GMT)
commit8708b7b01cf4f36524bff3dc9aa5a7a6534ce221 (patch)
treeddcf591d8a37d326b3989b4f9a70c3d828dde964 /src/com/isode/stroke/roster/XMPPRosterItem.java
parent9d50093bee736d2b7b43756e9a41cfafbd568ee2 (diff)
downloadstroke-8708b7b01cf4f36524bff3dc9aa5a7a6534ce221.zip
stroke-8708b7b01cf4f36524bff3dc9aa5a7a6534ce221.tar.bz2
XMPPRosterImpl.getItems() needs to do deep copy.
And (therefore) XMPPRosterItem needs a copy constructor. Change-Id: I9c4d833e559cf70d0c125fc6d841f16b8c2ce5b9
Diffstat (limited to 'src/com/isode/stroke/roster/XMPPRosterItem.java')
-rw-r--r--src/com/isode/stroke/roster/XMPPRosterItem.java10
1 files changed, 10 insertions, 0 deletions
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;