org.xnap.plugin.opennap.net
Class OpenNapServer

java.lang.Object
  extended by org.xnap.chat.AbstractChatProvider
      extended by org.xnap.plugin.opennap.net.OpenNapServer
All Implemented Interfaces:
ChatProvider

public class OpenNapServer
extends AbstractChatProvider


Field Summary
static int DEFAULT_META_PORT
           
static int DEFAULT_PORT
           
static int FAILED_INTERVAL
          Timeout before connect retry if connection failed.
static int LOGIN_INTERVAL
          Timeout before connect retry if login failed.
 
Constructor Summary
OpenNapServer()
           
OpenNapServer(OpenNapServerData data)
           
OpenNapServer(java.lang.String host, int port)
           
OpenNapServer(java.lang.String host, int port, boolean autoConnect)
           
OpenNapServer(java.lang.String host, int port, java.lang.String network)
           
OpenNapServer(java.lang.String host, int port, java.lang.String network, boolean autoConnect)
           
OpenNapServer(java.lang.String host, java.lang.String ip, int port, java.lang.String network, int fileCount, int fileSize, int userCount, boolean autoConnect)
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void addStateListener(StateListener listener)
           
 boolean canAutoRemove()
           
 void connect()
          Connects to the server.
 void disconnect()
          Disconnects from the server.
 boolean equals(java.lang.Object obj)
          Returns true if obj has the same hostname and port.
 javax.swing.Action[] getActions()
          Returns an array of actions that can be performed on the provider.
 boolean getAutoConnect()
           
 java.lang.String getAutoJoinChannels()
           
 OpenNapChannel getChannel(java.lang.String name)
           
 OpenNapChannel getChannel(java.lang.String name, boolean add)
           
 ChannelInfo[] getChannels()
          Returns the the channels on this server.
 java.lang.String getEmail()
           
 int getFileCount()
           
 int getFileSize()
           
 java.lang.String getHost()
           
 java.lang.String getIP()
           
 long getLastConnect()
          Returns the absolute time of the last successful connect.
 OpenNapListener getListener()
          Returns the associated listener for incoming requests.
 OpenNapUser getLocalPeer()
           
 int getLocalPort()
          Returns port of listener or 0 if there is no listener running, which means XNap is behind a firewall.
 java.lang.String getName()
          Returns the name of the server shown to the user.
 OpenNapNetwork getNetwork()
          Returns the network this server is part of.
 java.lang.String getNetworkName()
          Returns the name of the network this server is part of.
 long getNextAutoConnectTime()
          Returns the absolute time of the next reconnect
 java.lang.String getNick()
           
 java.lang.String getPassword()
          Returns the password used for the login.
 int getPort()
          Returns the remote port.
 java.lang.String getRedirectedHost()
           
 int getRedirectedPort()
           
 OpenNapServerRunner getRunner()
           
 Range[] getShared()
          Returns the index range of shared files.
 java.lang.String getStatus()
           
 OpenNapUser getUser(java.lang.String nick)
           
 int getUserCount()
           
 OpenNapServerVersion getVersion()
           
 boolean isConnected()
           
 boolean isDisconnected()
           
 boolean isLoginCustomized()
           
 boolean isNewUser()
           
 boolean isRedirector()
           
 boolean isTemporary()
           
 void join(java.lang.String name)
          Adds the channel to the ChatManager and joins the channel.
 void removeChannel(OpenNapChannel c)
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void removeStateListener(StateListener listener)
           
 void setAutoConnect(boolean newvalue)
           
 void setAutoJoinChannels(java.lang.String autoJoinChannels)
           
 void setEmail(java.lang.String email)
           
 void setHost(java.lang.String host)
           
 void setIP(java.lang.String newValue)
          OpenNapigator sends an ip which is sometimes more reliable than the hostname.
 void setLastConnect(long lastConnect)
           
 void setListener(OpenNapListener newValue)
           
 void setNetwork(OpenNapNetwork network)
           
 void setNetworkName(java.lang.String networkName)
           
 void setNewUser(boolean newUser)
          Set newUser to true to create a new account on the next logon.
 void setNick(java.lang.String nick)
           
 void setPassword(java.lang.String password)
           
 void setPort(int port)
           
 void setRedirectedHost(java.lang.String redirectedHost)
           
 void setRedirectedPort(int redirectedPort)
           
 void setRedirector(boolean redirector)
           
 void setShared(Range range)
           
 void setStats(int userCount, int fileCount, int fileSize)
           
 void setTemporary(boolean temporary)
           
 void setVersion(java.lang.String newValue)
           
 java.lang.String toString()
          Returns the value of AbstractChatProvider.getName().
 
Methods inherited from class org.xnap.chat.AbstractChatProvider
addChatProviderListener, channelsUpdated, getMessages, messageReceived, removeChatProviderListener, setMessageBufferSize, setName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values

DEFAULT_META_PORT

public static final int DEFAULT_META_PORT
See Also:
Constant Field Values

LOGIN_INTERVAL

public static final int LOGIN_INTERVAL
Timeout before connect retry if login failed.

See Also:
Constant Field Values

FAILED_INTERVAL

public static final int FAILED_INTERVAL
Timeout before connect retry if connection failed.

See Also:
Constant Field Values
Constructor Detail

OpenNapServer

public OpenNapServer(java.lang.String host,
                     java.lang.String ip,
                     int port,
                     java.lang.String network,
                     int fileCount,
                     int fileSize,
                     int userCount,
                     boolean autoConnect)

OpenNapServer

public OpenNapServer(java.lang.String host,
                     int port,
                     java.lang.String network)

OpenNapServer

public OpenNapServer(java.lang.String host,
                     int port,
                     java.lang.String network,
                     boolean autoConnect)

OpenNapServer

public OpenNapServer(java.lang.String host,
                     int port)

OpenNapServer

public OpenNapServer(java.lang.String host,
                     int port,
                     boolean autoConnect)

OpenNapServer

public OpenNapServer()

OpenNapServer

public OpenNapServer(OpenNapServerData data)
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)

addStateListener

public void addStateListener(StateListener listener)

removeStateListener

public void removeStateListener(StateListener listener)

canAutoRemove

public boolean canAutoRemove()

connect

public void connect()
Connects to the server.


disconnect

public void disconnect()
Disconnects from the server.


join

public void join(java.lang.String name)
Adds the channel to the ChatManager and joins the channel.


equals

public boolean equals(java.lang.Object obj)
Returns true if obj has the same hostname and port.

Overrides:
equals in class java.lang.Object

getChannel

public OpenNapChannel getChannel(java.lang.String name,
                                 boolean add)

getChannel

public OpenNapChannel getChannel(java.lang.String name)

getActions

public javax.swing.Action[] getActions()
Description copied from interface: ChatProvider
Returns an array of actions that can be performed on the provider.


getAutoJoinChannels

public java.lang.String getAutoJoinChannels()

getAutoConnect

public boolean getAutoConnect()

getChannels

public ChannelInfo[] getChannels()
Description copied from interface: ChatProvider
Returns the the channels on this server.


getEmail

public java.lang.String getEmail()

getFileCount

public int getFileCount()

getFileSize

public int getFileSize()

getHost

public java.lang.String getHost()

getIP

public java.lang.String getIP()

getLastConnect

public long getLastConnect()
Returns the absolute time of the last successful connect.


getListener

public OpenNapListener getListener()
Returns the associated listener for incoming requests. Needed for reverse downloads.


getLocalPeer

public OpenNapUser getLocalPeer()

getLocalPort

public int getLocalPort()
Returns port of listener or 0 if there is no listener running, which means XNap is behind a firewall.


getName

public java.lang.String getName()
Description copied from interface: ChatProvider
Returns the name of the server shown to the user.

Specified by:
getName in interface ChatProvider
Overrides:
getName in class AbstractChatProvider

getNetworkName

public java.lang.String getNetworkName()
Returns the name of the network this server is part of.


getNetwork

public OpenNapNetwork getNetwork()
Returns the network this server is part of.


getNextAutoConnectTime

public long getNextAutoConnectTime()
Returns the absolute time of the next reconnect

Returns:
-1, if the server last connect failed unrecoverably; * absolute time of next wished connect attempt in milli seconds, otherwise

getNick

public java.lang.String getNick()

getPassword

public java.lang.String getPassword()
Returns the password used for the login.


getPort

public int getPort()
Returns the remote port.


getRedirectedHost

public java.lang.String getRedirectedHost()

getRedirectedPort

public int getRedirectedPort()

getRunner

public OpenNapServerRunner getRunner()

getShared

public Range[] getShared()
Returns the index range of shared files.


setShared

public void setShared(Range range)

getStatus

public java.lang.String getStatus()

getUser

public OpenNapUser getUser(java.lang.String nick)

getUserCount

public int getUserCount()

getVersion

public OpenNapServerVersion getVersion()

isConnected

public boolean isConnected()

isDisconnected

public boolean isDisconnected()

isLoginCustomized

public boolean isLoginCustomized()

isNewUser

public boolean isNewUser()

isRedirector

public boolean isRedirector()

isTemporary

public boolean isTemporary()

removeChannel

public void removeChannel(OpenNapChannel c)

setAutoConnect

public void setAutoConnect(boolean newvalue)

setAutoJoinChannels

public void setAutoJoinChannels(java.lang.String autoJoinChannels)

setEmail

public void setEmail(java.lang.String email)
Throws:
java.lang.IllegalArgumentException - if newValue is invalid.

setHost

public void setHost(java.lang.String host)

setIP

public void setIP(java.lang.String newValue)
OpenNapigator sends an ip which is sometimes more reliable than the hostname.


setLastConnect

public void setLastConnect(long lastConnect)

setListener

public void setListener(OpenNapListener newValue)

setNetwork

public void setNetwork(OpenNapNetwork network)

setNetworkName

public void setNetworkName(java.lang.String networkName)

setNewUser

public void setNewUser(boolean newUser)
Set newUser to true to create a new account on the next logon.


setNick

public void setNick(java.lang.String nick)
Throws:
java.lang.IllegalArgumentException - if nick is invalid.

setPassword

public void setPassword(java.lang.String password)
Throws:
java.lang.IllegalArgumentException - if password is invalid.

setPort

public void setPort(int port)

setRedirectedHost

public void setRedirectedHost(java.lang.String redirectedHost)

setRedirectedPort

public void setRedirectedPort(int redirectedPort)

setRedirector

public void setRedirector(boolean redirector)

setStats

public void setStats(int userCount,
                     int fileCount,
                     int fileSize)

setTemporary

public void setTemporary(boolean temporary)

setVersion

public void setVersion(java.lang.String newValue)

toString

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

Overrides:
toString in class AbstractChatProvider


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