org.jivesoftware.smackx.filetransfer.FileTransferNegotiator Java Examples

The following examples show how to use org.jivesoftware.smackx.filetransfer.FileTransferNegotiator. 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: FileDownloadListener.java    From yiim_v2 with GNU General Public License v2.0 6 votes vote down vote up
public FileDownloadListener(Context context, Connection connection) {
	this.mConnection = connection;
	this.mContext = context;
	recieveFilePath = YiFileUtils.getStorePath() + "yiim/"
			+ UserInfo.getUserInfo(context).getUserName() + "/file_recv/";

	// ServiceDiscoveryManager sdm = ServiceDiscoveryManager
	// .getInstanceFor(connection);
	// if (sdm == null)
	// sdm = new ServiceDiscoveryManager(connection);
	// sdm.addFeature("http://jabber.org/protocol/disco#info");
	// sdm.addFeature("jabber:iq:privacy");
	FileTransferManager transfer = new FileTransferManager(connection);
	FileTransferNegotiator.setServiceEnabled(connection, true);
	transfer.addFileTransferListener(new RecFileTransferListener());
}
 
Example #2
Source File: TestOperationSetFileTransferImpl.java    From jitsi with Apache License 2.0 4 votes vote down vote up
@Override
public void start()
    throws Exception
{
    FileTransferNegotiator.IBB_ONLY = true;
    fixture.setUp();

    Map<String, OperationSet> supportedOperationSets1 =
        fixture.provider1.getSupportedOperationSets();

    if ( supportedOperationSets1 == null
        || supportedOperationSets1.size() < 1)
        throw new NullPointerException(
            "No OperationSet implementations are supported by "
            +"this implementation. ");

    //we also need the presence op set in order to retrieve contacts.
    opSetPresence1 =
        (OperationSetPresence)supportedOperationSets1.get(
            OperationSetPresence.class.getName());

    //if the op set is null show that we're not happy.
    if (opSetPresence1 == null)
    {
        throw new NullPointerException(
            "An implementation of the service must provide an "
            + "implementation of at least one of the PresenceOperationSets");
    }

    opSetFT1 =
        (OperationSetFileTransfer)supportedOperationSets1.get(
            OperationSetFileTransfer.class.getName());

    //if the op set is null show that we're not happy.
    if (opSetFT1 == null)
    {
        throw new NullPointerException(
            "An implementation of the service must provide an "
            + "implementation of at least one of the FileTransferOperationSets");
    }

    Map<String, OperationSet> supportedOperationSets2 =
        fixture.provider2.getSupportedOperationSets();

    if ( supportedOperationSets2 == null
        || supportedOperationSets2.size() < 1)
        throw new NullPointerException(
            "No OperationSet implementations are supported by "
            +"this implementation. ");

    opSetPresence2 =
        (OperationSetPresence) supportedOperationSets2.get(
            OperationSetPresence.class.getName());

    //if the op set is null show that we're not happy.
    if (opSetPresence2 == null)
    {
        throw new NullPointerException(
            "An implementation of the service must provide an "
            + "implementation of at least one of the PresenceOperationSets");
    }

    opSetFT2 =
        (OperationSetFileTransfer)supportedOperationSets2.get(
            OperationSetFileTransfer.class.getName());

    //if the op set is null show that we're not happy.
    if (opSetFT2 == null)
    {
        throw new NullPointerException(
            "An implementation of the service must provide an "
            + "implementation of at least one of the FileTransferOperationSets");
    }

    prepareContactList();
}