Package org.jivesoftware.smackx.xroster
Class RosterExchangeManager
java.lang.Object
org.jivesoftware.smackx.xroster.RosterExchangeManager
Manages Roster exchanges. A RosterExchangeManager provides high level access to send
rosters, roster groups and roster entries to XMPP clients. It also provides an easy way
to hook up custom logic when entries are received from another XMPP client through
RosterExchangeListeners.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionRosterExchangeManager
(XMPPConnection connection) Creates a new roster exchange manager. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRosterListener
(RosterExchangeListener rosterExchangeListener) Adds a listener to roster exchanges.static RosterExchangeManager
getInstanceFor
(XMPPConnection connection) void
removeRosterListener
(RosterExchangeListener rosterExchangeListener) Removes a listener from roster exchanges.void
send
(RosterEntry rosterEntry, Jid targetUserID) Sends a roster entry to userID.void
send
(RosterGroup rosterGroup, Jid targetUserID) Sends a roster group to userID.void
Sends a roster to userID.
-
Field Details
-
NAMESPACE
- See Also:
-
ELEMENT
- See Also:
-
-
Constructor Details
-
RosterExchangeManager
Creates a new roster exchange manager.- Parameters:
connection
- an XMPPConnection which is used to send and receive messages.
-
-
Method Details
-
getInstanceFor
-
addRosterListener
Adds a listener to roster exchanges. The listener will be fired anytime roster entries are received from remote XMPP clients.- Parameters:
rosterExchangeListener
- a roster exchange listener.
-
removeRosterListener
Removes a listener from roster exchanges. The listener will be fired anytime roster entries are received from remote XMPP clients.- Parameters:
rosterExchangeListener
- a roster exchange listener.
-
send
public void send(Roster roster, Jid targetUserID) throws SmackException.NotConnectedException, InterruptedException Sends a roster to userID. All the entries of the roster will be sent to the target user.- Parameters:
roster
- the roster to sendtargetUserID
- the user that will receive the roster entries- Throws:
SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-
send
public void send(RosterEntry rosterEntry, Jid targetUserID) throws SmackException.NotConnectedException, InterruptedException Sends a roster entry to userID.- Parameters:
rosterEntry
- the roster entry to sendtargetUserID
- the user that will receive the roster entries- Throws:
SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-
send
public void send(RosterGroup rosterGroup, Jid targetUserID) throws SmackException.NotConnectedException, InterruptedException Sends a roster group to userID. All the entries of the group will be sent to the target user.- Parameters:
rosterGroup
- the roster group to sendtargetUserID
- the user that will receive the roster entries- Throws:
SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-