Java Code Examples for org.jivesoftware.smack.packet.StanzaError#getExtension()

The following examples show how to use org.jivesoftware.smack.packet.StanzaError#getExtension() . 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: FileTooLargeError.java    From Smack with Apache License 2.0 5 votes vote down vote up
public static FileTooLargeError from(IQ iq) {
    StanzaError error = iq.getError();
    if (error == null) {
        return null;
    }
    return error.getExtension(ELEMENT, NAMESPACE);
}
 
Example 2
Source File: AdHocCommand.java    From Smack with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the specific condition of the <code>error</code> or <code>null</code> if the
 * error doesn't have any.
 *
 * @param error the error the get the specific condition from.
 * @return the specific condition of this error, or null if it doesn't have
 *         any.
 */
public static SpecificErrorCondition getSpecificErrorCondition(StanzaError error) {
    // This method is implemented to provide an easy way of getting a packet
    // extension of the XMPPError.
    for (SpecificErrorCondition condition : SpecificErrorCondition.values()) {
        if (error.getExtension(condition.toString(),
                AdHocCommandData.SpecificError.namespace) != null) {
            return condition;
        }
    }
    return null;
}
 
Example 3
Source File: BlockedErrorExtension.java    From Smack with Apache License 2.0 5 votes vote down vote up
public static BlockedErrorExtension from(Message message) {
    StanzaError error = message.getError();
    if (error == null) {
        return null;
    }
    return error.getExtension(ELEMENT, NAMESPACE);
}