User can remain in MUC room after session is closed

Client XML to reproduce this bug:

This isn’'t only way to have this error.

when you first login but before you join the chat room, a client is supposed to send a presence packet to the server to indicate their availability.

I know, but I listed only one way to reproduce. I have such ghosts in MUC when client sending available presence.

In addition, section 5.1.1 of RFC 3921 says that "After establishing a session, a client SHOULD send initial presence to

the server in order to signal its availability for communications". So, client is SHOULD, but not MUST.

The code closing client session need to be reviewed. This is my temporary solution:

Index: SessionManager.java

===================================================================

— SessionManager.java (revision 8984)

+++ SessionManager.java (working copy)

@@ -989,7 +989,7 @@

AuthToken authToken = session.getAuthToken();

// Consider session anonymous (for this matter) if we are closing a session that never authenticated

boolean anonymous = authToken == null || authToken.isAnonymous();

  •    return removeSession(session, session.getAddress(), anonymous, false);
    
  •    return removeSession(session, session.getAddress(), anonymous, true);
    

}

/**

@@ -1086,7 +1086,7 @@

public void onConnectionClose(Object handback) {

try {

LocalClientSession session = (LocalClientSession) handback;

  •            try {
    

+/* try {

if ((session.getPresence().isAvailable() || !session.wasAvailable()) &&

routingTable.hasClientRoute(session.getAddress())) {

// Send an unavailable presence to the user’s subscribers

@@ -1098,10 +1098,10 @@

router.route(presence);

}

}

  •            finally {
    
  •            finally {*/
    

// Remove the session

removeSession(session);

  •            }
    

+// }

}

catch (Exception e) {

// Can’t do anything about this problem…

/code