Java 类org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager 实例源码

项目:EIM    文件:Open.java   
@Override
public String getChildElementXML() {
    StringBuilder buf = new StringBuilder();
    buf.append("<open ");
    buf.append("xmlns=\"");
    buf.append(InBandBytestreamManager.NAMESPACE);
    buf.append("\" ");
    buf.append("block-size=\"");
    buf.append(blockSize);
    buf.append("\" ");
    buf.append("sid=\"");
    buf.append(sessionID);
    buf.append("\" ");
    buf.append("stanza=\"");
    buf.append(stanza.toString().toLowerCase());
    buf.append("\"");
    buf.append("/>");
    return buf.toString();
}
项目:EIM    文件:DataPacketExtension.java   
public String toXML() {
    StringBuilder buf = new StringBuilder();
    buf.append("<");
    buf.append(getElementName());
    buf.append(" ");
    buf.append("xmlns=\"");
    buf.append(InBandBytestreamManager.NAMESPACE);
    buf.append("\" ");
    buf.append("seq=\"");
    buf.append(seq);
    buf.append("\" ");
    buf.append("sid=\"");
    buf.append(sessionID);
    buf.append("\">");
    buf.append(data);
    buf.append("</");
    buf.append(getElementName());
    buf.append(">");
    return buf.toString();
}
项目:EIM    文件:FileTransferNegotiator.java   
/**
 * Enable the Jabber services related to file transfer on the particular
 * connection.
 *
 * @param connection The connection on which to enable or disable the services.
 * @param isEnabled  True to enable, false to disable.
 */
public static void setServiceEnabled(final Connection connection,
        final boolean isEnabled) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (isEnabled) {
            if (!manager.includesFeature(namespace)) {
                manager.addFeature(namespace);
            }
        } else {
            manager.removeFeature(namespace);
        }
    }

}
项目:EIM    文件:FileTransferNegotiator.java   
/**
 * Checks to see if all file transfer related services are enabled on the
 * connection.
 *
 * @param connection The connection to check
 * @return True if all related services are enabled, false if they are not.
 */
public static boolean isServiceEnabled(final Connection connection) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (!manager.includesFeature(namespace)) {
            return false;
        }
    }
    return true;
}
项目:androidPN-client.    文件:Open.java   
@Override
public String getChildElementXML() {
    StringBuilder buf = new StringBuilder();
    buf.append("<open ");
    buf.append("xmlns=\"");
    buf.append(InBandBytestreamManager.NAMESPACE);
    buf.append("\" ");
    buf.append("block-size=\"");
    buf.append(blockSize);
    buf.append("\" ");
    buf.append("sid=\"");
    buf.append(sessionID);
    buf.append("\" ");
    buf.append("stanza=\"");
    buf.append(stanza.toString().toLowerCase());
    buf.append("\"");
    buf.append("/>");
    return buf.toString();
}
项目:androidPN-client.    文件:DataPacketExtension.java   
public String toXML() {
    StringBuilder buf = new StringBuilder();
    buf.append("<");
    buf.append(getElementName());
    buf.append(" ");
    buf.append("xmlns=\"");
    buf.append(InBandBytestreamManager.NAMESPACE);
    buf.append("\" ");
    buf.append("seq=\"");
    buf.append(seq);
    buf.append("\" ");
    buf.append("sid=\"");
    buf.append(sessionID);
    buf.append("\">");
    buf.append(data);
    buf.append("</");
    buf.append(getElementName());
    buf.append(">");
    return buf.toString();
}
项目:androidPN-client.    文件:FileTransferNegotiator.java   
/**
 * Enable the Jabber services related to file transfer on the particular
 * connection.
 *
 * @param connection The connection on which to enable or disable the services.
 * @param isEnabled  True to enable, false to disable.
 */
public static void setServiceEnabled(final Connection connection,
        final boolean isEnabled) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (isEnabled) {
            if (!manager.includesFeature(namespace)) {
                manager.addFeature(namespace);
            }
        } else {
            manager.removeFeature(namespace);
        }
    }

}
项目:androidPN-client.    文件:FileTransferNegotiator.java   
/**
 * Checks to see if all file transfer related services are enabled on the
 * connection.
 *
 * @param connection The connection to check
 * @return True if all related services are enabled, false if they are not.
 */
public static boolean isServiceEnabled(final Connection connection) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (!manager.includesFeature(namespace)) {
            return false;
        }
    }
    return true;
}
项目:xmppsupport_v2    文件:Open.java   
@Override
public String getChildElementXML() {
    StringBuilder buf = new StringBuilder();
    buf.append("<open ");
    buf.append("xmlns=\"");
    buf.append(InBandBytestreamManager.NAMESPACE);
    buf.append("\" ");
    buf.append("block-size=\"");
    buf.append(blockSize);
    buf.append("\" ");
    buf.append("sid=\"");
    buf.append(sessionID);
    buf.append("\" ");
    buf.append("stanza=\"");
    buf.append(stanza.toString().toLowerCase());
    buf.append("\"");
    buf.append("/>");
    return buf.toString();
}
项目:xmppsupport_v2    文件:DataPacketExtension.java   
public String toXML() {
    StringBuilder buf = new StringBuilder();
    buf.append("<");
    buf.append(getElementName());
    buf.append(" ");
    buf.append("xmlns=\"");
    buf.append(InBandBytestreamManager.NAMESPACE);
    buf.append("\" ");
    buf.append("seq=\"");
    buf.append(seq);
    buf.append("\" ");
    buf.append("sid=\"");
    buf.append(sessionID);
    buf.append("\">");
    buf.append(data);
    buf.append("</");
    buf.append(getElementName());
    buf.append(">");
    return buf.toString();
}
项目:xmppsupport_v2    文件:FileTransferNegotiator.java   
/**
 * Enable the Jabber services related to file transfer on the particular
 * connection.
 * 
 * @param connection
 *            The connection on which to enable or disable the services.
 * @param isEnabled
 *            True to enable, false to disable.
 */
public static void setServiceEnabled(final Connection connection,
        final boolean isEnabled) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (isEnabled) {
            if (!manager.includesFeature(namespace)) {
                manager.addFeature(namespace);
            }
        } else {
            manager.removeFeature(namespace);
        }
    }

}
项目:xmppsupport_v2    文件:FileTransferNegotiator.java   
/**
 * Checks to see if all file transfer related services are enabled on the
 * connection.
 * 
 * @param connection
 *            The connection to check
 * @return True if all related services are enabled, false if they are not.
 */
public static boolean isServiceEnabled(final Connection connection) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (!manager.includesFeature(namespace)) {
            return false;
        }
    }
    return true;
}
项目:java-bells    文件:Open.java   
@Override
public String getChildElementXML() {
    StringBuilder buf = new StringBuilder();
    buf.append("<open ");
    buf.append("xmlns=\"");
    buf.append(InBandBytestreamManager.NAMESPACE);
    buf.append("\" ");
    buf.append("block-size=\"");
    buf.append(blockSize);
    buf.append("\" ");
    buf.append("sid=\"");
    buf.append(sessionID);
    buf.append("\" ");
    buf.append("stanza=\"");
    buf.append(stanza.toString().toLowerCase());
    buf.append("\"");
    buf.append("/>");
    return buf.toString();
}
项目:java-bells    文件:DataPacketExtension.java   
public String toXML() {
    StringBuilder buf = new StringBuilder();
    buf.append("<");
    buf.append(getElementName());
    buf.append(" ");
    buf.append("xmlns=\"");
    buf.append(InBandBytestreamManager.NAMESPACE);
    buf.append("\" ");
    buf.append("seq=\"");
    buf.append(seq);
    buf.append("\" ");
    buf.append("sid=\"");
    buf.append(sessionID);
    buf.append("\">");
    buf.append(data);
    buf.append("</");
    buf.append(getElementName());
    buf.append(">");
    return buf.toString();
}
项目:java-bells    文件:FileTransferNegotiator.java   
/**
 * Enable the Jabber services related to file transfer on the particular
 * connection.
 *
 * @param connection The connection on which to enable or disable the services.
 * @param isEnabled  True to enable, false to disable.
 */
public static void setServiceEnabled(final Connection connection,
        final boolean isEnabled) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (isEnabled) {
            if (!manager.includesFeature(namespace)) {
                manager.addFeature(namespace);
            }
        } else {
            manager.removeFeature(namespace);
        }
    }

}
项目:java-bells    文件:FileTransferNegotiator.java   
/**
 * Checks to see if all file transfer related services are enabled on the
 * connection.
 *
 * @param connection The connection to check
 * @return True if all related services are enabled, false if they are not.
 */
public static boolean isServiceEnabled(final Connection connection) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (!manager.includesFeature(namespace)) {
            return false;
        }
    }
    return true;
}
项目:telegraph    文件:Open.java   
@Override
public String getChildElementXML() {
    StringBuilder buf = new StringBuilder();
    buf.append("<open ");
    buf.append("xmlns=\"");
    buf.append(InBandBytestreamManager.NAMESPACE);
    buf.append("\" ");
    buf.append("block-size=\"");
    buf.append(blockSize);
    buf.append("\" ");
    buf.append("sid=\"");
    buf.append(sessionID);
    buf.append("\" ");
    buf.append("stanza=\"");
    buf.append(stanza.toString().toLowerCase());
    buf.append("\"");
    buf.append("/>");
    return buf.toString();
}
项目:telegraph    文件:DataPacketExtension.java   
public String toXML() {
    StringBuilder buf = new StringBuilder();
    buf.append("<");
    buf.append(getElementName());
    buf.append(" ");
    buf.append("xmlns=\"");
    buf.append(InBandBytestreamManager.NAMESPACE);
    buf.append("\" ");
    buf.append("seq=\"");
    buf.append(seq);
    buf.append("\" ");
    buf.append("sid=\"");
    buf.append(sessionID);
    buf.append("\">");
    buf.append(data);
    buf.append("</");
    buf.append(getElementName());
    buf.append(">");
    return buf.toString();
}
项目:telegraph    文件:FileTransferNegotiator.java   
/**
 * Enable the Jabber services related to file transfer on the particular
 * connection.
 *
 * @param connection The connection on which to enable or disable the services.
 * @param isEnabled  True to enable, false to disable.
 */
public static void setServiceEnabled(final Connection connection,
        final boolean isEnabled) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (isEnabled) {
            if (!manager.includesFeature(namespace)) {
                manager.addFeature(namespace);
            }
        } else {
            manager.removeFeature(namespace);
        }
    }

}
项目:telegraph    文件:FileTransferNegotiator.java   
/**
 * Checks to see if all file transfer related services are enabled on the
 * connection.
 *
 * @param connection The connection to check
 * @return True if all related services are enabled, false if they are not.
 */
public static boolean isServiceEnabled(final Connection connection) {
    ServiceDiscoveryManager manager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    List<String> namespaces = new ArrayList<String>();
    namespaces.addAll(Arrays.asList(NAMESPACE));
    namespaces.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        namespaces.add(Socks5BytestreamManager.NAMESPACE);
    }

    for (String namespace : namespaces) {
        if (!manager.includesFeature(namespace)) {
            return false;
        }
    }
    return true;
}
项目:EIM    文件:Close.java   
@Override
public String getChildElementXML() {
    StringBuilder buf = new StringBuilder();
    buf.append("<close ");
    buf.append("xmlns=\"");
    buf.append(InBandBytestreamManager.NAMESPACE);
    buf.append("\" ");
    buf.append("sid=\"");
    buf.append(sessionID);
    buf.append("\"");
    buf.append("/>");
    return buf.toString();
}
项目:EIM    文件:FileTransferNegotiator.java   
/**
 * Returns a collection of the supported transfer protocols.
 *
 * @return Returns a collection of the supported transfer protocols.
 */
public static Collection<String> getSupportedProtocols() {
    List<String> protocols = new ArrayList<String>();
    protocols.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        protocols.add(Socks5BytestreamManager.NAMESPACE);
    }
    return Collections.unmodifiableList(protocols);
}
项目:EIM    文件:FileTransferNegotiator.java   
private StreamNegotiator getNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<FormField.Option> it = field.getOptions(); it.hasNext();) {
        variable = it.next().getValue();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        }
        else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

    if (isByteStream && isIBB && field.getType().equals(FormField.TYPE_LIST_MULTI)) {
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager,
                inbandTransferManager);
    }
    else if (isByteStream) {
        return byteStreamTransferManager;
    }
    else {
        return inbandTransferManager;
    }
}
项目:EIM    文件:FileTransferNegotiator.java   
private StreamNegotiator getOutgoingNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<String> it = field.getValues(); it.hasNext();) {
        variable = it.next();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        }
        else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

    if (isByteStream && isIBB) {
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager, inbandTransferManager);
    }
    else if (isByteStream) {
        return byteStreamTransferManager;
    }
    else {
        return inbandTransferManager;
    }
}
项目:EIM    文件:FileTransferNegotiator.java   
private DataForm createDefaultInitiationForm() {
    DataForm form = new DataForm(Form.TYPE_FORM);
    FormField field = new FormField(STREAM_DATA_FIELD_NAME);
    field.setType(FormField.TYPE_LIST_MULTI);
    if (!IBB_ONLY) {
        field.addOption(new FormField.Option(Socks5BytestreamManager.NAMESPACE));
    }
    field.addOption(new FormField.Option(InBandBytestreamManager.NAMESPACE));
    form.addField(field);
    return form;
}
项目:androidPN-client.    文件:Close.java   
@Override
public String getChildElementXML() {
    StringBuilder buf = new StringBuilder();
    buf.append("<close ");
    buf.append("xmlns=\"");
    buf.append(InBandBytestreamManager.NAMESPACE);
    buf.append("\" ");
    buf.append("sid=\"");
    buf.append(sessionID);
    buf.append("\"");
    buf.append("/>");
    return buf.toString();
}
项目:androidPN-client.    文件:FileTransferNegotiator.java   
/**
 * Returns a collection of the supported transfer protocols.
 *
 * @return Returns a collection of the supported transfer protocols.
 */
public static Collection<String> getSupportedProtocols() {
    List<String> protocols = new ArrayList<String>();
    protocols.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        protocols.add(Socks5BytestreamManager.NAMESPACE);
    }
    return Collections.unmodifiableList(protocols);
}
项目:androidPN-client.    文件:FileTransferNegotiator.java   
private StreamNegotiator getNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<FormField.Option> it = field.getOptions(); it.hasNext();) {
        variable = it.next().getValue();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        }
        else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

   //if (isByteStream && isIBB && field.getType().equals(FormField.TYPE_LIST_MULTI)) {
    if (isByteStream && isIBB) { 
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager,
                inbandTransferManager);
    }
    else if (isByteStream) {
        return byteStreamTransferManager;
    }
    else {
        return inbandTransferManager;
    }
}
项目:androidPN-client.    文件:FileTransferNegotiator.java   
private StreamNegotiator getOutgoingNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<String> it = field.getValues(); it.hasNext();) {
        variable = it.next();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        }
        else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

    if (isByteStream && isIBB) {
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager, inbandTransferManager);
    }
    else if (isByteStream) {
        return byteStreamTransferManager;
    }
    else {
        return inbandTransferManager;
    }
}
项目:androidPN-client.    文件:FileTransferNegotiator.java   
private DataForm createDefaultInitiationForm() {
    DataForm form = new DataForm(Form.TYPE_FORM);
    FormField field = new FormField(STREAM_DATA_FIELD_NAME);
    field.setType(FormField.TYPE_LIST_SINGLE);
    if (!IBB_ONLY) {
        field.addOption(new FormField.Option(Socks5BytestreamManager.NAMESPACE));
    }
    field.addOption(new FormField.Option(InBandBytestreamManager.NAMESPACE));
    form.addField(field);
    return form;
}
项目:xmppsupport_v2    文件:Close.java   
@Override
public String getChildElementXML() {
    StringBuilder buf = new StringBuilder();
    buf.append("<close ");
    buf.append("xmlns=\"");
    buf.append(InBandBytestreamManager.NAMESPACE);
    buf.append("\" ");
    buf.append("sid=\"");
    buf.append(sessionID);
    buf.append("\"");
    buf.append("/>");
    return buf.toString();
}
项目:xmppsupport_v2    文件:FileTransferNegotiator.java   
/**
 * Returns a collection of the supported transfer protocols.
 * 
 * @return Returns a collection of the supported transfer protocols.
 */
public static Collection<String> getSupportedProtocols() {
    List<String> protocols = new ArrayList<String>();
    protocols.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        protocols.add(Socks5BytestreamManager.NAMESPACE);
    }
    return Collections.unmodifiableList(protocols);
}
项目:xmppsupport_v2    文件:FileTransferNegotiator.java   
private StreamNegotiator getNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<FormField.Option> it = field.getOptions(); it.hasNext();) {
        variable = it.next().getValue();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        } else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

    // if (isByteStream && isIBB &&
    // field.getType().equals(FormField.TYPE_LIST_MULTI)) {
    if (isByteStream && isIBB) {
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager, inbandTransferManager);
    } else if (isByteStream) {
        return byteStreamTransferManager;
    } else {
        return inbandTransferManager;
    }
}
项目:xmppsupport_v2    文件:FileTransferNegotiator.java   
private StreamNegotiator getOutgoingNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<String> it = field.getValues(); it.hasNext();) {
        variable = it.next();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        } else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

    if (isByteStream || isIBB) {
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager, inbandTransferManager);
    } else if (isByteStream) {
        return byteStreamTransferManager;
    } else {
        return inbandTransferManager;
    }
}
项目:xmppsupport_v2    文件:FileTransferNegotiator.java   
private DataForm createDefaultInitiationForm() {
    DataForm form = new DataForm(Form.TYPE_FORM);
    FormField field = new FormField(STREAM_DATA_FIELD_NAME);
    field.setType(FormField.TYPE_LIST_SINGLE);
    if (!IBB_ONLY) {
        field.addOption(new FormField.Option(
                Socks5BytestreamManager.NAMESPACE));
    }
    field.addOption(new FormField.Option(InBandBytestreamManager.NAMESPACE));
    form.addField(field);
    return form;
}
项目:java-bells    文件:Close.java   
@Override
public String getChildElementXML() {
    StringBuilder buf = new StringBuilder();
    buf.append("<close ");
    buf.append("xmlns=\"");
    buf.append(InBandBytestreamManager.NAMESPACE);
    buf.append("\" ");
    buf.append("sid=\"");
    buf.append(sessionID);
    buf.append("\"");
    buf.append("/>");
    return buf.toString();
}
项目:java-bells    文件:FileTransferNegotiator.java   
/**
 * Returns a collection of the supported transfer protocols.
 *
 * @return Returns a collection of the supported transfer protocols.
 */
public static Collection<String> getSupportedProtocols() {
    List<String> protocols = new ArrayList<String>();
    protocols.add(InBandBytestreamManager.NAMESPACE);
    if (!IBB_ONLY) {
        protocols.add(Socks5BytestreamManager.NAMESPACE);
    }
    return Collections.unmodifiableList(protocols);
}
项目:java-bells    文件:FileTransferNegotiator.java   
private StreamNegotiator getNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<FormField.Option> it = field.getOptions(); it.hasNext();) {
        variable = it.next().getValue();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        }
        else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

   //if (isByteStream && isIBB && field.getType().equals(FormField.TYPE_LIST_MULTI)) {
    if (isByteStream && isIBB) { 
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager,
                inbandTransferManager);
    }
    else if (isByteStream) {
        return byteStreamTransferManager;
    }
    else {
        return inbandTransferManager;
    }
}
项目:java-bells    文件:FileTransferNegotiator.java   
private StreamNegotiator getOutgoingNegotiator(final FormField field)
        throws XMPPException {
    String variable;
    boolean isByteStream = false;
    boolean isIBB = false;
    for (Iterator<String> it = field.getValues(); it.hasNext();) {
        variable = it.next();
        if (variable.equals(Socks5BytestreamManager.NAMESPACE) && !IBB_ONLY) {
            isByteStream = true;
        }
        else if (variable.equals(InBandBytestreamManager.NAMESPACE)) {
            isIBB = true;
        }
    }

    if (!isByteStream && !isIBB) {
        XMPPError error = new XMPPError(XMPPError.Condition.bad_request,
                "No acceptable transfer mechanism");
        throw new XMPPException(error.getMessage(), error);
    }

    if (isByteStream && isIBB) {
        return new FaultTolerantNegotiator(connection,
                byteStreamTransferManager, inbandTransferManager);
    }
    else if (isByteStream) {
        return byteStreamTransferManager;
    }
    else {
        return inbandTransferManager;
    }
}
项目:java-bells    文件:FileTransferNegotiator.java   
private DataForm createDefaultInitiationForm() {
    DataForm form = new DataForm(Form.TYPE_FORM);
    FormField field = new FormField(STREAM_DATA_FIELD_NAME);
    field.setType(FormField.TYPE_LIST_SINGLE);
    if (!IBB_ONLY) {
        field.addOption(new FormField.Option(Socks5BytestreamManager.NAMESPACE));
    }
    field.addOption(new FormField.Option(InBandBytestreamManager.NAMESPACE));
    form.addField(field);
    return form;
}