Examples of RosterItem


Examples of org.apache.vysper.xmpp.modules.roster.RosterItem

            relayStanza(contact, sendoutPresence, sessionContext);
    }
  }

    private RosterItem getExistingOrNewRosterItem(RosterManager rosterManager, Entity userJid, Entity contactJid) throws RosterException {
        RosterItem rosterItem = rosterManager.getContact(userJid, contactJid);
        if (rosterItem == null) {
            rosterItem = new RosterItem(contactJid, NONE);
        }
        return rosterItem;
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.roster.RosterItem

        Entity contact = stanza.getFrom();
        Entity user = stanza.getTo();

        Entity userBareJid = user.getBareJID();

        RosterItem rosterItem;
        RosterSubscriptionMutator.Result result;
        try {
            rosterItem = getExistingOrNewRosterItem(rosterManager, userBareJid, contact);

            result = RosterSubscriptionMutator.getInstance().add(rosterItem, TO);
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.roster.RosterItem

    Entity contact = stanza.getFrom();
    Entity user = stanza.getTo();

        Entity userBareJid = user.getBareJID();

        RosterItem rosterItem;
        RosterSubscriptionMutator.Result result;
        try {
            rosterItem = getExistingOrNewRosterItem(rosterManager, userBareJid, contact);

            result = RosterSubscriptionMutator.getInstance().add(rosterItem, ASK_SUBSCRIBED);
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.roster.RosterItem

    Entity user = stanza.getFrom();
    Entity contact = stanza.getTo().getBareJID();

        // TODO schedule a observer which can re-send the request

        RosterItem rosterItem = null;
        try {
            rosterItem = getExistingOrNewRosterItem(rosterManager, user.getBareJID(), contact);

            RosterSubscriptionMutator.Result result = RosterSubscriptionMutator.getInstance().add(rosterItem, ASK_SUBSCRIBE);
            if (result != OK) {
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.roster.RosterItem

                                                   SessionContext sessionContext, ResourceRegistry registry,
                                                   RosterManager rosterManager) {
    Entity contact = stanza.getFrom();
    Entity user = stanza.getTo();

        RosterItem contactItem;
        try {
            contactItem = rosterManager.getContact(user, contact.getBareJID());
        } catch (RosterException e) {
            contactItem = null;
        }
        if (contactItem == null || !contactItem.hasFrom()) {
            // not a contact, or not a _subscribed_ contact!
      relayStanza(contact, buildPresenceStanza(user, contact, UNSUBSCRIBED, null), sessionContext);
            return null;
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.roster.RosterItem

                    StanzaErrorType.MODIFY,
                    "sender info insufficient: " + ((user == null) ? "no from" : user.getFullQualifiedName()), null,
                    null);
        }

        RosterItem setRosterItem;
        try {
            setRosterItem = RosterUtils.parseRosterItem(stanza);
        } catch (RosterBadRequestException e) {
            return ServerErrorResponses.getStanzaError(StanzaErrorCondition.BAD_REQUEST, stanza,
                    StanzaErrorType.MODIFY, e.getMessage(), null, null);
        } catch (RosterNotAcceptableException e) {
            return ServerErrorResponses.getStanzaError(StanzaErrorCondition.NOT_ACCEPTABLE, stanza,
                    StanzaErrorType.MODIFY, e.getMessage(), null, null);
        }

        Entity contactJid = setRosterItem.getJid().getBareJID();

        RosterItem existingItem;
        try {
            existingItem = rosterManager.getContact(user.getBareJID(), contactJid);
        } catch (RosterException e) {
            existingItem = null;
        }

        if (setRosterItem.getSubscriptionType() == REMOVE) {
            // remove is handled in separate method, return afterwards
            return rosterItemRemove(stanza, sessionContext, rosterManager, user, contactJid, existingItem);
        } /* else: all other subscription types are ignored in a roster set and have been filtered out by RosterUtils.parseRosterItem() */

        // proper set (update, not a remove)
        if (existingItem == null) {
            existingItem = new RosterItem(contactJid, NONE);
        }

        if (setRosterItem.getName() != null) {
            existingItem.setName(setRosterItem.getName());
            logger.debug(user.getBareJID() + " roster: set roster item name to " + setRosterItem.getName());
        }
        existingItem.setGroups(setRosterItem.getGroups());
        logger.debug(user.getBareJID() + " roster: roster item groups set to " + setRosterItem.getGroups());

        try {
            // update contact persistently
            rosterManager.addContact(user.getBareJID(), existingItem);
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.roster.RosterItem

                logger.warn("failure sending unsubscribe on roster remove", e);
            }
        }

        // send roster item push to all interested resources
        pushRosterItemToInterestedResources(sessionContext, user, new RosterItem(contactJid, REMOVE));

        // return success
        return StanzaBuilder.createIQStanza(null, user, IQStanzaType.RESULT, stanza.getID()).build();
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.roster.RosterItem

    private XMPPCoreStanza handleInboundPresenceProbe(PresenceStanza stanza, ServerRuntimeContext serverRuntimeContext,
            SessionContext sessionContext, ResourceRegistry registry, RosterManager rosterManager) {
        Entity contact = stanza.getFrom();
        Entity user = stanza.getTo();

        RosterItem contactItem;
        try {
            contactItem = rosterManager.getContact(user, contact.getBareJID());
        } catch (RosterException e) {
            contactItem = null;
        }
        if (contactItem == null || !contactItem.hasFrom()) {
            // not a contact, or not a _subscribed_ contact!
            relayStanza(contact, buildPresenceStanza(user, contact, UNSUBSCRIBED, null), sessionContext);
            return null;
        }
View Full Code Here

Examples of org.jivesoftware.openfire.roster.RosterItem

            // used for migration
            if (previousDomain != null) {
              jid = jid.replace(previousDomain, serverName);
            }

            rosterItems.add(new RosterItem(new JID(jid),
                RosterItem.SubType.getTypeFromInt(Integer
                    .parseInt(substatus)),
                RosterItem.AskType.getTypeFromInt(Integer
                    .parseInt(askstatus)),
                RosterItem.RecvType.getTypeFromInt(Integer
View Full Code Here

Examples of org.jivesoftware.openfire.roster.RosterItem

    public Iterator<Element> getUserItems(String name, JID senderJID) {
        List<Element> answer = new ArrayList<Element>();
        try {
            User user = UserManager.getInstance().getUser(name);
            RosterItem item = user.getRoster().getRosterItem(senderJID);
            // If the requesting entity is subscribed to the account's presence then
            // answer the user's "available resources"
            if (item.getSubStatus() == RosterItem.SUB_FROM ||
                    item.getSubStatus() == RosterItem.SUB_BOTH) {
                for (Session session : SessionManager.getInstance().getSessions(name)) {
                    Element element = DocumentHelper.createElement("item");
                    element.addAttribute("jid", session.getAddress().toString());
                    answer.add(element);
                }
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.