Package rocks.xmpp.core.stanza.model.errors

Examples of rocks.xmpp.core.stanza.model.errors.NotAuthorized


                if (e.isIncoming() && isEnabled() && !e.isConsumed() && iq.getType() == IQ.Type.SET) {
                    ContactExchange contactExchange = iq.getExtension(ContactExchange.class);
                    if (contactExchange != null) {
                        if (xmppSession.getRosterManager().getContact(iq.getFrom().asBareJid()) == null) {
                            // If the receiving entity will not process the suggested action(s) because the sending entity is not in the receiving entity's roster, the receiving entity MUST return an error to the sending entity, which error SHOULD be <not-authorized/>.
                            xmppSession.send(iq.createError(new StanzaError(new NotAuthorized())));
                        } else {
                            List<ContactExchange.Item> items = getItemsToProcess(contactExchange.getItems());
                            if (!items.isEmpty()) {
                                processItems(items, iq.getFrom(), null, new Date());
                            }
View Full Code Here


    public void deny() {
        if (stanza instanceof IQ) {
            // If the user wishes to deny the request, the <iq/> response stanza MUST be of type "error",
            // MAY contain the original <confirm/> child element (although this is not necessary since the XMPP 'id' attribute can be used for tracking purposes),
            // and MUST specify an error, which SHOULD be <not-authorized/>
            xmppSession.send(((IQ) stanza).createError(new StanzaError(new NotAuthorized())));
        } else if (stanza instanceof Message) {
            // If the user wishes to deny the request, the <message/> response stanza MUST be of type "error",
            // MUST mirror the <thread/> ID (if provided by the XMPP Server),
            // MUST contain the original <confirm/> child element,
            // and MUST specify an error, which SHOULD be <not-authorized/>
            Message m = new Message(getRequester(), Message.Type.ERROR);
            m.setThread(((Message) stanza).getThread());
            m.getExtensions().add(confirmationRequest);
            m.setError(new StanzaError(new NotAuthorized()));
            xmppSession.send(m);
        }
    }
View Full Code Here

TOP

Related Classes of rocks.xmpp.core.stanza.model.errors.NotAuthorized

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.