mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 08:12:05 +01:00
Make disconnect() not throw NotConnectedException
while disconnect(Presence) still does to notify the user that the unavailable presence was not send.
This commit is contained in:
parent
eb6b8df7c5
commit
fc14962445
1 changed files with 7 additions and 7 deletions
|
@ -643,11 +643,15 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* the XMPP server. The XMPPConnection can still be used for connecting to the server
|
* the XMPP server. The XMPPConnection can still be used for connecting to the server
|
||||||
* again.
|
* again.
|
||||||
*
|
*
|
||||||
* @throws NotConnectedException
|
|
||||||
*/
|
*/
|
||||||
public void disconnect() throws NotConnectedException {
|
public void disconnect() {
|
||||||
|
try {
|
||||||
disconnect(new Presence(Presence.Type.unavailable));
|
disconnect(new Presence(Presence.Type.unavailable));
|
||||||
}
|
}
|
||||||
|
catch (NotConnectedException e) {
|
||||||
|
LOGGER.log(Level.FINEST, "Connection is already disconnected", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the connection. A custom unavailable presence is sent to the server, followed
|
* Closes the connection. A custom unavailable presence is sent to the server, followed
|
||||||
|
@ -661,10 +665,6 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
* @throws NotConnectedException
|
* @throws NotConnectedException
|
||||||
*/
|
*/
|
||||||
public synchronized void disconnect(Presence unavailablePresence) throws NotConnectedException {
|
public synchronized void disconnect(Presence unavailablePresence) throws NotConnectedException {
|
||||||
if (!isConnected()) {
|
|
||||||
throw new NotConnectedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
sendPacket(unavailablePresence);
|
sendPacket(unavailablePresence);
|
||||||
shutdown();
|
shutdown();
|
||||||
callConnectionClosedListener();
|
callConnectionClosedListener();
|
||||||
|
|
Loading…
Reference in a new issue