Search in sources :

Example 1 with Contact

use of net.sf.jmyspaceiml.contact.Contact in project Openfire by igniterealtime.

the class MySpaceIMListener method contactListUpdateReceived.

public void contactListUpdateReceived() {
    Log.debug("MySpaceIM: Got contact list.");
    List<Contact> contacts = getSession().getConnection().getContactManager().getContacts();
    for (Contact contact : contacts) {
        MySpaceIMBuddy buddy;
        try {
            buddy = getSession().getBuddyManager().getBuddy(getSession().getTransport().convertIDToJID(String.valueOf(contact.getContactID())));
        } catch (NotFoundException e) {
            buddy = new MySpaceIMBuddy(getSession().getBuddyManager(), contact.getContactID());
            getSession().getBuddyManager().storeBuddy(buddy);
        }
    }
    try {
        getSession().getTransport().syncLegacyRoster(getSession().getJID(), getSession().getBuddyManager().getBuddies());
    } catch (UserNotFoundException e) {
        Log.debug("Unable to sync MySpaceIM contact list for " + getSession().getJID(), e);
    }
    getSession().getBuddyManager().activate();
}
Also used : UserNotFoundException(org.jivesoftware.openfire.user.UserNotFoundException) UserNotFoundException(org.jivesoftware.openfire.user.UserNotFoundException) NotFoundException(org.jivesoftware.util.NotFoundException) Contact(net.sf.jmyspaceiml.contact.Contact)

Aggregations

Contact (net.sf.jmyspaceiml.contact.Contact)1 UserNotFoundException (org.jivesoftware.openfire.user.UserNotFoundException)1 NotFoundException (org.jivesoftware.util.NotFoundException)1