org.xnap.plugin.opennap.user
Class OpenNapUser

java.lang.Object
  extended by org.xnap.peer.AbstractPeer
      extended by org.xnap.plugin.opennap.user.OpenNapUser
All Implemented Interfaces:
Peer

public class OpenNapUser
extends AbstractPeer


Field Summary
static int WHOIS_REQUERY_INTERVALL
           
static int WHOIS_RESENT_INTERVALL
           
 
Constructor Summary
OpenNapUser(java.lang.String name, OpenNapServer server)
           
 
Method Summary
 boolean canDirectBrowse()
          Returns true, if this user's client support direct browse.
 boolean equals(java.lang.Object o)
          Returns true, if the name of o equals the name of the user.
 javax.swing.Action[] getActions()
          Returns the actions that can performed by the peer.
 int getConnectDuration()
           
 int getDownloadCount()
          Returns the download count as received by a whois response.
 java.lang.String getHost()
          Returns the ip address or hostname of this peer.
 long getLastSeen()
           
 java.lang.String getLevel()
           
 int getLocalDownloadCount()
          Returns the number of currently running downloads from this peer.
 int getLocalUploadCount()
          Returns the number of currently running uploads to this peer.
 OpenNapGlobalUser getParent()
           
 int getPort()
           
 OpenNapServer getServer()
           
 java.lang.String getStatus()
          Returns the status of the peer.
 int getUploadCount()
           
 boolean isDownloadDenied()
           
 boolean isDownloadLimitReached()
           
 boolean isUploadDenied()
          Checks if peer shares enough to be allowed to download from us.
 boolean isUploadLimitReached()
           
 boolean isUpToDate()
           
 void notifyWhoisReceived()
          Called by message class when whois query was received.
 void setConnectDuration(int newValue)
           
 void setDownloadCount(int newValue)
           
 void setHost(java.lang.String newValue)
           
 void setLastSeen(long newValue)
           
 void setLevel(java.lang.String newValue)
           
 void setLinkSpeed(int newValue)
          Maps OpenNap types to real values.
 void setPort(int newValue)
           
 void setStatus(java.lang.String newValue)
           
 void setUploadCount(int newValue)
           
 boolean shouldRequery()
           
 java.lang.String toString()
          Returns the value of getName().
 boolean update()
           
 boolean update(boolean force)
          Sends a whois query to the server if not up to date.
 
Methods inherited from class org.xnap.peer.AbstractPeer
getClientInfo, getFileCount, getLinkSpeed, getName, setClientInfo, setFileCount, setName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WHOIS_REQUERY_INTERVALL

public static final int WHOIS_REQUERY_INTERVALL
See Also:
Constant Field Values

WHOIS_RESENT_INTERVALL

public static final int WHOIS_RESENT_INTERVALL
See Also:
Constant Field Values
Constructor Detail

OpenNapUser

public OpenNapUser(java.lang.String name,
                   OpenNapServer server)
Method Detail

canDirectBrowse

public boolean canDirectBrowse()
Returns true, if this user's client support direct browse.


equals

public boolean equals(java.lang.Object o)
Returns true, if the name of o equals the name of the user.

Overrides:
equals in class java.lang.Object

getActions

public javax.swing.Action[] getActions()
Description copied from interface: Peer
Returns the actions that can performed by the peer.


getConnectDuration

public int getConnectDuration()

getDownloadCount

public int getDownloadCount()
Returns the download count as received by a whois response.


getHost

public java.lang.String getHost()
Description copied from interface: Peer
Returns the ip address or hostname of this peer. The host can include the port separated by a colon like this: "localhost:6699".


getLastSeen

public long getLastSeen()

getLevel

public java.lang.String getLevel()

getLocalDownloadCount

public int getLocalDownloadCount()
Description copied from interface: Peer
Returns the number of currently running downloads from this peer.


getLocalUploadCount

public int getLocalUploadCount()
Description copied from interface: Peer
Returns the number of currently running uploads to this peer.


getParent

public OpenNapGlobalUser getParent()

getPort

public int getPort()

getServer

public OpenNapServer getServer()

getStatus

public java.lang.String getStatus()
Description copied from interface: Peer
Returns the status of the peer. This could be something like "online" or "away".


getUploadCount

public int getUploadCount()

isDownloadDenied

public boolean isDownloadDenied()
Returns:
true, if download requests are permanently denied

isDownloadLimitReached

public boolean isDownloadLimitReached()
Returns:
true, if download requests are temporarily denied

isUploadDenied

public boolean isUploadDenied()
Checks if peer shares enough to be allowed to download from us. Serves to block leechers. Automatically calls update() if needed.

Returns:
true, if uploads are permanently denied

isUploadLimitReached

public boolean isUploadLimitReached()
Returns:
true, if uploads are temporarily denied

isUpToDate

public boolean isUpToDate()

notifyWhoisReceived

public void notifyWhoisReceived()
Called by message class when whois query was received.


setConnectDuration

public void setConnectDuration(int newValue)

setDownloadCount

public void setDownloadCount(int newValue)

setHost

public void setHost(java.lang.String newValue)

setLastSeen

public void setLastSeen(long newValue)

setLevel

public void setLevel(java.lang.String newValue)

setPort

public void setPort(int newValue)

setLinkSpeed

public void setLinkSpeed(int newValue)
Maps OpenNap types to real values.

Overrides:
setLinkSpeed in class AbstractPeer

setStatus

public void setStatus(java.lang.String newValue)

setUploadCount

public void setUploadCount(int newValue)

shouldRequery

public boolean shouldRequery()

toString

public java.lang.String toString()
Description copied from class: AbstractPeer
Returns the value of getName().

Overrides:
toString in class AbstractPeer

update

public boolean update(boolean force)
Sends a whois query to the server if not up to date.

Returns:
true, if up to date; false, if not.

update

public boolean update()


Copyright © 2001-2005 XNap Team. All Rights Reserved.