org.elite.jdcbot.framework
Class User

java.lang.Object
  extended by org.elite.jdcbot.framework.User

public class User
extends java.lang.Object

User class.

Holds everything about user (description, e-mail, sharesize...)

Since:
0.6
Version:
0.7.1
Author:
Kokanovic Branko, AppleGrew

Field Summary
private  jDCBot _bot
           
private  java.lang.String _conn
           
private  java.lang.String _desc
           
private  int _flag
           
private  boolean _hasInfo
           
private  java.lang.String _ip
           
private  java.lang.String _mail
           
private  boolean _op
           
private  java.lang.String _share
           
private  java.lang.String _supports
           
private  java.lang.String _tag
           
private  java.lang.String _username
           
static int AWAY_FLAG
           
private  boolean extraSlotsGranted
           
static int FIREBALL_AWAY_FLAG
           
static int FIREBALL_FLAG
           
static int NORMAL_FLAG
           
static int SERVER_AWAY_FLAG
           
static int SERVER_FLAG
           
 
Constructor Summary
User(java.lang.String username, jDCBot bot)
           
User(java.lang.String username, java.lang.String desc, java.lang.String conn, java.lang.String mail, java.lang.String share, jDCBot bot)
           
 
Method Summary
 java.lang.String client()
          Tries to get client from the tag
 java.lang.String connection_type()
           
 java.lang.String description()
           
 void download(DUEntity de)
          This is the function users of the framework are expected to use to download files.
 void downloadFileList(java.io.OutputStream os, int settings)
          This is the function users of the framework are expected to use to download file list.
 int getFlag()
           
 java.lang.String getUserIP()
           
 boolean hasInfo()
           
 boolean hasTag()
           
 boolean isActive()
           
 boolean isGrantedExtraSlot()
           
 boolean isOp()
           
 boolean isSupports(java.lang.String feature)
          Checks if the User supports that protocol feature.
 java.lang.String mail()
           
 java.lang.String real_description()
          Try to get real description, not just tag
 void setGratedExtraSlotFlag(boolean flag)
           
 void setOp(boolean flag)
          Sets if the user is operator or not.
 void setSupports(java.lang.String supports)
           
 void setUserIP(java.lang.String ip)
           
 java.lang.String sharesize()
           
 int slots()
           
 java.lang.String tag()
           
 java.lang.String username()
           
 java.lang.String version()
          Tries to get client version form user
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORMAL_FLAG

public static final int NORMAL_FLAG
See Also:
Constant Field Values

AWAY_FLAG

public static final int AWAY_FLAG
See Also:
Constant Field Values

SERVER_FLAG

public static final int SERVER_FLAG
See Also:
Constant Field Values

SERVER_AWAY_FLAG

public static final int SERVER_AWAY_FLAG
See Also:
Constant Field Values

FIREBALL_FLAG

public static final int FIREBALL_FLAG
See Also:
Constant Field Values

FIREBALL_AWAY_FLAG

public static final int FIREBALL_AWAY_FLAG
See Also:
Constant Field Values

_username

private java.lang.String _username

_desc

private java.lang.String _desc

_conn

private java.lang.String _conn

_mail

private java.lang.String _mail

_share

private java.lang.String _share

_tag

private java.lang.String _tag

_supports

private java.lang.String _supports

_ip

private java.lang.String _ip

_flag

private int _flag

_hasInfo

private boolean _hasInfo

_op

private boolean _op

extraSlotsGranted

private boolean extraSlotsGranted

_bot

private jDCBot _bot
Constructor Detail

User

public User(java.lang.String username,
            jDCBot bot)

User

public User(java.lang.String username,
            java.lang.String desc,
            java.lang.String conn,
            java.lang.String mail,
            java.lang.String share,
            jDCBot bot)
Method Detail

hasInfo

public boolean hasInfo()

setSupports

public void setSupports(java.lang.String supports)

setOp

public void setOp(boolean flag)
Sets if the user is operator or not.

Parameters:
flag -

isOp

public boolean isOp()

isSupports

public boolean isSupports(java.lang.String feature)
Checks if the User supports that protocol feature.

Parameters:
feature -
Returns:

setUserIP

public void setUserIP(java.lang.String ip)

getUserIP

public java.lang.String getUserIP()

username

public java.lang.String username()
Returns:
User nick

description

public java.lang.String description()
Returns:
User description (along with the client tag). If you want real description, use method with that name

connection_type

public java.lang.String connection_type()
Returns:
Type of user's connection

mail

public java.lang.String mail()
Returns:
User mail he specified

sharesize

public java.lang.String sharesize()
Returns:
Share size of the user in bytes

hasTag

public boolean hasTag()
Returns:
true if user has client tag, false otherwise

tag

public java.lang.String tag()
Returns:
Client tag if it exist

real_description

public java.lang.String real_description()
Try to get real description, not just tag

Returns:
Description (also known as comment) if it exist, "" otherwise

client

public java.lang.String client()
Tries to get client from the tag

Returns:
Client that user use if it exist, "" otherwise

version

public java.lang.String version()
Tries to get client version form user

Returns:
Version of the client user use if it exist in tag, "" otherwise

isActive

public boolean isActive()
Returns:
true if user is active, false if it is in passive mode, or tag does not exist

slots

public int slots()
Returns:
Number of slots user have if exists in tag, 0 otherwise

isGrantedExtraSlot

public boolean isGrantedExtraSlot()

setGratedExtraSlotFlag

public void setGratedExtraSlotFlag(boolean flag)

getFlag

public int getFlag()

download

public void download(DUEntity de)
              throws BotException
This is the function users of the framework are expected to use to download files.

Parameters:
de -
Throws:
BotException

downloadFileList

public void downloadFileList(java.io.OutputStream os,
                             int settings)
                      throws BotException
This is the function users of the framework are expected to use to download file list.

Parameters:
os - The OutputStream where the file list will be saved. Note: It will be decompressed by default, unless you set the settings that it shouldn't.
settings - See settingFlags
Throws:
BotException