if (disconnectCalled) {
throw new IMException("Unable to send message cause the IM connection is been " +
"disconnected");
}
if (loginProcessed && loggedIn) {
ImConversation imConversation = aimConnection.getIcbmService()
.getImConversation(new Screenname(to));
imConversation.open();
imConversation.addConversationListener(new AimConversationListener());
if (imConversation.canSendMessage()) {
messageCount++;
imConversation.sendMessage(new SimpleMessage(message));
} else {
log.error("Cound not send the message to: " + to);
throw new IMException("Cound not send the message to: " + to);
}
imConversation.close();
} else {
log.error("Got to Log in before a message can be sent.");
throw new IMException("Got to Log in before a message can be sent.");
}
}