Java Code Examples for org.xmpp.packet.PacketError#Condition

The following examples show how to use org.xmpp.packet.PacketError#Condition . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Openfire   File: XmppWebSocket.java    License: Apache License 2.0 5 votes vote down vote up
private void sendPacketError(Element stanza, PacketError.Condition condition) {
    Element reply = stanza.createCopy();
    reply.addAttribute("type", "error");
    reply.addAttribute("to", stanza.attributeValue("from"));
    reply.addAttribute("from", stanza.attributeValue("to"));
    reply.add(new PacketError(condition).getElement());
    deliver(reply.asXML());
}
 
Example 2
/**
 * Sends an IQ error with the specified condition to the sender of the original
 * IQ packet.
 *
 * @param packet     the packet to be bounced.
 * @param extraError application specific error or null if none.
 * @param error the error.
 */
private void sendErrorPacket(IQ packet, PacketError.Condition error, Element extraError) {
    IQ reply = IQ.createResultIQ(packet);
    reply.setChildElement(packet.getChildElement().createCopy());
    reply.setError(error);
    if (extraError != null) {
        // Add specific application error if available
        reply.getError().getElement().add(extraError);
    }
    deliver(reply);
}
 
Example 3
/**
 * Sends an IQ error with the specified condition to the sender of the original
 * IQ packet.
 *
 * @param packet     the packet to be bounced.
 * @param extraError application specific error or null if none.
 * @param error the error.
 */
private void sendErrorPacket(Route packet, PacketError.Condition error, Element extraError) {
    Route reply = new Route(packet.getStreamID());
    reply.setID(packet.getID());
    reply.setFrom(packet.getTo());
    reply.setTo(packet.getFrom());
    reply.setError(error);
    if (extraError != null) {
        // Add specific application error if available
        reply.getError().getElement().add(extraError);
    }
    deliver(reply);
}
 
Example 4
Source Project: Openfire   File: PresenceAccess.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public PacketError.Condition getSubsriptionError() {
    return PacketError.Condition.not_authorized;
}
 
Example 5
Source Project: Openfire   File: AuthorizeAccess.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public PacketError.Condition getSubsriptionError() {
    return PacketError.Condition.not_authorized;
}
 
Example 6
Source Project: Openfire   File: WhitelistAccess.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public PacketError.Condition getSubsriptionError() {
    return PacketError.Condition.not_allowed;
}
 
Example 7
Source Project: Openfire   File: OpenAccess.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public PacketError.Condition getSubsriptionError() {
    // Return nothing since users can always subscribe to the node
    return null;
}
 
Example 8
Source Project: Openfire   File: RosterAccess.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public PacketError.Condition getSubsriptionError() {
    return PacketError.Condition.not_authorized;
}
 
Example 9
Source Project: onos   File: XmppPubSubError.java    License: Apache License 2.0 4 votes vote down vote up
private PacketError.Condition setBasedOnAppCondition() {
    return APP_BASE_CONDITION_MAP.getOrDefault(this.applicationCondition,
                                               PacketError.Condition.undefined_condition);
}
 
Example 10
Source Project: Openfire   File: AccessModel.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Returns the error condition that should be returned to the subscriber when
 * subscription is not allowed.
 *
 * @return the error condition that should be returned to the subscriber when
 *         subscription is not allowed.
 */
public abstract PacketError.Condition getSubsriptionError();