Java Code Examples for org.jivesoftware.smack.RosterEntry#getStatus()

The following examples show how to use org.jivesoftware.smack.RosterEntry#getStatus() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XMPPContact.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a new XMPPContact from RosterEntry.
 *
 * @param entry RosterEntry
 * @return new XMPPContact
 */
static XMPPContact from(RosterEntry entry) {
  ContactStatus baseStatus;
  if (entry.getStatus() == RosterPacket.ItemStatus.SUBSCRIPTION_PENDING) {
    baseStatus = ContactStatus.TYPE_SUBSCRIPTION_PENDING;
  } else if (entry.getType() == ItemType.none || entry.getType() == ItemType.from) {
    /* see http://xmpp.org/rfcs/rfc3921.html chapter 8.2.1, 8.3.1 and 8.6 */
    baseStatus = ContactStatus.TYPE_SUBSCRIPTION_CANCELED;
  } else {
    baseStatus = ContactStatus.TYPE_OFFLINE;
  }

  return new XMPPContact(new JID(entry.getUser()), baseStatus, entry.getName());
}
 
Example 2
Source File: XMPPContactsService.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
private boolean handlePendingSubscription(XMPPContact contact, RosterEntry entry) {
  if (entry.getStatus() == ItemStatus.SUBSCRIPTION_PENDING)
    return contact.setBaseStatus(ContactStatus.TYPE_SUBSCRIPTION_PENDING);
  return false;
}