Java Code Examples for org.xmpp.packet.JID#toBareJID()

The following examples show how to use org.xmpp.packet.JID#toBareJID() . 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: PresenceUpdateHandler.java    From Openfire with Apache License 2.0 6 votes vote down vote up
public boolean hasDirectPresence(JID ownerJID, JID recipientJID) {
    if (recipientJID == null) {
        return false;
    }
    Collection<DirectedPresence> directedPresences = directedPresencesCache.get(ownerJID.toString());
    if (directedPresences != null) {
        String recipient = recipientJID.toBareJID();
        for (DirectedPresence directedPresence : directedPresences) {
            for (String receiver : directedPresence.getReceivers()) {
                if (receiver.contains(recipient)) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example 2
Source File: Roster.java    From Openfire with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 3
Source File: GroupManager.java    From Openfire with Apache License 2.0 4 votes vote down vote up
private String getUserGroupsKey(final JID user) {
    return USER_GROUPS_KEY + user.toBareJID();
}