Possibility to abort a DCC file transfer

6 views
Skip to first unread message

Johannes Schulte-Wülwer

unread,
Dec 18, 2019, 10:20:32 AM12/18/19
to pircbotx
Hi all,

im quite new to PircbotX and I have searched the docs and the wiki but didn't find a solution for my problem. 

Whenn a DCC file transfer request is accpeted and the transfer is started like this.

public class DccOutgoingChatExample extends ListenerAdapter {
@Override
public void onIncomingFileTransfer(IncomingFileTransferEvent event) throws Exception {
//Generate a file prefix
String prefix = "pircbotxFile" + System.currentTimeMillis() + "-";
//File suffix is the original filename plus .txt to prevent executables
String suffix = event.getSafeFilename() + ".txt";
//Create this file in the temp directory
File file = File.createTempFile(prefix, suffix);
//Receive the file from the user
event.accept(file).transfer();
}
}

Now the call to "event.accpet(file).transfer()" is blocking. Is there a way to abort the file transfer from another thread?

Thanks in advance,

Johannes
Reply all
Reply to author
Forward
0 new messages