Load roster before sending the initial presence

SMACK-596
This commit is contained in:
Florian Schmaus 2014-08-18 18:48:57 +02:00
parent f9542c1be3
commit 9eb5c2a49d
2 changed files with 16 additions and 10 deletions

View File

@ -277,11 +277,6 @@ public class XMPPBOSHConnection extends XMPPConnection {
}
}
// Set presence to online.
if (config.isSendPresence()) {
sendPacket(new Presence(Presence.Type.available));
}
// Indicate that we're now authenticated.
authenticated = true;
anonymous = false;
@ -296,6 +291,14 @@ public class XMPPBOSHConnection extends XMPPConnection {
debugger.userHasLogged(user);
}
callConnectionAuthenticatedListener();
// Set presence to online. It is important that this is done after
// callConnectionAuthenticatedListener(), as this call will also
// eventually load the roster. And we should load the roster before we
// send the initial presence.
if (config.isSendPresence()) {
sendPacket(new Presence(Presence.Type.available));
}
}
public void loginAnonymously() throws XMPPException, SmackException, IOException {

View File

@ -274,11 +274,6 @@ public class XMPPTCPConnection extends XMPPConnection {
authenticated = true;
anonymous = false;
// Set presence to online.
if (config.isSendPresence()) {
sendPacket(new Presence(Presence.Type.available));
}
// Stores the authentication for future reconnection
setLoginInfo(username, password, resource);
@ -290,6 +285,14 @@ public class XMPPTCPConnection extends XMPPConnection {
debugger.userHasLogged(user);
}
callConnectionAuthenticatedListener();
// Set presence to online. It is important that this is done after
// callConnectionAuthenticatedListener(), as this call will also
// eventually load the roster. And we should load the roster before we
// send the initial presence.
if (config.isSendPresence()) {
sendPacket(new Presence(Presence.Type.available));
}
}
@Override