Examples of RosterItem


Examples of org.jivesoftware.openfire.roster.RosterItem

        XMPPServer server = XMPPServer.getInstance();
        // Check that the node owner is a local user
        if (server.isLocal(nodeOwner)) {
            try {
                Roster roster = server.getRosterManager().getRoster(nodeOwner.getNode());
                RosterItem item = roster.getRosterItem(owner);
                // Check that the subscriber is subscribe to the node owner's presence
                boolean isSubscribed = item != null && (
                        RosterItem.SUB_BOTH == item.getSubStatus() ||
                                RosterItem.SUB_FROM == item.getSubStatus());
                if (isSubscribed) {
                    // Get list of groups where the contact belongs
                    List<String> contactGroups = new ArrayList<String>(item.getGroups());
                    for (Group group : item.getSharedGroups()) {
                        contactGroups.add(group.getName());
                    }
                    for (Group group : item.getInvisibleSharedGroups()) {
                        contactGroups.add(group.getName());
                    }
                    // Check if subscriber is present in the allowed groups of the node
                    return contactGroups.removeAll(node.getRosterGroupsAllowed());
                }
View Full Code Here

Examples of org.jivesoftware.openfire.roster.RosterItem

        XMPPServer server = XMPPServer.getInstance();
        // Check that the node owner is a local user
        if (server.isLocal(nodeOwner)) {
            try {
                Roster roster = server.getRosterManager().getRoster(nodeOwner.getNode());
                RosterItem item = roster.getRosterItem(owner);
                // Check that the subscriber is subscribe to the node owner's presence
                return item != null && (RosterItem.SUB_BOTH == item.getSubStatus() ||
                        RosterItem.SUB_FROM == item.getSubStatus());
            }
            catch (UserNotFoundException e) {
                return false;
            }
        }
View Full Code Here

Examples of org.jivesoftware.openfire.roster.RosterItem

        }
        else if (type == Type.group) {
            Collection<String> contactGroups;
            try {
                // Get the groups where the contact belongs
                RosterItem item = roster.getRosterItem(jid);
                contactGroups = item.getGroups();
            }
            catch (UserNotFoundException e) {
                // Sender is not in the user's roster
                contactGroups = Collections.emptyList();
            }
            // Check if the contact belongs to the specified group
            return contactGroups.contains(groupValue);
        }
        else {
            RosterItem.SubType contactSubscription = RosterItem.SUB_NONE;
            try {
                // Get the groups where the contact belongs
                RosterItem item = roster.getRosterItem(jid);
                contactSubscription = item.getSubStatus();
            }
            catch (UserNotFoundException e) {
                // Sender is not in the user's roster
            }
            // Check if the contact has the specified subscription status
View Full Code Here

Examples of org.onesocialweb.gwt.service.RosterItem

    // Display the presence
    if (activity.getActor().getUri().equals(service.getUserBareJID())) {
      setPresence(service.getPresence());
    } else {
      final RosterItem rosterItem = service.getRoster().getItem(
          activity.getActor().getUri());
      if (rosterItem != null) {
        setPresence(rosterItem.getPresence());
        rosterItem.registerEventHandler(new Observer<RosterEvent>() {

          @Override
          public void handleEvent(RosterEvent event) {
            setPresence(rosterItem.getPresence());
          }

        });
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.