@Override
protected void messageReceived(MsnSession session) {
super.messageReceived(session);
MsnMessenger messenger = session.getMessenger();
MsnContactList contactList = messenger.getContactList();
MsnMessageChain incoming = messenger.getIncomingMessageChain();
MsnContact contact = null;
for (MsnMessageIterator iter = incoming.iterator(); iter.hasPrevious();) {
MsnMessage message = iter.previous();
if (message instanceof IncomingBPR)
continue;
if (message instanceof IncomingLST) {
Email email = ((IncomingLST) message).getEmail();
contact = contactList.getContactByEmail(email);
} else if (message instanceof IncomingADC) {
Email email = ((IncomingADC) message).getEmail();
if (email == null) {
contact = contactList
.getContactById(((IncomingADC) message).getId());
} else {
contact = contactList.getContactByEmail(email);
}
} else if (message instanceof IncomingADD) {
Email email = ((IncomingADD) message).getEmail();
contact = contactList.getContactByEmail(email);
}
break;
}
if (contact != null) {