Hi
I have encountered a timing issue with Smack 1.4.1 and Messenger 2.0.1.
In XmppConnection.login(), it sends the Roster IQ followed by the Presence IQ after successfully logging on:
// Create the roster.
this.roster = new Roster(this);
roster.reload();
// Set presence to online.
packetWriter.sendPacket(new Presence(Presence.Type.AVAILABLE));
In my client code, this is what I do for logging on:
xmppConnection.login(userName, password, resource);
xmppConnection.getRoster().addRosterListener(this);
Roster roster = xmppConnection.getRoster();
populateRosterJTree(roster);
Now, before I finish populating the JTree, I have already received a Presence event from the server (a buddy is online), which causes the JTree to miss that presence.
I am hoping there’'s a way to finish populating the JTree before sending out the presence IQ, ie:
xmppConnection.loginDoNotSendPresence(userName, password, resource); // Do not send the presence packet
xmppConnection.getRoster().addRosterListener(this);
Roster roster = xmppConnection.getRoster();
populateRosterJTree(roster);
xmppConnection.sendPacket(new Presence(Presence.Type.AVAILABLE));
Or any other ideas would be appreciated.
Regards
Keith