Hello,
In our project we use “Offline Message Retrieval” and custom “Last Presence” extensions.
For the offline messages we open a connection with builder.setSendPresence(false);
Because of the following code in AbstractXMPPConnection:
if (config.isSendPresence() && !resumed) {
sendStanza(new Presence(Presence.Type.available));
}
The presence is not being sent, which is correct.
But later, when we disconnect, in the
public synchronized void disconnect(Presence unavailablePresence) throws NotConnectedException {
try {
sendStanza(unavailablePresence);
}
The presence stanza is being sent regardless the **setSendPresence(false). **This is causing the problem that the Last Presence extension is not working correctly.
So, our suggestion is to change the disconnect method to:
public synchronized void disconnect(Presence unavailablePresence) throws NotConnectedException {
if (config.isSendPresence()) {
try {
sendStanza(unavailablePresence);
}
catch (InterruptedException e) {
LOGGER.log(Level.FINE, “Was interrupted while sending unavailable presence. Continuing to disconnect the connection”, e);
}
}
Do you have any objections? Or can we apply the changes above to the code?
Dmitry.