From 31cd0ab0887d6e23d69f48cf02de470d8c5230af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Niess?= Date: Wed, 24 Mar 2010 20:31:06 +0000 Subject: [PATCH] SMACK-305: fixed roster reload git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@11670 b35dd754-fafc-0310-a699-88a17e54d16e --- source/org/jivesoftware/smack/Roster.java | 2 +- source/org/jivesoftware/smack/RosterEntry.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source/org/jivesoftware/smack/Roster.java b/source/org/jivesoftware/smack/Roster.java index 71372d244..8acc67bc4 100644 --- a/source/org/jivesoftware/smack/Roster.java +++ b/source/org/jivesoftware/smack/Roster.java @@ -784,7 +784,7 @@ public class Roster { RosterPacket rosterPacket = (RosterPacket) packet; for (RosterPacket.Item item : rosterPacket.getRosterItems()) { RosterEntry entry = new RosterEntry(item.getUser(), item.getName(), - item.getItemType(), item.getItemStatus(), connection); + item.getItemType(), item.getItemStatus(), Roster.this, connection); // If the packet is of the type REMOVE then remove the entry if (RosterPacket.ItemType.remove.equals(item.getItemType())) { diff --git a/source/org/jivesoftware/smack/RosterEntry.java b/source/org/jivesoftware/smack/RosterEntry.java index f431c20da..b352969dc 100644 --- a/source/org/jivesoftware/smack/RosterEntry.java +++ b/source/org/jivesoftware/smack/RosterEntry.java @@ -37,7 +37,8 @@ public class RosterEntry { private String name; private RosterPacket.ItemType type; private RosterPacket.ItemStatus status; - private Connection connection; + final private Roster roster; + final private Connection connection; /** * Creates a new roster entry. @@ -49,11 +50,12 @@ public class RosterEntry { * @param connection a connection to the XMPP server. */ RosterEntry(String user, String name, RosterPacket.ItemType type, - RosterPacket.ItemStatus status, Connection connection) { + RosterPacket.ItemStatus status, Roster roster, Connection connection) { this.user = user; this.name = name; this.type = type; this.status = status; + this.roster = roster; this.connection = connection; } @@ -114,7 +116,7 @@ public class RosterEntry { List results = new ArrayList(); // Loop through all roster groups and find the ones that contain this // entry. This algorithm should be fine - for (RosterGroup group: connection.getRoster().getGroups()) { + for (RosterGroup group: roster.getGroups()) { if (group.contains(this)) { results.add(group); }