2003-04-13 06:51:37 +02:00
|
|
|
/**
|
|
|
|
*
|
2007-02-12 01:56:47 +01:00
|
|
|
* Copyright 2003-2007 Jive Software.
|
2003-04-13 06:51:37 +02:00
|
|
|
*
|
2014-02-17 18:57:38 +01:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
2004-11-03 00:53:30 +01:00
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2003-04-13 06:51:37 +02:00
|
|
|
*
|
2004-11-03 00:53:30 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2003-04-13 06:51:37 +02:00
|
|
|
*
|
2004-11-03 00:53:30 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2003-04-13 06:51:37 +02:00
|
|
|
*/
|
|
|
|
|
2015-01-22 13:53:50 +01:00
|
|
|
package org.jivesoftware.smack.roster;
|
2003-04-13 06:51:37 +02:00
|
|
|
|
2007-02-12 01:56:47 +01:00
|
|
|
import org.jivesoftware.smack.packet.Presence;
|
2015-02-14 17:15:02 +01:00
|
|
|
import org.jxmpp.jid.Jid;
|
2007-02-12 01:56:47 +01:00
|
|
|
|
2005-11-04 19:31:21 +01:00
|
|
|
import java.util.Collection;
|
|
|
|
|
2003-04-13 06:51:37 +02:00
|
|
|
/**
|
2003-08-21 05:30:25 +02:00
|
|
|
* A listener that is fired any time a roster is changed or the presence of
|
|
|
|
* a user in the roster is changed.
|
2006-05-30 23:53:50 +02:00
|
|
|
*
|
|
|
|
* @see Roster#addRosterListener(RosterListener)
|
2003-04-13 06:51:37 +02:00
|
|
|
* @author Matt Tucker
|
|
|
|
*/
|
|
|
|
public interface RosterListener {
|
|
|
|
|
|
|
|
/**
|
2005-11-04 19:31:21 +01:00
|
|
|
* Called when roster entries are added.
|
|
|
|
*
|
|
|
|
* @param addresses the XMPP addresses of the contacts that have been added to the roster.
|
|
|
|
*/
|
2015-02-14 17:15:02 +01:00
|
|
|
public void entriesAdded(Collection<Jid> addresses);
|
2005-11-04 19:31:21 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a roster entries are updated.
|
|
|
|
*
|
|
|
|
* @param addresses the XMPP addresses of the contacts whose entries have been updated.
|
|
|
|
*/
|
2015-02-14 17:15:02 +01:00
|
|
|
public void entriesUpdated(Collection<Jid> addresses);
|
2005-11-04 19:31:21 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a roster entries are removed.
|
|
|
|
*
|
|
|
|
* @param addresses the XMPP addresses of the contacts that have been removed from the roster.
|
2003-04-13 06:51:37 +02:00
|
|
|
*/
|
2015-02-14 17:15:02 +01:00
|
|
|
public void entriesDeleted(Collection<Jid> addresses);
|
2003-04-13 06:51:37 +02:00
|
|
|
|
2003-08-21 05:30:25 +02:00
|
|
|
/**
|
2007-02-12 01:56:47 +01:00
|
|
|
* Called when the presence of a roster entry is changed. Care should be taken
|
|
|
|
* when using the presence data delivered as part of this event. Specifically,
|
|
|
|
* when a user account is online with multiple resources, the UI should account
|
|
|
|
* for that. For example, say a user is online with their desktop computer and
|
|
|
|
* mobile phone. If the user logs out of the IM client on their mobile phone, the
|
|
|
|
* user should not be shown in the roster (contact list) as offline since they're
|
|
|
|
* still available as another resource.<p>
|
|
|
|
*
|
|
|
|
* To get the current "best presence" for a user after the presence update, query the roster:
|
|
|
|
* <pre>
|
|
|
|
* String user = presence.getFrom();
|
|
|
|
* Presence bestPresence = roster.getPresence(user);
|
|
|
|
* </pre>
|
2003-08-21 05:30:25 +02:00
|
|
|
*
|
2007-02-12 01:56:47 +01:00
|
|
|
* That will return the presence value for the user with the highest priority and
|
|
|
|
* availability.
|
|
|
|
*
|
2010-01-12 12:28:01 +01:00
|
|
|
* Note that this listener is triggered for presence (mode) changes only
|
|
|
|
* (e.g presence of types available and unavailable. Subscription-related
|
|
|
|
* presence packets will not cause this method to be called.
|
|
|
|
*
|
2007-02-12 01:56:47 +01:00
|
|
|
* @param presence the presence that changed.
|
2015-12-19 13:30:15 +01:00
|
|
|
* @see Roster#getPresence(org.jxmpp.jid.BareJid)
|
2003-08-21 05:30:25 +02:00
|
|
|
*/
|
2007-02-12 01:56:47 +01:00
|
|
|
public void presenceChanged(Presence presence);
|
2014-02-17 23:58:40 +01:00
|
|
|
}
|