public class DccHandler extends Object implements Closeable
Constructor and Description |
---|
DccHandler(PircBotX bot) |
Modifier and Type | Method and Description |
---|---|
ReceiveChat |
acceptChatRequest(IncomingChatRequestEvent event)
Accept chat request, blocking until the connection is active
|
ReceiveFileTransfer |
acceptFileTransfer(IncomingFileTransferEvent event,
File destination)
Accept file transfer at position 0, blocking until the connection is
active
|
ReceiveFileTransfer |
acceptFileTransferResume(IncomingFileTransferEvent event,
File destination,
long startPosition)
Accept file transfer resuming at specified position, blocking until the
connection is active
|
static String |
addressToInteger(InetAddress address) |
void |
close()
Shutdown any pending dcc transfers
|
InetAddress |
getRealDccLocalAddress() |
InetAddress |
getRealDccLocalAddress(InetAddress destAddress)
Try to get a real InetAddress in this order:
Configuration.getDccLocalAddress()
Configuration.getLocalAddress()
PircBotX.getLocalAddress()
|
InetAddress |
getRealDccPublicAddress()
Try to get a real InetAddress in this order:
Configuration.getDccPublicAddress()
getRealDccLocalAddress()
|
InetAddress |
getRealDccPublicAddress(ServerSocket ss)
Try to get a real InetAddress in this order:
Configuration.getDccPublicAddress()
The given ServerSocket's address
|
static void |
main(String[] args) |
static InetAddress |
parseRawAddress(String rawAddress) |
boolean |
processDcc(UserHostmask userHostmask,
User user,
String request) |
SendChat |
sendChat(User receiver)
Send a chat request using
Configuration.isDccPassiveRequest() |
SendChat |
sendChat(User receiver,
boolean passive)
Send a chat request using passive parameter
|
SendFileTransfer |
sendFile(File file,
User receiver)
Send file using
Configuration.isDccPassiveRequest() |
SendFileTransfer |
sendFile(File file,
User receiver,
boolean passive)
Send file using
Configuration.isDccPassiveRequest() |
@ConstructorProperties(value="bot") @Generated(value="lombok") public DccHandler(@NonNull PircBotX bot)
public boolean processDcc(UserHostmask userHostmask, User user, String request) throws IOException
IOException
public ReceiveChat acceptChatRequest(IncomingChatRequestEvent event) throws IOException
event
- The chat request eventReceiveChat
IOException
- If an error occurred during connectionpublic ReceiveFileTransfer acceptFileTransfer(IncomingFileTransferEvent event, File destination) throws IOException
event
- The file request eventdestination
- The destination fileReceiveFileTransfer
IOException
- If an error occurred during connectionpublic ReceiveFileTransfer acceptFileTransferResume(IncomingFileTransferEvent event, File destination, long startPosition) throws IOException, InterruptedException, DccException
event
- The file request eventdestination
- The destination filestartPosition
- The position to start the transfer atReceiveFileTransfer
IOException
- If an error occurred during connectionInterruptedException
- If this is interrupted while waiting for a
connectionDccException
- If a timeout is reached or the bot is shutting downpublic SendChat sendChat(User receiver) throws IOException, InterruptedException
Configuration.isDccPassiveRequest()
receiver
- The user to chat withSendChat
IOException
- If an error occurred during connectionInterruptedException
- If passive connection was interruptedDccException
- If a timeout is reached or the bot is shutting downpublic SendChat sendChat(User receiver, boolean passive) throws IOException, InterruptedException
receiver
- The user to chat withpassive
- Whether to connect passivelySendChat
IOException
- If an error occurred during connectionInterruptedException
- If passive connection was interruptedDccException
- If a timeout is reached or the bot is shutting downpublic SendFileTransfer sendFile(File file, User receiver) throws IOException, DccException, InterruptedException
Configuration.isDccPassiveRequest()
file
- The file to sendreceiver
- The user to send the file toSendFileTransfer
IOException
- If an error occurred during connectingDccException
- If a timeout is reached or the bot is shutting downInterruptedException
- If passive connection was interruptedpublic SendFileTransfer sendFile(File file, User receiver, boolean passive) throws IOException, DccException, InterruptedException
Configuration.isDccPassiveRequest()
file
- The file to sendreceiver
- The user to send the file topassive
- Whether to connect passivelySendFileTransfer
IOException
- If an error occurred during connectingDccException
- If a timeout is reached or the bot is shutting downInterruptedException
- If passive connection was interruptedpublic InetAddress getRealDccLocalAddress(InetAddress destAddress)
public InetAddress getRealDccLocalAddress()
public InetAddress getRealDccPublicAddress()
public InetAddress getRealDccPublicAddress(ServerSocket ss)
Configuration.getDccPublicAddress()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public static String addressToInteger(InetAddress address)
public static InetAddress parseRawAddress(String rawAddress) throws UnknownHostException
UnknownHostException
public static void main(String[] args) throws UnknownHostException
UnknownHostException
Copyright © 2010–2020 Leon Blakey. All rights reserved.