/** * Returns true if the specified user is a member of the roster, false otherwise. * * @param user the user object to check. * @return true if the specified user is a member of the roster, false otherwise. */ public boolean isRosterItem(JID user) { // Optimization: Check if the contact has a FROM subscription due to shared groups // (only when not present in the rosterItems collection) return rosterItems.containsKey(user.toBareJID()) || getImplicitRosterItem(user) != null; }
/** * Returns the roster item that is associated with the specified JID. If no roster item * was found then a UserNotFoundException will be thrown. * * @param user the XMPPAddress for the roster item to retrieve * @return The roster item associated with the user XMPPAddress. * @throws UserNotFoundException if no roster item was found for the specified JID. */ public RosterItem getRosterItem(JID user) throws UserNotFoundException { RosterItem item = rosterItems.get(user.toBareJID()); if (item == null) { // Optimization: Check if the contact has a FROM subscription due to shared groups item = getImplicitRosterItem(user); if (item == null) { throw new UserNotFoundException(user.toBareJID()); } } return item; }
RosterItem item = getImplicitRosterItem(user); if (item != null) { implicitFrom.remove(user.toBareJID());
/** * Returns true if the specified user is a member of the roster, false otherwise. * * @param user the user object to check. * @return true if the specified user is a member of the roster, false otherwise. */ public boolean isRosterItem(JID user) { // Optimization: Check if the contact has a FROM subscription due to shared groups // (only when not present in the rosterItems collection) return rosterItems.containsKey(user.toBareJID()) || getImplicitRosterItem(user) != null; }
/** * Returns the roster item that is associated with the specified JID. If no roster item * was found then a UserNotFoundException will be thrown. * * @param user the XMPPAddress for the roster item to retrieve * @return The roster item associated with the user XMPPAddress. * @throws UserNotFoundException if no roster item was found for the specified JID. */ public RosterItem getRosterItem(JID user) throws UserNotFoundException { RosterItem item = rosterItems.get(user.toBareJID()); if (item == null) { // Optimization: Check if the contact has a FROM subscription due to shared groups item = getImplicitRosterItem(user); if (item == null) { throw new UserNotFoundException(user.toBareJID()); } } return item; }
RosterItem item = getImplicitRosterItem(user); if (item != null) { implicitFrom.remove(user.toBareJID());