1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 09:39:39 +02:00

Wait for server response before returning roster.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1867 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2003-04-07 05:40:28 +00:00 committed by mtucker
parent d77787f67c
commit af4ea681ee
4 changed files with 42 additions and 11 deletions

View file

@ -68,6 +68,9 @@ public class Roster {
private XMPPConnection connection;
private Map groups;
// The roster is marked as initialized when at least a single roster packet
// has been recieved and processed.
boolean rosterInitialized = false;
Roster(final XMPPConnection connection) {
this.connection = connection;
@ -163,8 +166,7 @@ public class Roster {
RosterPacket rosterPacket = (RosterPacket)packet;
for (Iterator i=rosterPacket.getRosterItems(); i.hasNext(); ) {
RosterPacket.Item item = (RosterPacket.Item)i.next();
RosterEntry entry = new RosterEntry(item.getUser(), item.getName(),
connection);
RosterEntry entry = new RosterEntry(item.getUser(), item.getName(), connection);
// Find the list of groups that the user currently belongs to.
List currentGroupNames = new ArrayList();
for (Iterator j = entry.getGroups(); j.hasNext(); ) {
@ -206,6 +208,9 @@ public class Roster {
}
}
}
// Mark the roster as initialized.
rosterInitialized = true;
}
}
}