public class QBRoster
extends java.lang.Object
Others users may attempt to subscribe to this user using a subscription request. Two modes are supported for handling these requests:
org.jivesoftware.smack.roster.Roster
Modifier and Type | Class and Description |
---|---|
static class |
QBRoster.SubscriptionMode
An enumeration for the subscription mode options.
|
Modifier | Constructor and Description |
---|---|
protected |
QBRoster(XMPPConnection connection) |
protected |
QBRoster(XMPPConnection connection,
QBRoster.SubscriptionMode mode,
QBSubscriptionListener subscriptionListener) |
Modifier and Type | Method and Description |
---|---|
void |
addRosterListener(QBRosterListener listener)
Adds a listener to this roster.
|
void |
addSubscriptionListener(QBSubscriptionListener listener)
Adds the subscription listener
|
void |
confirmSubscription(int userId)
Confirms subscription request.
|
void |
confirmSubscription(int userId,
QBEntityCallback<java.lang.Void> callback) |
boolean |
contains(int userId)
Returns true if the specified user is an entry in the roster.
|
void |
createEntry(int userId,
java.lang.String[] groups)
Creates a new roster entry and presence subscription.
|
void |
createEntry(int userId,
java.lang.String[] groups,
QBEntityCallback<java.lang.Void> callback) |
QBRosterGroup |
createGroup(java.lang.String name)
Creates a new group.
|
java.util.Collection<QBRosterEntry> |
getEntries()
Returns an unmodifiable collection of all entries in the roster, including entries
that don't belong to any groups.
|
QBRosterEntry |
getEntry(int userId)
Returns the roster entry associated with the given user identifier or
null if the user is not an entry in the roster.
|
int |
getEntryCount()
Returns a count of the entries in the roster.
|
QBRosterGroup |
getGroup(java.lang.String name)
Returns the roster group with the specified name, or null if the
group doesn't exist.
|
int |
getGroupCount()
Returns the number of the groups in the roster.
|
java.util.Collection<QBRosterGroup> |
getGroups()
Returns an unmodifiable collections of all the roster groups.
|
QBPresence |
getPresence(int userId)
Returns the presence info for a particular user.
|
QBRoster.SubscriptionMode |
getSubscriptionMode()
Gets roster mode.
|
java.util.Collection<QBRosterEntry> |
getUnfiledEntries()
Returns an unmodifiable collection for the unfiled roster entries.
|
int |
getUnfiledEntryCount()
Returns a count of the unfiled entries in the roster.
|
protected void |
notifyFailResult(QBEntityCallback callback,
java.lang.String error) |
protected void |
notifySuccessResult(QBEntityCallback callback) |
void |
reject(int userId)
Rejects subscription request.
|
void |
reject(int userId,
QBEntityCallback<java.lang.Void> callback) |
void |
reload()
Reloads the entire roster from the server.
|
void |
removeEntry(QBRosterEntry entry)
Removes a roster entry from the roster.
|
void |
removeEntry(QBRosterEntry entry,
QBEntityCallback<java.lang.Void> callback) |
void |
removeRosterListener(QBRosterListener listener)
Removes roster listener
|
void |
removeSubscriptionListener(QBSubscriptionListener listener)
Removes the subscription listener
|
void |
sendPresence(QBPresence presence)
Sends presence
|
void |
sendPresence(QBPresence presence,
QBEntityCallback<java.lang.Void> callback) |
void |
setSubscriptionMode(QBRoster.SubscriptionMode subscriptionMode)
Sets roster mode.
|
void |
subscribe(int userId)
Subscribes to user (adds to the contact list).
|
void |
subscribe(int userId,
QBEntityCallback<java.lang.Void> callback) |
void |
unsubscribe(int userId)
Subscribes from user (removes from the contact list).
|
void |
unsubscribe(int userId,
QBEntityCallback<java.lang.Void> callback) |
protected QBRoster(XMPPConnection connection, QBRoster.SubscriptionMode mode, QBSubscriptionListener subscriptionListener)
protected QBRoster(XMPPConnection connection)
public void reload() throws SmackException.NotLoggedInException, SmackException.NotConnectedException
SmackException.NotLoggedInException
SmackException.NotConnectedException
public QBRoster.SubscriptionMode getSubscriptionMode()
public void setSubscriptionMode(QBRoster.SubscriptionMode subscriptionMode)
subscriptionMode
- The roster mode to set.public QBRosterGroup createGroup(java.lang.String name) throws SmackException.NotLoggedInException
name
- The name of the group.SmackException.NotLoggedInException
public QBRosterGroup getGroup(java.lang.String name)
name
- the name of the group.public int getGroupCount()
public java.util.Collection<QBRosterGroup> getGroups()
public void createEntry(int userId, java.lang.String[] groups) throws XMPPException, SmackException.NotLoggedInException, SmackException.NotConnectedException, SmackException.NoResponseException
groups
- the list of group names the entry will belong to, or null if the
the roster entry won't belong to a group.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the server.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if an XMPP exception occurs.org.jivesoftware.smack.SmackException.NotLoggedInException
- If not logged in.org.jivesoftware.smack.SmackException.NotConnectedException
XMPPException
SmackException.NotLoggedInException
SmackException.NotConnectedException
SmackException.NoResponseException
public void createEntry(int userId, java.lang.String[] groups, QBEntityCallback<java.lang.Void> callback)
public void removeEntry(QBRosterEntry entry) throws XMPPException, SmackException.NotLoggedInException, SmackException.NotConnectedException, SmackException.NoResponseException
entry
- a roster entry.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if an XMPP error occurs.org.jivesoftware.smack.SmackException.NotLoggedInException
- if not logged in.org.jivesoftware.smack.SmackException.NoResponseException
- SmackException if there was no response from the server.org.jivesoftware.smack.SmackException.NotConnectedException
java.lang.IllegalStateException
- if connection is not logged in or logged in anonymouslyXMPPException
SmackException.NotLoggedInException
SmackException.NotConnectedException
SmackException.NoResponseException
public void removeEntry(QBRosterEntry entry, QBEntityCallback<java.lang.Void> callback)
public int getEntryCount()
public java.util.Collection<QBRosterEntry> getEntries()
public int getUnfiledEntryCount()
public java.util.Collection<QBRosterEntry> getUnfiledEntries()
public QBRosterEntry getEntry(int userId)
public boolean contains(int userId)
public QBPresence getPresence(int userId)
userId
- requested user identifierpublic void sendPresence(QBPresence presence) throws SmackException.NotConnectedException
presence
- The instance of QBPresenceSmackException.NotConnectedException
QBPresence
public void sendPresence(QBPresence presence, QBEntityCallback<java.lang.Void> callback)
public void addSubscriptionListener(QBSubscriptionListener listener)
listener
- The subscription listener to addQBSubscriptionListener
public void removeSubscriptionListener(QBSubscriptionListener listener)
listener
- The subscription listener to removeQBSubscriptionListener
public void addRosterListener(QBRosterListener listener)
listener
- a roster listener.QBRosterListener
public void removeRosterListener(QBRosterListener listener)
listener
- a roster listener.QBRosterListener
public void confirmSubscription(int userId) throws SmackException.NotConnectedException, SmackException.NotLoggedInException, XMPPException, SmackException.NoResponseException
userId
- The ID of a user who requested subscription.SmackException.NotConnectedException
SmackException.NotLoggedInException
XMPPException
SmackException.NoResponseException
public void confirmSubscription(int userId, QBEntityCallback<java.lang.Void> callback)
public void subscribe(int userId) throws SmackException.NotConnectedException
userId
- requested user ID.SmackException.NotConnectedException
public void subscribe(int userId, QBEntityCallback<java.lang.Void> callback)
public void unsubscribe(int userId) throws SmackException.NotConnectedException
userId
- requested user ID.SmackException.NotConnectedException
public void unsubscribe(int userId, QBEntityCallback<java.lang.Void> callback)
public void reject(int userId) throws SmackException.NotConnectedException
userId
- The user ID to reject subscription request.SmackException.NotConnectedException
public void reject(int userId, QBEntityCallback<java.lang.Void> callback)
protected void notifySuccessResult(QBEntityCallback callback)
protected void notifyFailResult(QBEntityCallback callback, java.lang.String error)