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

The following examples show how to use org.xmpp.packet.PacketError#Condition . 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 File: XmppWebSocket.java    From Openfire with 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
Source File: MultiplexerPacketHandler.java    From Openfire with Apache License 2.0 5 votes vote down vote up
/**
 * 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
Source File: MultiplexerPacketHandler.java    From Openfire with Apache License 2.0 5 votes vote down vote up
/**
 * 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 File: PresenceAccess.java    From Openfire with Apache License 2.0 4 votes vote down vote up
@Override
public PacketError.Condition getSubsriptionError() {
    return PacketError.Condition.not_authorized;
}
 
Example 5
Source File: AuthorizeAccess.java    From Openfire with Apache License 2.0 4 votes vote down vote up
@Override
public PacketError.Condition getSubsriptionError() {
    return PacketError.Condition.not_authorized;
}
 
Example 6
Source File: WhitelistAccess.java    From Openfire with Apache License 2.0 4 votes vote down vote up
@Override
public PacketError.Condition getSubsriptionError() {
    return PacketError.Condition.not_allowed;
}
 
Example 7
Source File: OpenAccess.java    From Openfire with 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 File: RosterAccess.java    From Openfire with Apache License 2.0 4 votes vote down vote up
@Override
public PacketError.Condition getSubsriptionError() {
    return PacketError.Condition.not_authorized;
}
 
Example 9
Source File: XmppPubSubError.java    From onos with 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 File: AccessModel.java    From Openfire with 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();