Class RosterExchangeManager

java.lang.Object
org.jivesoftware.smackx.xroster.RosterExchangeManager

public class RosterExchangeManager extends Object
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 Details

  • Constructor Details

    • RosterExchangeManager

      public RosterExchangeManager(org.jivesoftware.smack.XMPPConnection connection)
      Creates a new roster exchange manager.
      Parameters:
      connection - an XMPPConnection which is used to send and receive messages.
  • Method Details

    • getInstanceFor

      public static RosterExchangeManager getInstanceFor(org.jivesoftware.smack.XMPPConnection connection)
    • addRosterListener

      public void addRosterListener(RosterExchangeListener rosterExchangeListener)
      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

      public void removeRosterListener(RosterExchangeListener rosterExchangeListener)
      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(org.jivesoftware.smack.roster.Roster roster, org.jxmpp.jid.Jid targetUserID) throws org.jivesoftware.smack.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 send
      targetUserID - the user that will receive the roster entries
      Throws:
      org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
      InterruptedException - if the calling thread was interrupted.
    • send

      public void send(org.jivesoftware.smack.roster.RosterEntry rosterEntry, org.jxmpp.jid.Jid targetUserID) throws org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Sends a roster entry to userID.
      Parameters:
      rosterEntry - the roster entry to send
      targetUserID - the user that will receive the roster entries
      Throws:
      org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
      InterruptedException - if the calling thread was interrupted.
    • send

      public void send(org.jivesoftware.smack.roster.RosterGroup rosterGroup, org.jxmpp.jid.Jid targetUserID) throws org.jivesoftware.smack.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 send
      targetUserID - the user that will receive the roster entries
      Throws:
      org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
      InterruptedException - if the calling thread was interrupted.