Commit 9e9d9840 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[JM-770] Simple modification to add MSN support for contact statuses.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@4632 b35dd754-fafc-0310-a699-88a17e54d16e
parent e1dfe38f
......@@ -14,7 +14,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;
import org.hn.sleek.jmml.Contact;
import org.hn.sleek.jmml.ContactChangeEvent;
import org.hn.sleek.jmml.ContactList;
import org.hn.sleek.jmml.ContactStatus;
import org.hn.sleek.jmml.IncomingMessageEvent;
import org.hn.sleek.jmml.MessengerClientAdapter;
import org.hn.sleek.jmml.MSNException;
......@@ -82,6 +84,48 @@ public class MSNListener extends MessengerClientAdapter {
}
}
/**
* A property of a contact has changed.
*
* This can be a myriad of things that have changed.
*
* @param event An event instance for the change.
*/
public void contactPropertyChanged(ContactChangeEvent event) {
int propid = event.getProperty();
if (propid == Contact.STATUS) {
String newstatus = (String)event.getNewValue();
Presence p = new Presence();
p.setTo(msnSession.getJID());
p.setFrom(msnSession.getTransport().convertIDToJID(event.getUserName()));
if (newstatus.equals(ContactStatus.ONLINE)) {
// We're good, send as is..
}
else if (newstatus.equals(ContactStatus.AWAY)) {
p.setShow(Presence.Show.away);
}
else if (newstatus.equals(ContactStatus.BE_RIGHT_BACK)) {
p.setShow(Presence.Show.away);
}
else if (newstatus.equals(ContactStatus.BUSY)) {
p.setShow(Presence.Show.dnd);
}
else if (newstatus.equals(ContactStatus.IDLE)) {
p.setShow(Presence.Show.away);
}
else if (newstatus.equals(ContactStatus.OFFLINE)) {
p.setType(Presence.Type.unavailable);
}
else if (newstatus.equals(ContactStatus.ON_THE_PHONE)) {
p.setShow(Presence.Show.dnd);
}
else if (newstatus.equals(ContactStatus.OUT_TO_LUNCH)) {
p.setShow(Presence.Show.xa);
}
msnSession.getTransport().sendPacket(p);
}
}
/**
* Someone has added user to their contact list
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment