public IQ createErrorUnsupportedInfo(Jingle request) { StanzaError.Builder error = StanzaError.getBuilder(); error.setCondition(StanzaError.Condition.feature_not_implemented) .addExtension(JingleError.UNSUPPORTED_INFO); return IQ.createErrorResponse(request, error); }
public static FileTooLargeError from(IQ iq) { StanzaError error = iq.getError(); if (error == null) { return null; } return error.getExtension(ELEMENT, NAMESPACE); } }
public Builder copyFrom(StanzaError xmppError) { setCondition(xmppError.getCondition()); setType(xmppError.getType()); setConditionText(xmppError.getConditionText()); setErrorGenerator(xmppError.getErrorGenerator()); setStanza(xmppError.getStanza()); setDescriptiveTexts(xmppError.descriptiveTexts); setTextNamespace(xmppError.textNamespace); setExtensions(xmppError.extensions); return this; }
/** * Creates and returns a copy of this message stanza. * <p> * This does not perform a deep clone, as extension elements are shared between the new and old * instance. * </p> * @return a clone of this message. */ @Override public Message clone() { return new Message(this); }
/** * Returns a response IQ for a activation request to the proxy. * * @param from JID of the proxy * @param to JID of the client who wants to activate the SOCKS5 Bytestream * @return response IQ for a activation request to the proxy */ public static IQ createActivationConfirmation(Jid from, Jid to) { IQ response = new EmptyResultIQ(); response.setFrom(from); response.setTo(to); return response; }
@Override protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) { xml.attribute("jid", jid); xml.optAttribute("node", node); xml.rightAngleBracket(); return xml; }
@Override public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException, SmackException.NotLoggedInException { Message message = (Message) packet; // add a markable extension message.addExtension(ChatMarkersElements.MarkableExtension.INSTANCE); } }, OUTGOING_MESSAGE_FILTER);
@Override protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) { xml.rightAngleBracket(); xml.append(setData); return xml; }
@Override protected boolean acceptSpecific(Message message) { // Accept only messages which have a subject set return message.getSubject() != null; }
@Override protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) { xml.attribute("jid", jid); xml.setEmptyElement(); return xml; }
public Builder addElement(String name, String textValue) { StandardExtensionElement element = StandardExtensionElement.builder(name, this.namespace).setText( textValue).build(); return addElement(element); }
/** * Creates a new XMPPException with the stream error that was the root case of the * exception. When a stream error is received from the server then the underlying connection * will be closed by the server. * * @param streamError the root cause of the exception. */ public StreamErrorException(StreamError streamError) { super(streamError.getCondition().toString() + " You can read more about the meaning of this stream error at http://xmpp.org/rfcs/rfc6120.html#streams-error-conditions\n" + streamError.toString()); this.streamError = streamError; }
public static BlockedErrorExtension from(Message message) { StanzaError error = message.getError(); if (error == null) { return null; } return error.getExtension(ELEMENT, NAMESPACE); }
public static Builder getBuilder(StanzaError xmppError) { return getBuilder().copyFrom(xmppError); }
/** * Returns the subject corresponding to the language. If the language is null, the method result * will be the same as {@link #getSubject()}. Null will be returned if the language does not have * a corresponding subject. * * @param language the language of the subject to return. * @return the subject related to the passed in language. */ public String getSubject(String language) { Subject subject = getMessageSubject(language); return subject == null ? null : subject.subject; }
@Override protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) { if (getChildElementName() == null) return null; return super.getIQChildElementBuilder(xml); } }
public IQ createErrorOutOfOrder(Jingle request) { StanzaError.Builder error = StanzaError.getBuilder(); error.setCondition(StanzaError.Condition.unexpected_request) .addExtension(JingleError.OUT_OF_ORDER); return IQ.createErrorResponse(request, error); }
public IQ createErrorUnknownSession(Jingle request) { StanzaError.Builder error = StanzaError.getBuilder(); error.setCondition(StanzaError.Condition.item_not_found) .addExtension(JingleError.UNKNOWN_SESSION); return IQ.createErrorResponse(request, error); }
public IQ createErrorTieBreak(Jingle request) { StanzaError.Builder error = StanzaError.getBuilder(); error.setCondition(StanzaError.Condition.conflict) .addExtension(JingleError.TIE_BREAK); return IQ.createErrorResponse(request, error); }