}
public void sendPresenceUpdate(ID toID, IPresence presence)
throws ECFException {
if (presence == null || client == null) {
throw new ECFException();
}
IPresence.Mode mode = presence.getMode();
try {
client.setPersonalMessage(presence.getStatus());
if (presence.getType() == IPresence.Type.UNAVAILABLE) {
disconnect();
} else if (mode == IPresence.Mode.AVAILABLE
|| mode == IPresence.Mode.CHAT) {
client.setStatus(Status.ONLINE);
} else if (mode == IPresence.Mode.AWAY
|| mode == IPresence.Mode.EXTENDED_AWAY) {
client.setStatus(Status.AWAY);
} else if (mode == IPresence.Mode.DND) {
client.setStatus(Status.BUSY);
} else {
client.setStatus(Status.APPEAR_OFFLINE);
}
} catch (IOException e) {
throw new ECFException(e);
}
}