com.lyrisoft.chat.client
Class Client

java.lang.Object
  |
  +--com.lyrisoft.chat.client.DumbClient
        |
        +--com.lyrisoft.chat.client.Client
All Implemented Interfaces:
Constants, IChatClient, IChatClientInputReceiver, ICommands

public class Client
extends DumbClient
implements IChatClientInputReceiver, IChatClient, Constants, ICommands

The heart of the NFC client program. Notice that this is just a subclass of DumbClient, with a whole lot of functionality added in


Field Summary
protected  java.applet.Applet _applet
           
protected  IChatGUIFactory _factory
           
protected  ChatGUI _gui
           
protected  java.lang.String _initialRoom
           
protected  java.lang.String _myName
           
protected  IChatServer _serverInterface
           
protected  UserCommands _userCommands
           
 
Fields inherited from class com.lyrisoft.chat.client.DumbClient
_attributes
 
Fields inherited from interface com.lyrisoft.chat.Constants
SERVER_NAME
 
Fields inherited from interface com.lyrisoft.chat.ICommands
ACCESS_DENIED, ACK_KILL, ALREADY_SIGNED_ON, DELIMITER, EMOTE_TO_ROOM, EMOTE_TO_USER, ERROR, GET_ROOMS, GET_USERS_IN_ROOM, GET_USERS_ON_SERVER, HELP, HYPERLINK, IGNORE, INVALID_CHARACTER, INVITE, JOIN_ROOM, JOIN_ROOM_ACK, KICK, KILL, NO_INVITE, NO_SUCH_USER, OP, PART_ROOM, PART_ROOM_ACK, PING, PONG, REMOTE_CLIENT_MESSAGE, ROOM_ACCESS_DENIED, ROOM_DIFF, ROOM_MSG, ROOM_USER_DIFF, SAY_TO_ROOM, SAY_TO_USER, SHUTDOWN, SIGNOFF, SIGNON, SIGNON_ACK, STATS, UNIGNORE, UNINVITE, USER_DIFF, VERSION, WHOIS
 
Constructor Summary
protected Client()
          Exists so subclasses can completely override the construction.
  Client(java.lang.String host, int port)
          Construct a Client that will connect to the given host and port
  Client(java.lang.String host, int port, java.lang.String readUrl, java.lang.String writeUrl)
          Construct a Client that will connect to the given host and port and fallback to tunneling mode using the readUrl and writeUrl.
  Client(java.lang.String readUrl, java.lang.String writeUrl)
          Construct a Client that will connect to the server in tunnel mode only.
 
Method Summary
 void ackJoinRoom(java.lang.String room)
          The server has acknowledged our room join
 void ackKill(java.lang.String victim)
          Acknowledgement that we successfully killed somebody
 void ackPartRoom(java.lang.String room)
          The server has acknowledged our room part
 void ackSignon(java.lang.String myName)
          The server has authenticated us and acknowledged our sign on
 void connectionLost()
          The connection is lost.
 void emote(java.lang.String from, java.lang.String room, java.lang.String message)
          Indicates that somebody is emoting
 void emoteFromUserPrivate(java.lang.String user, java.lang.String msg)
          The server is indicating that someone is privately emoting something to us.
 void emoteToUserPrivate(java.lang.String rcpt, java.lang.String msg)
           
 void generalError(java.lang.String message)
          The server is giving us an error message to display
 void generalMessage(java.lang.String message)
          The server is giving us a general message to display.
 void generalRoomMessage(java.lang.String room, java.lang.String message)
          The server is giving us a message to display in the context of a particular room.
 ChatGUI getGUI()
          get the ChatGUI object
 java.lang.String getMyName()
           
 IChatServer getServerInterface()
          Get's the 'local view' of the server
 java.lang.String getVersion()
           
 void globalUserList(java.lang.String[] users)
          The server is sending us the global user list
 void init()
          Call after all attributes have been set
 void inputEvent(java.lang.String room, java.lang.String txt)
          From the IChatClientInputReceiver interface...
 void killed(java.lang.String killer, java.lang.String msg)
          Indicates that we have been killed.
 void loginCancelEvent()
           
 void loginEvent(java.lang.String username, java.lang.String password)
          from the IChatClientInputReceiver interface...
 void messageFromUser(java.lang.String user, java.lang.String room, java.lang.String msg)
          The server is indicating that someone is saying something in a room
 void messageFromUserPrivate(java.lang.String user, java.lang.String msg)
          The server is indicating that someone is saying something to us, privately
 void messageToUserPrivate(java.lang.String rcpt, java.lang.String msg)
           
 void ping(java.lang.String user, java.lang.String arg)
          The server is indicating that somebody ping'ed us.
 void pong(java.lang.String user, java.lang.String arg)
          The server is giving us the reply to a ping that we already sent out.
 void reset()
           
 void roomCreated(java.lang.String room)
          Indicates that a room has been created
 void roomDestroyed(java.lang.String room)
          Indicates that a room has been destroyed
 void roomList(java.lang.String[] roomList)
          The server is sending us a list of rooms
 void roomUserList(java.lang.String room, java.lang.String[] users)
          The server is sending us the user list for a particular room
 boolean runningAsApplet()
           
 void setApplet(java.applet.Applet a)
          If the client is running as an Applet, the Applet should call this method after instantiating
 void setInitialRoom(java.lang.String room)
           
 void showLink(java.lang.String link)
          Display the given link in a new browser window (if we're running as an applet)
 void showLogin()
           
 void userDoubleClick(java.lang.String user)
          Callback when a user is double-clicked
 void userJoinedRoom(java.lang.String user, java.lang.String room)
          The server is indicating that someone just joined a room we're in.
 void userPartedRoom(java.lang.String user, java.lang.String room, boolean signOff)
          The server is indicating that someone just parted a room we're in.
 void userSignOff(java.lang.String userId)
          Indicates that a user has signed off
 void userSignOn(java.lang.String userId)
          Indicates that a user has signed on
 
Methods inherited from class com.lyrisoft.chat.client.DumbClient
getAttribute, getProperties, setAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.lyrisoft.chat.client.IChatClient
getAttribute, setAttribute
 

Field Detail

_serverInterface

protected IChatServer _serverInterface

_gui

protected ChatGUI _gui

_initialRoom

protected java.lang.String _initialRoom

_applet

protected java.applet.Applet _applet

_myName

protected java.lang.String _myName

_userCommands

protected UserCommands _userCommands

_factory

protected IChatGUIFactory _factory
Constructor Detail

Client

public Client(java.lang.String host,
              int port)
Construct a Client that will connect to the given host and port

Client

public Client(java.lang.String host,
              int port,
              java.lang.String readUrl,
              java.lang.String writeUrl)
Construct a Client that will connect to the given host and port and fallback to tunneling mode using the readUrl and writeUrl.

Client

public Client(java.lang.String readUrl,
              java.lang.String writeUrl)
Construct a Client that will connect to the server in tunnel mode only.

Client

protected Client()
Exists so subclasses can completely override the construction.
Method Detail

getGUI

public ChatGUI getGUI()
get the ChatGUI object

init

public void init()
Call after all attributes have been set
Specified by:
init in interface IChatClient

getMyName

public java.lang.String getMyName()

messageToUserPrivate

public void messageToUserPrivate(java.lang.String rcpt,
                                 java.lang.String msg)

emoteToUserPrivate

public void emoteToUserPrivate(java.lang.String rcpt,
                               java.lang.String msg)

setInitialRoom

public void setInitialRoom(java.lang.String room)
Specified by:
setInitialRoom in interface IChatClient

runningAsApplet

public boolean runningAsApplet()

setApplet

public void setApplet(java.applet.Applet a)
If the client is running as an Applet, the Applet should call this method after instantiating
Specified by:
setApplet in interface IChatClient

getServerInterface

public IChatServer getServerInterface()
Get's the 'local view' of the server
Specified by:
getServerInterface in interface IChatClient

showLink

public void showLink(java.lang.String link)
Display the given link in a new browser window (if we're running as an applet)
Parameters:
link - a URL to display

inputEvent

public void inputEvent(java.lang.String room,
                       java.lang.String txt)
From the IChatClientInputReceiver interface...

Delegated to UserCommands.process()

Specified by:
inputEvent in interface IChatClientInputReceiver
Parameters:
room - the room the message was typed in
txt - the text that the user typed. if this is null, the method immediately returns
See Also:
UserCommands.process(java.lang.String, java.lang.String, com.lyrisoft.chat.client.Client)

loginEvent

public void loginEvent(java.lang.String username,
                       java.lang.String password)
from the IChatClientInputReceiver interface...

Delegated to ChatServerLocal.signOn()

Specified by:
loginEvent in interface IChatClientInputReceiver
See Also:
ChatServerLocal.signOn(java.lang.String, java.lang.String)

loginCancelEvent

public void loginCancelEvent()
Specified by:
loginCancelEvent in interface IChatClientInputReceiver

ackSignon

public void ackSignon(java.lang.String myName)
Description copied from interface: IChatClient
The server has authenticated us and acknowledged our sign on
Specified by:
ackSignon in interface IChatClient
Overrides:
ackSignon in class DumbClient

getVersion

public java.lang.String getVersion()

connectionLost

public void connectionLost()
The connection is lost.

If we're running as an Applet, then show the login dialog. Otherwise, print a message and exit.

Specified by:
connectionLost in interface IChatClient
Overrides:
connectionLost in class DumbClient

showLogin

public void showLogin()
Specified by:
showLogin in interface IChatClient

reset

public void reset()

ackJoinRoom

public void ackJoinRoom(java.lang.String room)
Description copied from interface: IChatClient
The server has acknowledged our room join
Specified by:
ackJoinRoom in interface IChatClient
Overrides:
ackJoinRoom in class DumbClient

ackPartRoom

public void ackPartRoom(java.lang.String room)
Description copied from interface: IChatClient
The server has acknowledged our room part
Specified by:
ackPartRoom in interface IChatClient
Overrides:
ackPartRoom in class DumbClient

messageFromUser

public void messageFromUser(java.lang.String user,
                            java.lang.String room,
                            java.lang.String msg)
Description copied from interface: IChatClient
The server is indicating that someone is saying something in a room
Specified by:
messageFromUser in interface IChatClient
Overrides:
messageFromUser in class DumbClient

messageFromUserPrivate

public void messageFromUserPrivate(java.lang.String user,
                                   java.lang.String msg)
Description copied from interface: IChatClient
The server is indicating that someone is saying something to us, privately
Specified by:
messageFromUserPrivate in interface IChatClient
Overrides:
messageFromUserPrivate in class DumbClient

emoteFromUserPrivate

public void emoteFromUserPrivate(java.lang.String user,
                                 java.lang.String msg)
Description copied from interface: IChatClient
The server is indicating that someone is privately emoting something to us. (Note, there is no "emoteFromUserPublic"; A public emote comes in as a generalRoomMessage
Specified by:
emoteFromUserPrivate in interface IChatClient
Overrides:
emoteFromUserPrivate in class DumbClient
Following copied from interface: com.lyrisoft.chat.client.IChatClient
See Also:
IChatClient.generalRoomMessage(java.lang.String, java.lang.String)

roomList

public void roomList(java.lang.String[] roomList)
Description copied from interface: IChatClient
The server is sending us a list of rooms
Specified by:
roomList in interface IChatClient
Overrides:
roomList in class DumbClient

globalUserList

public void globalUserList(java.lang.String[] users)
Description copied from interface: IChatClient
The server is sending us the global user list
Specified by:
globalUserList in interface IChatClient
Overrides:
globalUserList in class DumbClient

roomUserList

public void roomUserList(java.lang.String room,
                         java.lang.String[] users)
Description copied from interface: IChatClient
The server is sending us the user list for a particular room
Specified by:
roomUserList in interface IChatClient
Overrides:
roomUserList in class DumbClient

userJoinedRoom

public void userJoinedRoom(java.lang.String user,
                           java.lang.String room)
Description copied from interface: IChatClient
The server is indicating that someone just joined a room we're in.
Specified by:
userJoinedRoom in interface IChatClient
Overrides:
userJoinedRoom in class DumbClient

userPartedRoom

public void userPartedRoom(java.lang.String user,
                           java.lang.String room,
                           boolean signOff)
Description copied from interface: IChatClient
The server is indicating that someone just parted a room we're in.
Specified by:
userPartedRoom in interface IChatClient
Overrides:
userPartedRoom in class DumbClient

generalError

public void generalError(java.lang.String message)
Description copied from interface: IChatClient
The server is giving us an error message to display
Specified by:
generalError in interface IChatClient
Overrides:
generalError in class DumbClient

generalMessage

public void generalMessage(java.lang.String message)
Description copied from interface: IChatClient
The server is giving us a general message to display. (This could be a MOTD or the answer to some general request like the /stats command)
Specified by:
generalMessage in interface IChatClient
Overrides:
generalMessage in class DumbClient

generalRoomMessage

public void generalRoomMessage(java.lang.String room,
                               java.lang.String message)
Description copied from interface: IChatClient
The server is giving us a message to display in the context of a particular room. This is commonly an emote message.
Specified by:
generalRoomMessage in interface IChatClient
Overrides:
generalRoomMessage in class DumbClient

ping

public void ping(java.lang.String user,
                 java.lang.String arg)
Description copied from interface: IChatClient
The server is indicating that somebody ping'ed us. It expects to get a pong message back
Specified by:
ping in interface IChatClient
Overrides:
ping in class DumbClient

pong

public void pong(java.lang.String user,
                 java.lang.String arg)
Description copied from interface: IChatClient
The server is giving us the reply to a ping that we already sent out.
Specified by:
pong in interface IChatClient
Overrides:
pong in class DumbClient

killed

public void killed(java.lang.String killer,
                   java.lang.String msg)
Description copied from class: DumbClient
Indicates that we have been killed.
Specified by:
killed in interface IChatClient
Overrides:
killed in class DumbClient
Following copied from class: com.lyrisoft.chat.client.DumbClient
Parameters:
killer - the use who killed us
msg - an explanation of why were have been killed

ackKill

public void ackKill(java.lang.String victim)
Description copied from class: DumbClient
Acknowledgement that we successfully killed somebody
Specified by:
ackKill in interface IChatClient
Overrides:
ackKill in class DumbClient

emote

public void emote(java.lang.String from,
                  java.lang.String room,
                  java.lang.String message)
Description copied from class: DumbClient
Indicates that somebody is emoting
Specified by:
emote in interface IChatClient
Overrides:
emote in class DumbClient

userSignOn

public void userSignOn(java.lang.String userId)
Description copied from class: DumbClient
Indicates that a user has signed on
Specified by:
userSignOn in interface IChatClient
Overrides:
userSignOn in class DumbClient

userSignOff

public void userSignOff(java.lang.String userId)
Description copied from class: DumbClient
Indicates that a user has signed off
Specified by:
userSignOff in interface IChatClient
Overrides:
userSignOff in class DumbClient

roomCreated

public void roomCreated(java.lang.String room)
Description copied from class: DumbClient
Indicates that a room has been created
Specified by:
roomCreated in interface IChatClient
Overrides:
roomCreated in class DumbClient

roomDestroyed

public void roomDestroyed(java.lang.String room)
Description copied from class: DumbClient
Indicates that a room has been destroyed
Specified by:
roomDestroyed in interface IChatClient
Overrides:
roomDestroyed in class DumbClient

userDoubleClick

public void userDoubleClick(java.lang.String user)
Description copied from interface: IChatClientInputReceiver
Callback when a user is double-clicked
Specified by:
userDoubleClick in interface IChatClientInputReceiver


Copyright © 2000-2002 Taso Lyristis