org.elite.jdcbot.examples
Class DownloadBot

java.lang.Object
  extended by org.elite.jdcbot.framework.DCIO
      extended by org.elite.jdcbot.framework.InputThreadTarget
          extended by org.elite.jdcbot.framework.jDCBot
              extended by org.elite.jdcbot.examples.DownloadBot

public class DownloadBot
extends jDCBot

Created on 31-May-08
This exmple bot will download any file from a user when that user sends the magnet URI of the file in private message to this bot.

The bot will immediately quit if anybody sends +quit as private message to this bot.

Since:
0.7.1
Version:
0.1
Author:
AppleGrew

Nested Class Summary
private  class DownloadBot.Query
           
 
Field Summary
 
Fields inherited from class org.elite.jdcbot.framework.jDCBot
_botname, _conn_type, _description, _email, _hubname, _ip, _passive, _password, _port, _sharesize, downloadManager, log, shareManager, socket, socketServer, um, uploadManager, VERSION
 
Constructor Summary
DownloadBot()
           
 
Method Summary
 DownloadBot.Query[] getSegmentedQuery(java.lang.String query)
           
static void main(java.lang.String[] args)
           
protected  void onDownloadComplete(User user, DUEntity due, boolean success, BotException e)
          Called when download is complete.
Note: This method is called by DownloadHandler using jDCBot-EventDispatchThread thread.
protected  void onPrivateMessage(java.lang.String user, java.lang.String msg)
          Called when bot receives private message.
private  void pm(java.lang.String user, java.lang.String msg)
           
 
Methods inherited from class org.elite.jdcbot.framework.jDCBot
botname, connect, GetAllUsers, getBotClientProtoSupports, getBotHubProtoSupports, getDispatchThread, getMaxDownloadSlots, getMaxUploadSlots, GetRandomUser, getShareManager, getUser, getUserManager, handleCommand, hubname, initConnectToMe, isBotClientProtoSupports, isBotHubProtoSupports, isConnected, isHubSupports, isOp, isPassive, KickUser, KickUser, onActiveSearch, onBotQuit, onChannelMessage, onConnect, onConnect2Client, onDisconnect, onJoin, onPassiveSearch, onPublicMessage, onQuit, onUpdateMyInfo, onUploadComplete, onUploadStart, quit, SendActiveSearchReturn, SendAll, SendCommand, SendPassiveSearchReturn, SendPrivateMessage, SendPublicMessage, setMaxDownloadSlots, setMaxUploadSlots, setShareManager, terminate, UserExist
 
Methods inherited from class org.elite.jdcbot.framework.DCIO
parseCmdArgs, parseCmdName, parseRawCmd, ReadCommand, ReadCommand, SendCommand, SendCommand, set_IOExceptionMsg
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DownloadBot

public DownloadBot()
Method Detail

pm

private void pm(java.lang.String user,
                java.lang.String msg)

onPrivateMessage

protected void onPrivateMessage(java.lang.String user,
                                java.lang.String msg)
Description copied from class: jDCBot
Called when bot receives private message.

The implementation of this method in the jDCBot abstract class performs no actions and may be overridden as required.

Overrides:
onPrivateMessage in class jDCBot
Parameters:
user - Name of user who sent us private message.
msg - Contents of private message.

getSegmentedQuery

public DownloadBot.Query[] getSegmentedQuery(java.lang.String query)

onDownloadComplete

protected void onDownloadComplete(User user,
                                  DUEntity due,
                                  boolean success,
                                  BotException e)
Description copied from class: jDCBot
Called when download is complete.
Note: This method is called by DownloadHandler using jDCBot-EventDispatchThread thread.

Overrides:
onDownloadComplete in class jDCBot
Parameters:
user - The user from whom the file was downloaded.
due - The informations about the file downloaded is in this.
success - It is true if download was successful else false.
e - The exception that occured when sucess is false else it is null.

main

public static void main(java.lang.String[] args)