ServerObject
, ServerUser
IMudUser
public abstract class Interactive extends java.lang.Object implements ServerUser
Constructor | Description |
---|---|
Interactive() |
Constructs a new interactive object and initializes
its data.
|
Modifier and Type | Method | Description |
---|---|---|
void |
connect() |
Implementation of the ServerUser connect method.
|
static java.lang.String |
createKeyName(java.lang.String nom) |
Given a user name, this method will build a unique
key.
|
void |
destruct() |
Stops any running I/O threads for this interactive, closes the
user socket, and marks the object for destruction according to
the requirements of the ServerObject interface.
|
static Interactive |
findUser(java.lang.String nom) |
Given a user name, this method will find the Interactive
instance associated with that user name.
|
java.lang.String |
getAddressName() |
Provides the address from which this user is connected.
|
InteractiveBody |
getBody() |
Provides the body to which this user is connected.
|
java.util.Date |
getCurrentLoginTime() |
Provides the time at which the user logged in for this session
|
boolean |
getDestructed() |
Tells whether or not the user is marked for destruction.
|
java.lang.String |
getDisplayName() |
Provides the user's name as they wish it to appear
with mixed capitalization, spaces, hyphens, etc.
|
java.lang.String |
getEmail() |
Provides the user's email address
|
int |
getIdle() |
Provides the number of seconds which have elapsed since the user
last entered a command.
|
java.lang.String |
getKeyName() |
Provides the key name for this user.
|
java.lang.String |
getLastLoginSite() |
Provides the name of the site from which the user logged in
at their last login.
|
java.util.Date |
getLastLoginTime() |
Provides the time of the user's last login.
|
java.lang.String |
getObjectId() |
Gives the user object's object id.
|
protected java.lang.String |
getPassword() |
Allows a subclass to get the password.
|
java.lang.String |
getPrompt() |
Provides the user's command prompt.
|
java.lang.String |
getRealName() |
Provides the user's real name, or null if they never entered
a real name.
|
protected void |
input(java.lang.String cmd) |
Called whenever a command is pulled off the incoming
command stack.
|
protected void |
loseLink() |
This method is triggered by the input thread when it detects
that the user has lost their link.
|
void |
processEvent() |
Does event handling for the user object.
|
void |
processInput() |
The server triggers this method once each server cycle to see
if the user has any input waiting to be processed.
|
void |
redirectInput(Input ob) |
Redirects user input to the input object passed to it.
|
void |
sendMessage(java.lang.String msg) |
Sends a message across to the client with a newline appended
to the message.
|
void |
sendMessage(java.lang.String msg,
boolean nowrap) |
Sends a message across to the client.
|
void |
setBody(InteractiveBody ob) |
Sets the body to which this interactive connection
is connected.
|
void |
setDisplayName(java.lang.String str) |
Sets the user's display name.
|
void |
setEmail(java.lang.String str) |
Sets the user's email address
|
protected void |
setKeyName(java.lang.String str) |
Sets the key name during user creation.
|
void |
setLastLoginSite(java.lang.String site) |
Sets the last login site.
|
void |
setLastLoginTime(java.util.Date time) |
Used by the login process to set the last login
time.
|
void |
setObjectId(java.lang.String id) |
Allows the server to set the object id.
|
protected void |
setPassword(java.lang.String pass) |
Sets the user's password.
|
void |
setRealName(java.lang.String nom) |
Sets the user's real name.
|
void |
setSocket(java.net.Socket s) |
Called by the server before connect() is called to assign
the socket for this Interactive to it.
|
boolean |
validatePassword(java.lang.String other) |
Validates a user password against a random string.
|
public Interactive()
public static java.lang.String createKeyName(java.lang.String nom) throws InvalidNameException
nom
- the visual name to create a key fromInvalidNameException
- thrown if the name produces an unuseable keyInvalidNameException
- an error telling you to pick a new namepublic static Interactive findUser(java.lang.String nom)
nom
- the name of the desired userpublic void connect()
connect
in interface ServerUser
public void destruct()
destruct
in interface ServerObject
ServerObject.getDestructed()
protected void input(java.lang.String cmd)
cmd
- the command to be executedprocessInput()
protected void loseLink()
public void processEvent()
processEvent
in interface ServerObject
ServerObject.processEvent()
public final void processInput()
processInput
in interface ServerUser
input(java.lang.String)
,
ServerUser.processInput()
,
ServerThread.tick(com.planet_ink.coffee_mud.core.interfaces.Tickable, int)
public final void redirectInput(Input ob)
ob
- the instance of com.planet_ink.coffee_mud.core.intermud.i3.net.Input to which input will be redirectedInput
,
input(java.lang.String)
public final void sendMessage(java.lang.String msg)
msg
- the message to send to the client machinepublic final void sendMessage(java.lang.String msg, boolean nowrap)
msg
- the message to send to the clientnowrap
- if true, no newline is attachedpublic final boolean validatePassword(java.lang.String other)
other
- the password to checkpublic final java.lang.String getAddressName()
public final InteractiveBody getBody()
public void setBody(InteractiveBody ob)
ob
- the body to which this interactive is being connectedInteractiveBody
public final java.util.Date getCurrentLoginTime()
public boolean getDestructed()
getDestructed
in interface ServerObject
public java.lang.String getDisplayName()
public final void setDisplayName(java.lang.String str)
str
- the new display namepublic final java.lang.String getEmail()
public final void setEmail(java.lang.String str)
str
- the new email addresspublic final int getIdle()
public final java.lang.String getKeyName()
createKeyName(java.lang.String)
protected void setKeyName(java.lang.String str)
str
- the key name being setgetKeyName()
public final java.lang.String getLastLoginSite()
public void setLastLoginSite(java.lang.String site)
site
- the last login sitepublic final java.util.Date getLastLoginTime()
public void setLastLoginTime(java.util.Date time)
time
- the time the user last logged inpublic final java.lang.String getObjectId()
getObjectId
in interface ServerObject
ServerObject.getObjectId()
public final void setObjectId(java.lang.String id)
setObjectId
in interface ServerObject
id
- the object id assigned to this objectServerObject.setObjectId(java.lang.String)
protected java.lang.String getPassword()
protected void setPassword(java.lang.String pass)
pass
- the new passwordpublic java.lang.String getPrompt()
public final java.lang.String getRealName()
public void setRealName(java.lang.String nom)
nom
- the real name for the userpublic final void setSocket(java.net.Socket s) throws java.io.IOException
setSocket
in interface ServerUser
s
- the socket for this connectionjava.io.IOException
- thrown if a problem creating I/O streams occursServerUser.setSocket(java.net.Socket)