See on Tõrva Gümnaasiumi vana veebilehe arhiiv. Uus veebileht: https://torva.edu.ee/

IRCServer (PJIRC project)

Lisamaterjalide loend

Algne fail: vana_veeb/pjirc/doc/javadoc/irc/IRCServer.html.

========== START OF NAVBAR ==========
=========== END OF NAVBAR ===========
======== START OF CLASS DATA ========

irc
Class IRCServer

java.lang.Object
  |
  +--irc.IRCObject
        |
        +--irc.IRCServer
All Implemented Interfaces:
Server, ServerProtocolListener

public class IRCServer
extends IRCObject
implements Server, ServerProtocolListener

The IRC server.


Field Summary
 
Fields inherited from class irc.IRCObject
_ircConfiguration
 
Constructor Summary
IRCServer(IRCConfiguration config, java.lang.String nick, java.lang.String altNick, java.lang.String userName)
          Create a new IRCServer.
 
Method Summary
 void addIgnore(java.lang.String nick)
          Ignore the given nick.
 void addReplyServerListener(ReplyServerListener l)
          Add a reply listener.
 void addServerListener(ServerListener l)
          Add a server listener.
 void connect(java.lang.String host, int port, java.lang.String passWord)
          Connect to the irc server.
 void connected()
          The server is now connected.
 void connectionFailed(java.lang.String message)
          The connection coulnd't be established.
 void disconnect()
          Disconnect from the irc server.
 void disconnected()
          Connection to server has been lost.
 void execute(java.lang.String str)
          Execute the given command on the remote server.
 ChanList getChanList(java.lang.String name)
          Get the chanlist from its name.
 java.util.Enumeration getChanLists()
          Get all the chanlists.
 Channel getChannel(java.lang.String name)
          Get the channel from its name.
 java.lang.String[] getChannelPrefixes()
          Get an array of all known channel prefixes.
 java.util.Enumeration getChannels()
          Get all the channels.
 int getLocalPort()
          Get the local port of the remote connection.
 java.lang.String getMode()
          Get the current status mode.
 java.lang.String getNick()
          Get the nickname on this server.
 java.lang.String getNickMode(java.lang.String prefix)
          Get the nick mode associated with the given nick prefix.
 java.lang.String[] getNickModes()
          Get an array of all known nickname modes.
 java.lang.String getNickPrefix(java.lang.String mode)
          Get the nick prefix associated with the given nick mode.
 java.lang.String[] getNickPrefixes()
          Get an array of all known nickname prefixes.
 java.util.Enumeration getQueries()
          Get all the queries.
 Query getQuery(java.lang.String nick, boolean bring)
          Get the query from its name.
 Status getStatus()
          Get this server's status.
 java.lang.String getUserName()
          Get the username on this server.
 boolean ignore(java.lang.String nick)
          Return true if this server is ignoring the given nick, false otherwise.
 boolean isConnected()
          Return true if connected to the server, false otherwise.
 void leaveChanList(java.lang.String name)
          Request to leave the given channel list.
 void leaveChannel(java.lang.String name)
          Request to leave the given channel.
 void leaveQuery(java.lang.String name)
          Request to leave the given query.
 void messageReceived(java.lang.String prefix, java.lang.String command, java.lang.String[] params)
          A new server message has been received.
 void removeIgnore(java.lang.String nick)
          Remove the given list from the ignore list.
 void removeReplyServerListener(ReplyServerListener l)
          Remove a reply listener.
 void removeServerListener(ServerListener l)
          Remove a listener.
 void replyReceived(java.lang.String prefix, java.lang.String id, java.lang.String[] params)
          A new server numeric reply has been received.
 void say(java.lang.String destination, java.lang.String str)
          Say the specified string.
 void sendStatusMessage(java.lang.String msg)
          Send the given message to the server's status.
 
Methods inherited from class irc.IRCObject
getColor, getIRCConfiguration, getText, getText, getText, getText, getTimeStamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IRCServer

public IRCServer(IRCConfiguration config,
                 java.lang.String nick,
                 java.lang.String altNick,
                 java.lang.String userName)
Create a new IRCServer.

Parameters:
config - global IRCConfiguration.
nick - claimed nick.
altNick - claimed alternate nick.
userName - user name.

Method Detail

connect

public void connect(java.lang.String host,
                    int port,
                    java.lang.String passWord)
Connect to the irc server.

Parameters:
host - server host.
port - server port.


disconnect

public void disconnect()
Disconnect from the irc server.


isConnected

public boolean isConnected()
Return true if connected to the server, false otherwise.

Returns:
connected state.


connectionFailed

public void connectionFailed(java.lang.String message)
Description copied from interface: ServerProtocolListener
The connection coulnd't be established.

Specified by:
connectionFailed in interface ServerProtocolListener
Parameters:
message - error message.


getLocalPort

public int getLocalPort()
Get the local port of the remote connection.

Returns:
the local, client-side port of the remote connection.


connected

public void connected()
Description copied from interface: ServerProtocolListener
The server is now connected.

Specified by:
connected in interface ServerProtocolListener


disconnected

public void disconnected()
Description copied from interface: ServerProtocolListener
Connection to server has been lost.

Specified by:
disconnected in interface ServerProtocolListener


sendStatusMessage

public void sendStatusMessage(java.lang.String msg)
Description copied from interface: Server
Send the given message to the server's status.

Specified by:
sendStatusMessage in interface Server
Parameters:
msg - string to send to the status.


getChannels

public java.util.Enumeration getChannels()
Get all the channels.

Returns:
an enumeration of channels.


getQueries

public java.util.Enumeration getQueries()
Get all the queries.

Returns:
an enumeration of queries.


getChanLists

public java.util.Enumeration getChanLists()
Get all the chanlists.

Returns:
an enumeration of chanlists.


getChannel

public Channel getChannel(java.lang.String name)
Get the channel from its name. If this channel doesn't exist, it is created but not activated.

Parameters:
name - channel name.
Returns:
channel.


getQuery

public Query getQuery(java.lang.String nick,
                      boolean bring)
Get the query from its name. If this query doesn't exist, it is created but not activated.

Returns:
channel.


getChanList

public ChanList getChanList(java.lang.String name)
Get the chanlist from its name. If this chanlist doesn't exist, it is created.

Parameters:
name - chanlist name.
Returns:
channel.


leaveChannel

public void leaveChannel(java.lang.String name)
Request to leave the given channel.

Parameters:
name - channel name.


leaveQuery

public void leaveQuery(java.lang.String name)
Request to leave the given query.

Parameters:
name - query name.


leaveChanList

public void leaveChanList(java.lang.String name)
Request to leave the given channel list.

Parameters:
name - chanlist name.


getStatus

public Status getStatus()
Get this server's status.


addServerListener

public void addServerListener(ServerListener l)
Add a server listener.

Parameters:
l - listener to add.


removeServerListener

public void removeServerListener(ServerListener l)
Remove a listener.

Parameters:
l - listener to remove.


addReplyServerListener

public void addReplyServerListener(ReplyServerListener l)
Add a reply listener.

Parameters:
l - listener to add.


removeReplyServerListener

public void removeReplyServerListener(ReplyServerListener l)
Remove a reply listener.

Parameters:
l - listener to remove.


getChannelPrefixes

public java.lang.String[] getChannelPrefixes()
Get an array of all known channel prefixes.

Returns:
an array of all channel prefixes.


getNickPrefixes

public java.lang.String[] getNickPrefixes()
Get an array of all known nickname prefixes.

Returns:
array of all nickname prefixes.


getNickModes

public java.lang.String[] getNickModes()
Get an array of all known nickname modes.

Returns:
array of all nickname modes.


getNickPrefix

public java.lang.String getNickPrefix(java.lang.String mode)
Get the nick prefix associated with the given nick mode.

Parameters:
mode - nick mode.
Returns:
nick prefix for this mode.


getNickMode

public java.lang.String getNickMode(java.lang.String prefix)
Get the nick mode associated with the given nick prefix.

Returns:
nick mode for this prefix.


replyReceived

public void replyReceived(java.lang.String prefix,
                          java.lang.String id,
                          java.lang.String[] params)
Description copied from interface: ServerProtocolListener
A new server numeric reply has been received.

Specified by:
replyReceived in interface ServerProtocolListener
Parameters:
prefix - reply prefix.
id - reply id.
params - reply parameters.


ignore

public boolean ignore(java.lang.String nick)
Return true if this server is ignoring the given nick, false otherwise.

Parameters:
nick - nick to test.


addIgnore

public void addIgnore(java.lang.String nick)
Ignore the given nick.

Parameters:
nick - nick to ignore.


removeIgnore

public void removeIgnore(java.lang.String nick)
Remove the given list from the ignore list.

Parameters:
nick - nick to remove from ignore list.


messageReceived

public void messageReceived(java.lang.String prefix,
                            java.lang.String command,
                            java.lang.String[] params)
Description copied from interface: ServerProtocolListener
A new server message has been received.

Specified by:
messageReceived in interface ServerProtocolListener
Parameters:
prefix - message prefix.
command - message command.
params - message parameters.


getNick

public java.lang.String getNick()
Description copied from interface: Server
Get the nickname on this server.

Specified by:
getNick in interface Server
Returns:
the nickname on the server.


getUserName

public java.lang.String getUserName()
Description copied from interface: Server
Get the username on this server.

Specified by:
getUserName in interface Server
Returns:
the username on this server.


getMode

public java.lang.String getMode()
Get the current status mode.

Returns:
status mode.


say

public void say(java.lang.String destination,
                java.lang.String str)
Description copied from interface: Server
Say the specified string. This string is sent as it to the remote server.

Specified by:
say in interface Server
Parameters:
destination - message destination.
str - message itself.


execute

public void execute(java.lang.String str)
Description copied from interface: Server
Execute the given command on the remote server.

Specified by:
execute in interface Server
Parameters:
str - the command to execute.