Examples of Roster


Examples of org.jivesoftware.openfire.roster.Roster

                }
                return;
            }

            try {
                Roster senderRoster = getRoster(senderJID);
                if (senderRoster != null) {
                    manageSub(recipientJID, true, type, senderRoster);
                }
                Roster recipientRoster = getRoster(recipientJID);
                boolean recipientSubChanged = false;
                if (recipientRoster != null) {
                    recipientSubChanged = manageSub(senderJID, false, type, recipientRoster);
                }

                // Do not forward the packet to the recipient if the presence is of type subscribed
                // and the recipient user has not changed its subscription state.
                if (!(type == Presence.Type.subscribed && recipientRoster != null && !recipientSubChanged)) {

                    // If the user is already subscribed to the *local* user's presence then do not
                    // forward the subscription request. Also, do not send an auto-reply on behalf
                    // of the user. This presence stanza is the user's server know that it MUST no
                  // longer send notification of the subscription state change to the user.
                  // See http://tools.ietf.org/html/rfc3921#section-7 and/or OF-38
                    if (type == Presence.Type.subscribe && recipientRoster != null && !recipientSubChanged) {
                        try {
                            RosterItem.SubType subType = recipientRoster.getRosterItem(senderJID)
                                    .getSubStatus();
                            if (subType == RosterItem.SUB_FROM || subType == RosterItem.SUB_BOTH) {
                                return;
                            }
                        }
View Full Code Here

Examples of org.jivesoftware.openfire.roster.Roster

     * @param address The address to check
     * @return The roster or null if the address is not managed on the server
     */
    private Roster getRoster(JID address) {
        String username;
        Roster roster = null;
        if (localServer.isLocal(address) && userManager.isRegisteredUser(address.getNode())) {
            username = address.getNode();
            try {
                roster = rosterManager.getRoster(username);
            }
View Full Code Here

Examples of org.jivesoftware.openfire.roster.Roster

          // will now automatically be subscribed to this new
          // PEPService.
          try {
            final RosterManager rm = XMPPServer.getInstance()
                .getRosterManager();
            final Roster roster = rm.getRoster(senderJID.getNode());
            for (final RosterItem item : roster.getRosterItems()) {
              if (item.getSubStatus() == RosterItem.SUB_BOTH
                  || item.getSubStatus() == RosterItem.SUB_FROM) {
                createSubscriptionToPEPService(pepService, item
                    .getJid(), senderJID);
              }
View Full Code Here

Examples of org.jivesoftware.openfire.roster.Roster

     
        public void run() {
            // Send the last published items for the contacts on availableSessionJID's roster.
            try {
                final XMPPServer server = XMPPServer.getInstance();
                final Roster roster = server.getRosterManager().getRoster(availableSessionJID.getNode());
                for (final RosterItem item : roster.getRosterItems()) {
                    if (server.isLocal(item.getJid()) && (item.getSubStatus() == RosterItem.SUB_BOTH ||
                            item.getSubStatus() == RosterItem.SUB_TO)) {
                        PEPService pepService = pepServiceManager.getPEPService(item.getJid().toBareJID());
                        if (pepService != null) {
                            pepService.sendLastPublishedItems(availableSessionJID);
View Full Code Here

Examples of org.jivesoftware.openfire.roster.Roster

        if (userManager.isRegisteredUser(session.getAddress().getNode())) {
            String username = session.getAddress().getNode();

            // Send pending subscription requests to user if roster service is enabled
            if (RosterManager.isRosterServiceEnabled()) {
                Roster roster = rosterManager.getRoster(username);
                for (RosterItem item : roster.getRosterItems()) {
                    if (item.getRecvStatus() == RosterItem.RECV_SUBSCRIBE) {
                        session.process(createSubscribePresence(item.getJid(),
                                new JID(session.getAddress().toBareJID()), true));
                    } else if (item.getRecvStatus() == RosterItem.RECV_UNSUBSCRIBE) {
                        session.process(createSubscribePresence(item.getJid(),
View Full Code Here

Examples of org.jivesoftware.openfire.roster.Roster

            }
            // Local updates can simply run through the roster of the local user
            String name = update.getFrom().getNode();
            try {
                if (name != null && !"".equals(name)) {
                    Roster roster = rosterManager.getRoster(name);
                    roster.broadcastPresence(update);
                }
            }
            catch (UserNotFoundException e) {
                Log.warn("Presence being sent from unknown user " + name, e);
            }
View Full Code Here

Examples of org.jivesoftware.openfire.roster.Roster

                if (!RosterManager.isRosterServiceEnabled()) {
                    keepTrack = true;
                }
                else {
                    try {
                        Roster roster = rosterManager.getRoster(name);
                        // If the directed presence was sent to an entity that is not in the user's
                        // roster, keep a registry of this so that when the user goes offline we
                        // will be able to send the unavailable presence to the entity
                        RosterItem rosterItem = null;
                        try {
                            rosterItem = roster.getRosterItem(update.getTo());
                        }
                        catch (UserNotFoundException e) {
                            // Ignore
                        }
                        if (rosterItem == null ||
View Full Code Here

Examples of org.jivesoftware.openfire.roster.Roster

            System.out.println("Current batch: " + batchNumber + ". Users: " + batchNumber*usersPerRoster + " - " + ((batchNumber*usersPerRoster)+usersPerRoster));
            // Add rosters items between connected users
            for (int i = (batchNumber * usersPerRoster) + from;
                 i < (batchNumber * usersPerRoster) + usersPerRoster + from; i++) {
                String username = userPrefix + i;
                Roster roster;
                try {
                    roster = rosterManager.getRoster(username);
                } catch (UserNotFoundException e) {
                    continue;
                }
                if (roster.getRosterItems().size() >= usersPerRoster) {
                    // Roster already populated. Skip it.
                    continue;
                }
                for (int j = (batchNumber * usersPerRoster) + from;
                     j < (batchNumber * usersPerRoster) + usersPerRoster + from; j++) {
                    if (i == j) {
                        continue;
                    }

                    try {
                        Roster recipientRoster = rosterManager.getRoster(userPrefix + j);

                        manageSub(server.createJID(userPrefix + j, null), true, Presence.Type.subscribe, roster);
                        manageSub(server.createJID(username, null), false, Presence.Type.subscribe, recipientRoster);

                        manageSub(server.createJID(userPrefix + j, null), true, Presence.Type.subscribed, roster);
View Full Code Here

Examples of org.jivesoftware.openfire.roster.Roster

     * @return true if the the prober is allowed to see the presence of the probee.
     * @throws UserNotFoundException If the probee does not exist in the local server or the prober
     *         is not present in the roster of the probee.
     */
    private boolean canProbePresence(JID prober, JID probee) throws UserNotFoundException {
        Roster roster;
        roster = XMPPServer.getInstance().getRosterManager().getRoster(prober.getNode());
        RosterItem item = roster.getRosterItem(probee);

        if (item.getSubStatus() == RosterItem.SUB_BOTH || item.getSubStatus() == RosterItem.SUB_FROM) {
            return true;
        }

View Full Code Here

Examples of org.jivesoftware.openfire.roster.Roster

        if (packet.getFrom() == null) {
            // Sender is the server so it's not denied
            return false;
        }
        // Iterate over the rules and check each rule condition
        Roster roster = getRoster();
        for (PrivacyItem item : items) {
            if (item.matchesCondition(packet, roster, userJID)) {
                if (item.isAllow()) {
                    return false;
                }
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.