Package org.apache.vysper.xmpp.modules.roster

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


                                                   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

                    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

                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

    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

TOP

Related Classes of org.apache.vysper.xmpp.modules.roster.RosterItem

Copyright © 2018 www.massapicom. 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.