@Override
protected void messageReceived(MsnSession session) {
super.messageReceived(session);
MsnSwitchboard switchboard = session.getSwitchboard();
if (switchboard != null) {
MsnMessenger messenger = session.getMessenger();
MsnContactImpl contact = (MsnContactImpl) messenger
.getContactList().getContactByEmail(getEmail());
if (contact == null) {
contact = new MsnContactImpl(messenger.getContactList());
contact.setEmail(getEmail());
}
((AbstractSwitchboard) switchboard).removeContact(contact);
((AbstractMessenger) messenger).fireContactLeaveSwitchboard(
switchboard, contact);
if (switchboard.getAllContacts().length == 0) {
switchboard.close();
}
}
}