Package rocks.xmpp.core.stanza.model

Examples of rocks.xmpp.core.stanza.model.StanzaError


                                            return null;
                                        }
                                    }, OutOfBandFileTransferManager.this);
                                } else {
                                    // If the URL is no HTTP URL, return a stanza error.
                                    xmppSession.send(iq.createError(new StanzaError(new NotAcceptable())));
                                }
                            } catch (ProtocolException e1) {
                                throw new IOException(e1);
                            } finally {
                                if (connection != null) {
                                    connection.disconnect();
                                }
                            }
                        } catch (IOException e1) {
                            // If the recipient attempts to retrieve the file but is unable to do so, the receiving application MUST return an <iq/> of type 'error' to the sender specifying a Not Found condition:
                            xmppSession.send(iq.createError(new StanzaError(new ItemNotFound())));
                        }
                        e.consume();
                    }
                }
            }
View Full Code Here


                    if (e.getStatus() == FileTransfer.Status.COMPLETED) {
                        xmppSession.send(iq.createResult());
                        fileTransfer.removeFileTransferStatusListener(this);
                    } else if (e.getStatus() == FileTransfer.Status.CANCELED ||
                            e.getStatus() == FileTransfer.Status.FAILED) {
                        xmppSession.send(iq.createError(new StanzaError(new ItemNotFound())));
                        fileTransfer.removeFileTransferStatusListener(this);
                    }
                }
            });
            return fileTransfer;
View Full Code Here

    }

    @Override
    public void reject(IQ iq) {
        // If the recipient rejects the request outright, the receiving application MUST return an <iq/> of type 'error' to the sender specifying a Not Acceptable condition:
        xmppSession.send(iq.createError(new StanzaError(new NotAcceptable())));
    }
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

                                    }
                                }
                            }
                        }
                        if (noValidStreams) {
                            StanzaError error = new StanzaError(new BadRequest());
                            error.setExtension(new NoValidStreams());
                            xmppSession.send(iq.createError(error));
                        } else {
                            ProfileManager profileManager = profileManagers.get(streamInitiation.getProfile());

                            if (profileManager == null) {
                                StanzaError error = new StanzaError(new BadRequest());
                                error.setExtension(new BadProfile());
                                xmppSession.send(iq.createError(error));
                            } else {
                                profileManager.handle(iq, streamInitiation);
                            }
                        }
View Full Code Here

        }
    }

    @Override
    public void reject(IQ iq) {
        xmppSession.send(iq.createError(new StanzaError(new Forbidden())));
    }
View Full Code Here

TOP

Related Classes of rocks.xmpp.core.stanza.model.StanzaError

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.