<NME> Session.java
<BEF> package com.planet_ink.coffee_mud.Common.interfaces;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.threads.CMRunnable;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.ColorLibrary.ColorState;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;
import java.io.IOException;
import java.net.Socket;
import java.net.SocketException;
/*
   Copyright 2001-2022 Bo Zimmerman

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
/**
 * A Session object is the key interface between the internet user
 * and their player MOB.  In fact, the presence of an attached session
 * object to a MOB is the only difference between an NPC MOB and a player MOB.
 * This object handles input, output, and related processes.
 */
public interface Session extends CMCommon, Modifiable, CMRunnable
{
	public interface SessionFilter
	{
		/**
		 * Applies this filter to the text about to be sent to a session.
		 * Returns either the modified text, or null to cancel the filter.
		 *
		 * @param source the source of the text message
		 * @param target the target of the text message
		 * @param tool the tool being used by the message generator
		 * @param msg the message itself
		 * @return the modified message, or null to remove the filter
		 */
		public String applyFilter(final Physical source, final Environmental target, final Environmental tool, final String msg);
	}

	/**
	 * Negotiates various telnet options (or attempts to), and
	 * prints the introTextStr to the user.
	 * @param s the socket the user connected from
	 * @param groupName the name of the thread group the session goes to
	 * @param introTextStr introductory text string (Hello!)
	 */
	public void initializeSession(Socket s, String groupName, String introTextStr);

	/**
	 * Returns the group name to which this session belongs
	 * @return the thread group name
	 */
	public String getGroupName();

	/**
	 * Sets the group name to which this session belongs
	 * @param group the thread group name
	 */
	public void setGroupName(String group);

	/**
	 * Returns a list of standard/foreground telnet coded strings
	 * indexed by coffeemud color code.  May be from the standard list,
	 * or read from player records for a customized list.
	 * @return telnet coded color strings.
	 */
	public String[] getColorCodes();

	/**
	 * Low level text output method.
	 * Implements such features as snoops, spam-stacking, page
	 * breaks, and line caching
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#rawCharsOut(char[])
	 * @param msg the string to send to the user
	 * @param noCache true to disable line caching, false otherwise
	 */
	public void onlyPrint(String msg, boolean noCache);

	/**
	 * Low level text output method.
	 * Implements such features as snoops, spam-stacking.
	 * No page breaking, and Always line caching
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)
	 * @param msg the string to send to the user
	 */
	public void onlyPrint(String msg);

	/**
	 * Lowest level user-output method.  Does nothing
	 * but send the string to the user, period.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#rawCharsOut(char[])
	 * @param msg the string to send to the user
	 */

	public void rawOut(String msg);

	/**
	 * Low level line-output method.  Sets the
	 * prompt flag after write, and inserts
	 * additional pre-linefeed if currently at
	 * the prompt.  Adds post linefeed of course.
	 * Does not do a page break.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#rawPrintln(String)
	 * @param msg the string to send to the user
	 */
	public void rawPrintln(String msg);

	/**
	 * Low level line-output method.  Sets the
	 * prompt flag after write, and inserts
	 * additional pre-linefeed if currently at
	 * the prompt.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#rawPrint(String)
	 * @param msg the string to send to the user
	 */
	public void rawPrint(String msg);

	/**
	 * Low level line-output method.  Sets the
	 * prompt flag after write, and inserts
	 * additional pre-linefeed if currently at
	 * the prompt.  Adds post linefeed of course.
	 * Does not do a page break, or color, but does
	 * protect mxp clients.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#safeRawPrint(String)
	 * @param msg the string to send to the user
	 */
	public void safeRawPrintln(String msg);

	/**
	 * Low level line-output method.  Sets the
	 * prompt flag after write, and inserts
	 * additional pre-linefeed if currently at
	 * the prompt.  Does not do color, but does
	 * protect mxp clients.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#safeRawPrintln(String)
	 * @param msg the string to send to the user
	 */
	public void safeRawPrint(String msg);

	/**
	 * Higher-level line output method.  Does full
	 * filtering of special characters and codes.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#rawPrint(String)
	 * @param msg the string to send to the user
	 */
	public void stdPrint(String msg);

	/**
	 * Higher-level line output method.  Does full
	 * filtering of special characters and codes
	 * using given variable values.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#rawPrint(String)
	 * @param Source variable for special code parsing: Source
	 * @param Target variable for special code parsing: Target
	 * @param Tool variable for special code parsing: Tool
	 * @param msg the string to send to the user
	 */
	public void stdPrint(Physical Source,
						 Environmental Target,
						 Environmental Tool,
						 String msg);

	/**
	 * Higher-level line output method.  Does full
	 * filtering of special characters and codes.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#rawPrintln(String)
	 * @param msg the string to send to the user
	 */
	public void stdPrintln(String msg);

	/**
	 * Higher-level line output method.  Does full
	 * filtering of special characters and codes
	 * using given variable values.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#rawPrintln(String)
	 * @param Source variable for special code parsing: Source
	 * @param Target variable for special code parsing: Target
	 * @param Tool variable for special code parsing: Tool
	 * @param msg the string to send to the user
	 */
	public void stdPrintln(Physical Source,
						   Environmental Target,
						   Environmental Tool,
						   String msg);

	/**
	 * Lowest level user-output method.  Does nothing
	 * but send the string to the user, period.
	 * @param c string (as char array) to send out to the user
	 */
	public void rawCharsOut(char[] c);

	/**
	 * Checks whether this session is currently over its
	 * time limit trying to write data to its socket.
	 * For some reason this happens, and this method
	 * detects it.
	 * @return true if something bas happened, false otherwise
	 */
	public boolean isLockedUpWriting();

	/**
	 * Returns true if this session is merely a placeholder,
	 * and does not represent an actual user connection.
	 * Will ensure that the system continues to treat the
	 * user as a mob.
	 * @return true if this session is not a connection
	 */
	public boolean isFake();

	/**
	 * Adds a new text filter to this session, which can
	 * modify any text immediately before it is sent
	 * to the user.
	 * @param filter the filter to add
	 * @return true if the filter was added, false if it was already there
	 */
	public boolean addSessionFilter(final SessionFilter filter);

	/**
	 * Returns whether this session is engaged in a login/account
	 * menu transaction.  If a loginsession is passed it, it will
	 * return true only if the two sessions are engaging the
	 * same login name.
	 * @param otherLoginName another login name potentially match
	 * @return true if it is pending, false otherwise
	 */
	public boolean isPendingLogin(final String otherLoginName);

	/**
	 * If the session is in a non-logged in state (or even if it
	 * is), this will automatically login the user with the given
	 * name and password, and switch the session to the main loop.
	 * Sending null for name/password will reset the login session.
	 * @param name the username
	 * @param password the password
	 * @return true if the login succeeded
	 */
	public boolean autoLogin(String name, String password);

	/**
	 * Medium-level text output method.  Does full
	 * filtering of special characters and codes.
	 * Does not manage the prompt, and should NOT be used for prompts.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#promptPrint(String)
	 * @param msg the string to send to the user
	 */
	public void print(String msg);

	/**
	 * Medium-level text output method.  Does full
	 * filtering of special characters and codes.
	 * Does not manage the prompt. Should be used for prompts!
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)
	 * @param msg the string to send to the user
	 */
	public void promptPrint(String msg);

	/**
	 * Medium-level text output method.  Does full
	 * filtering of special characters and codes
	 * using given variable values.
	 * Does not manage the prompt.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)
	 * @param Source variable for special code parsing: Source
	 * @param Target variable for special code parsing: Target
	 * @param Tool variable for special code parsing: Tool
	 * @param msg the string to send to the user
	 */
	public void print(Physical Source,
					  Environmental Target,
					  Environmental Tool,
					  String msg);

	/**
	 * Medium-level text output method.  Does full
	 * filtering of special characters and codes.
	 * Does not manage the prompt.
	 * Adds a linefeed at the end though.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)
	 * @param msg the string to send to the user
	 */
	public void println(String msg);

	/**
	 * Medium-level text output method.  Does full
	 * filtering of special characters and codes
	 * using given variable values.
	 * Does not manage the prompt.
	 * Adds a linefeed at the end though.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)
	 * @param Source variable for special code parsing: Source
	 * @param Target variable for special code parsing: Target
	 * @param Tool variable for special code parsing: Tool
	 * @param msg the string to send to the user
	 */
	public void println(Physical Source,
						Environmental Target,
						Environmental Tool,
						String msg);

	/**
	 * Notifies this session to output the users prompt
	 * again once it has reached a suitable lapse in
	 * text output.
	 * @param truefalse true to send another prompt, false otherwise
	 */
	public void setPromptFlag(boolean truefalse);

	/**
	 * Medium-level text output method.  Does full
	 * filtering of special characters and codes.
	 * DOES manage the prompt, but turns OFF word wrap!
	 * Adds a linefeed at the end.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)
	 * @param msg the string to send to the user
	 */
	public void wraplessPrintln(String msg);

	/**
	 * Medium-level text output method.  Does full
	 * filtering of special characters and codes.
	 * DOES manage the prompt, but turns OFF word wrap!
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)
	 * @param msg the string to send to the user
	 */
	public void wraplessPrint(String msg);

	/**
	 * Lower-Medium-level text output method.  Does only the
	 * parsing of color codes, no word wrapping, no codes.
	 * Adds a linefeed at the end.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)
	 * @param msg the string to send to the user
	 * @param noCache true to disable line caching, false otherwise
	 */
	public void colorOnlyPrintln(String msg, boolean noCache);

	/**
	 * Lower-Medium-level text output method.  Does only the
	 * parsing of color codes, no word wrapping, no codes.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)
	 * @param msg the string to send to the user
	 * @param noCache true to disable line caching, false otherwise
	 */
	public void colorOnlyPrint(String msg, boolean noCache);

	/**
	 * Lower-Medium-level text output method.  Does only the
	 * parsing of color codes, no word wrapping, no codes.
	 * Adds a linefeed at the end.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)
	 * @param msg the string to send to the user
	 */
	public void colorOnlyPrintln(String msg);

	/**
	 * Lower-Medium-level text output method.  Does only the
	 * parsing of color codes, no word wrapping, no codes.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)
	 * @param msg the string to send to the user
	 */
	public void colorOnlyPrint(String msg);

	/**
	 * Waits the given milliseconds for a key to be pressed, after which
	 * it returns that key, or \0 if nothing pressed.
	 * @param maxWait the maximum milliseconds to wait
	 * @return the key pressed, or \0
	 */
	public char hotkey(long maxWait);

	/**
	 * Prompts the user to enter a string, and then returns what
	 * the enter.  Does not time out, but may throw an exception
	 * on disconnnect.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, long)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, String, long)
	 * @param Message the prompt message to display to the user
	 * @param Default the default response if the user just hits enter
	 * @return the string entered by the user, or the Default
	 * @throws IOException a disconnect
	 */
	public String prompt(String Message, String Default)
		throws IOException;

	/**
	 * Puts the session into an input state, returning immediately.  The
	 * given callback will be made when the ENTER key has been hit, and
	 * the session will go back into a prompt state.
	 * This is basically for non-blocking input.
	 * @see InputCallback
	 * @param callBack the callback to modify and make when done
	 */
	public void prompt(InputCallback callBack);

	/**
	 * Prompts the user to enter a string, and then returns what
	 * the enter.  Possibly times out, and may throw an exception
	 * on disconnnect or time out.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, String)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, long)
	 * @param Message the prompt message to display to the user
	 * @param Default the default response if the user just hits enter
	 * @param maxTime max number of milliseconds to wait before timing out
	 * @return the string entered by the user, or the Default
	 * @throws IOException a disconnect or time out
	 */
	public String prompt(String Message, String Default, long maxTime)
		throws IOException;

	/**
	 * Prompts the user to enter a string, and then returns what
	 * the enter.  Does not time out, but may throw an exception
	 * on disconnnect.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, String)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, long)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, String, long)
	 * @param Message the prompt message to display to the user
	 * @return the string entered by the user
	 * @throws IOException a disconnect
	 */
	public String prompt(String Message)
		throws IOException;

	/**
	 * Prompts the user to enter a string, and then returns what
	 * the enter.  Possibly times out, and may throw an exception
	 * on disconnnect or time out.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, String)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, String, long)
	 * @param Message the prompt message to display to the user
	 * @param maxTime max number of milliseconds to wait before timing out
	 * @return the string entered by the user
	 * @throws IOException a disconnect or time out
	 */
	public String prompt(final String Message, long maxTime)
		throws IOException;

	/**
	 * Prompts the user to enter Y or N, and returns what they
	 * enter.  Will not time out, but may throw an exception on
	 * disconnect.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#confirm(String, String, long)
	 * @param Message the prompt message to display to the user
	 * @param Default the default response if the user just hits enter
	 * @return true if they entered Y, false otherwise
	 * @throws IOException a disconnect
	 */
	public boolean confirm(final String Message, final String Default)
		throws IOException;

	/**
	 * Prompts the user to enter Y or N, and returns what they
	 * enter. Possibly times out, and may throw an exception
	 * on disconnnect or time out.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#confirm(String, String)
	 * @param Message the prompt message to display to the user
	 * @param Default the default response if the user just hits enter
	 * @param maxTime max number of milliseconds to wait before timing out
	 * @return true if they entered Y, false otherwise
	 * @throws IOException a disconnect or time out
	 */
	public boolean confirm(final String Message, final String Default, long maxTime)
		throws IOException;

	/**
	 * Prompts the user to enter one character responses from a set of
	 * valid choices.  Repeats the prompt if the user does not enter
	 * a valid choice.  ENTER is a valid choice for Default. Does not time out,
	 * but may throw an exception on disconnnect.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#choose(String, String, String, long)
	 * @param Message the prompt message to display to the user
	 * @param Choices a list of uppercase characters that may be entered
	 * @param Default the default response if the user just hits enter
	 * @return the character entered from the choices
	 * @throws IOException a disconnect
	 */
	public String choose(final String Message, final String Choices, final String Default)
		throws IOException;

	/**
	 * Prompts the user to enter one character responses from a set of
	 * valid choices.  Repeats the prompt if the user does not enter
	 * a valid choice.  ENTER is a valid choice for Default. Does not time out,
	 * but may throw an exception on disconnnect.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#choose(String, String, String, long)
	 * @param Message the prompt message to display to the user
	 * @param Choices a list of uppercase characters that may be entered
	 * @param Default the default response if the user just hits enter
	 * @param maxTime max number of milliseconds to wait before timing out
	 * @param paramsOut an empty list to put any extra crap added to the end of the choice.
	 * @return the character entered from the choices
	 * @throws IOException a disconnect
	 */
	public String choose(final String Message, final String Choices, final String Default, long maxTime, List<String> paramsOut)
		throws IOException;

	/**
	 * Prompts the user to enter one character responses from a set of
	 * valid choices.  Repeats the prompt if the user does not enter
	 * a valid choice.  ENTER is a valid choice for Default.   May time out,
	 * and may throw an exception on disconnnect.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#choose(String, String, String)
	 * @param Message the prompt message to display to the user
	 * @param Choices a list of uppercase characters that may be entered
	 * @param Default the default response if the user just hits enter
	 * @param maxTime max number of milliseconds to wait before timing out
	 * @return the character entered from the choices
	 * @throws IOException a disconnect or time out
	 */
	public String choose(final String Message, final String Choices, final String Default, long maxTime)
		throws IOException;

	/**
	 * Notifies this session that the given session is snooping it.
	 * This session will manage said snooping.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setBeingSnoopedBy(Session, boolean)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#isBeingSnoopedBy(Session)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#snoopSuspension(int)
	 * @param session the session to snoop on me.
	 * @param onOff true to turn on snooping, false otherwise
	 */
	public void setBeingSnoopedBy(Session session, boolean onOff);

	/**
	 * Checks to see if the given session is snooping on this one.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setBeingSnoopedBy(Session, boolean)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#isBeingSnoopedBy(Session)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#snoopSuspension(int)
	 * @param S the session to check for a snoop on me.
	 * @return true if the given session is snooping on me, false otherwise
	 */
	public boolean isBeingSnoopedBy(Session S);

	/**
	 * Increments or decrements the snoop suspension counter
	 * by the given amount.  Only when the counter is 0 does
	 * snooping of this session actually occur.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setBeingSnoopedBy(Session, boolean)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#isBeingSnoopedBy(Session)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#snoopSuspension(int)
	 * @param change the amount to change the snoop suspension counter by
	 * @return the current value of the snoop suspension counter after the change
	 */
	public int snoopSuspension(int change);

	/**
	 * Force the current player to logoff, end the session, and/or kill the thread.
	 * @param removeMOB true to remove the mob from the game
	 * @param dropSession true to force closed sockets, and removed session
	 * @param killThread true to force a thread death, and false to be more lenient
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#isStopped()
	 */
	public void stopSession(boolean removeMOB, boolean dropSession, boolean killThread);

	/**
	 * Returns whether this session is done, or slated to be done.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#logout(boolean)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#isStopped()
	 * @return true if this session needs to go, false otherwise
	 */
	public boolean isStopped();

	/**
	 * Allows the user to select a different character, taking them back to the login
	 * prompt, or to the account character listing screen, whichever is appropriate.
	 * @param removeMOB true to remove the mob from the game
	 */
	public void logout(boolean removeMOB);

	/**
	 * Returns whether this mob/session is currently Away From Keyboard
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setAfkFlag(boolean)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setAFKMessage(String)
	 * @return true if they are AFK, false otherwise
	 */
	public boolean isAfk();

	/**
	 * Sets whether this mob/session is currently Away From Keyboard
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#isAfk()
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getAfkMessage()
	 * @param truefalse true if they are AFK, false otherwise
	 */
	public void setAfkFlag(boolean truefalse);

	/**
	 * Returns the reason given by the user that they are AFK.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setAfkFlag(boolean)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setAFKMessage(String)
	 * @return  the reason given by the user that they are AFK.
	 */
	public String getAfkMessage();

	/**
	 * Returns the reason given by the user that they are AFK.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setAfkFlag(boolean)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getAfkMessage()
	 * @param str the reason given by the user that they are AFK.
	 */
	public void setAFKMessage(String str);

	/**
	 * Blocks the current thread until the user attached to this session
	 * hits ENTER, returning the characters they enter.  Completely filtered input.
	 * @param timeoutMillis milliseconds before InterruptedIOException thrown
	 * @param filter true to allow normal coffeemud input filtering
	 * @return the string entered by the user
	 * @throws IOException any exception generated during input
	 */
	public String blockingIn(long timeoutMillis, boolean filter)
		throws IOException;

	/**
	 * Blocks for a short amount of time, returning an input
	 * string only if the user happens to have hit enter.
	 * @return a string entered by the user
	 * @throws IOException exceptions thrown, typically a timeout
	 * @throws SocketException exceptions thrown, typically socket error
	 */
	public String readlineContinue()
		throws IOException, SocketException;

	/**
	 * Returns a pre-parsed, pre-filtered list of strings
	 * representing the last command entered by the user
	 * through this session.
	 * @return a list of strings
	 */
	public List<String> getPreviousCMD();

	/**
	 * Returns the player MOB attached to this session object.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setMob(MOB)
	 * @return  the player MOB attached to this session object.
	 */
	public MOB mob();

	/**
	 * Sets the player MOB attached to this session object.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#mob()
	 * @param newmob the player MOB attached to this session object.
	 */
	public void setMob(MOB newmob);

	/**
	 * Sets the player acount attached to this session object.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#mob()
	 * @param account the player account attached to this session object.
	 */
	public void setAccount(PlayerAccount account);

	/**
	 * Returns the current color code.
	 * @return the current color code.
	 */
	public ColorState getCurrentColor();

	/**
	 * Sets the current color code.
	 * @param newcolor the color to change it to
	 */
	public void setCurrentColor(final ColorState newcolor);

	/**
	 * Returns the marked color code.
	 * @return the marked color code.
	 */
	public ColorState popMarkedColor();

	/**
	 * Sets the marked color code.
	 * @param newcolor the color to change it to
	 */
	public void pushMarkedColor(final ColorState newcolor);

	/**
	 * Returns the previous current color code.
	 * @return the previous current color code.
	 */
	public ColorState getLastColor();

	/**
	 * Returns the previous current color code.
	 * @param newColor the color to change it to
	 */
	public void setLastColor(final ColorState newColor);

	/**
	 * Gets the column number for engine word-wrapping.
	 * 0 Means disabled.
	 *
	 * @return the wrap column
	 */
	public int getWrap();

	/**
	 * Gets the current telnet clients ip address.
	 *
	 * @return the ip address
	 */
	public String getAddress();

	/**
	 * Gets the tick/thread status of this session object.
	 *
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session.SessionStatus
	 * @return the tick status
	 */
	public SessionStatus getStatus();

	/**
	 * Sets the tick/thread status of this session object.
	 *
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session.SessionStatus
	 * @param newStatus the tick status
	 */
	public void setStatus(SessionStatus newStatus);

	/**
	 * Returns whether this session is waiting for input
	 *
	 * @return true if it is, false otherwise
	 */
	public boolean isWaitingForInput();

	/**
	 * Gets the total milliseconds consumed by this session objects thread.
	 *
	 * @return the total milliseconds consumed
	 */
	public long getTotalMillis();

	/**
	 * Gets the total number of ticks consumed by this session object thread.
	 *
	 * @return the total ticks consumed
	 */
	public long getTotalTicks();

	/**
	 * Gets the number of milliseconds since a user entry was registered by this session
	 *
	 * @see Session#setIdleTimers()
	 * @return the idle milliseconds passed
	 */
	public long getIdleMillis();

	/**
	 * Resets the internal idle timers.
	 * @see Session#getIdleMillis()
	 */
	public void setIdleTimers();

	/**
	 * Gets the milliseconds elapsed since this user came online.
	 *
	 * @return the milliseconds online
	 */
	public long getMillisOnline();

	/**
	 * Gets the milliseconds timestamp since this user last registered a pk fight.
	 *
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setLastPKFight()
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setLastNPCFight()
	 * @return the last pk fight timestamp
	 */
	public long getLastPKFight();

	/**
	 * Sets now as the milliseconds timestamp since this user last registered a pk fight.
	 *
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getLastPKFight()
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getLastNPCFight()
	 */
	public void setLastPKFight();

	/**
	 * Gets the milliseconds timestamp since this user last registered a npc fight.
	 *
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setLastPKFight()
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setLastNPCFight()
	 * @return the last npc fight timestamp
	 */
	public long getLastNPCFight();

	/**
	 * Sets now as the milliseconds timestamp since this user last registered a npc fight.
	 *
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getLastPKFight()
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getLastNPCFight()
	 */
	public void setLastNPCFight();

	/**
	 * Returns the last time in milliseconds that this session began its input loop.
	 * Is typically only held up by executing a user command, so it is an accurate
	 * gauge of a locked up user command.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setInputLoopTime()
	 *
	 * @return the last time in milliseconds that this session began its input loop
	 */
	public long getInputLoopTime();

	/**
	 * Sets the last time in milliseconds that this session began its input loop.
	 * Is typically only held up by executing a user command, so it is an accurate
	 * gauge of a locked up user command.
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getInputLoopTime()
	 */
	public void setInputLoopTime();

	/**
	 * Whether this session is currently actively interacting with the user in
	 * some way -- whether this session currently has "thread time".
	 * @return true if its active and running, false otherwise
	 */
	public boolean isRunning();

	/**
	 * Returns a list of the last several message strings received by this user.
	 * All are already previously filtered and parsed and ready to display.
	 *
	 * @return a list of string message strings
	 */
	public List<String> getLastMsgs();

	/**
	 * Gets the terminal type the user has
	 * @return the terminal type
	 */
	public String getTerminalType();

	/**
	 * Sets a server telnet mode flag.
	 *
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#TELNET_ANSI
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getServerTelnetMode(int)
	 * @param telnetCode the telnet code
	 * @param onOff true to turn on, false to turn off the flag
	 */
	public void setServerTelnetMode(int telnetCode, boolean onOff);

	/**
	 * Gets a server telnet mode flag.
	 *
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#TELNET_ANSI
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setServerTelnetMode(int, boolean)
	 * @param telnetCode the telnet code
	 *
	 * @return true, if server telnet mode is on, false otherwise
	 */
	public boolean getServerTelnetMode(int telnetCode);

	/**
	 * Sets a client telnet mode flag.
	 *
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#TELNET_ANSI
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getClientTelnetMode(int)
	 *
	 * @param telnetCode the telnet code
	 * @param onOff true to turn on, false to turn off the flag
	 */
	public void setClientTelnetMode(int telnetCode, boolean onOff);

	/**
	 * Gets a client telnet mode flag.
	 *
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#TELNET_ANSI
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setClientTelnetMode(int, boolean)
	 *
	 * @param telnetCode the telnet code
	 *
	 * @return true, if client telnet mode is on, false otherwise
	 */
	public boolean getClientTelnetMode(int telnetCode);

	/**
	 * Change telnet mode by sending the appropriate command to the clients client.
	 * A response received later will trigger mode changed.
	 *
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#TELNET_ANSI
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#TELNET_ANSI16
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setClientTelnetMode(int, boolean)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setServerTelnetMode(int, boolean)
	 * @param telnetCode the telnet code
	 * @param onOff true to turn on, false to turn off the flag
	 */
	public void changeTelnetMode(int telnetCode, boolean onOff);

	/**
	 * Change telnet mode by negotiating the command to the clients client.
	 *
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#TELNET_ANSI
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#TELNET_ANSI16
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setClientTelnetMode(int, boolean)
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setServerTelnetMode(int, boolean)
	 * @param telnetCode the telnet code
	 */
	public void negotiateTelnetMode(int telnetCode);

	/**
	 * Initializes a telnet mode between this session and the connected client by negotiating
	 * certain fundamental flags, like ANSI, MXP, and MSP.  It will use a bitmap of MOB flags
	 * passed in as a guide.
	 *
	 * @see com.planet_ink.coffee_mud.MOBS.interfaces.MOB#getAttributesBitmap()
	 * @see com.planet_ink.coffee_mud.MOBS.interfaces.MOB.Attrib
	 * @see com.planet_ink.coffee_mud.Common.interfaces.Session#changeTelnetMode(int, boolean)
	 * @param mobbitmap the mobbitmap the bitmap of mob flags to use as a guide in negotiation
	 */
	public void initTelnetMode(int mobbitmap);

	/**
	 * Returns true if the given max tag will be accepted by the client.
	 * @param tag the tag to check
	 * @return true if allowed, false otherwise
	 */
	public boolean isAllowedMxp(String tag);

	/**
	 * Returns true if this client supports the given package at the
	 * given version.
	 * @param packageName the package to check
	 * @param version the version of the package to check
	 * @return true if there's support, false otherwise
	 */
	public boolean isAllowedMcp(String packageName, float version);

	/**
	 * Sends a properly formatted MCP command to the session, if it or its package is supported.
	 * @param packageCommand the fully formed command
	 * @param parms the variable parameters, already well formed
	 * @return true if it was sent, false otherwise
	 */
	public boolean sendMcpCommand(String packageCommand, String parms);

	/**
	 * Potentially sends the GMCP event of the given name with the given json
	 * doc.
	 * @param eventName the event name, like comm.channel
	 * @param json the json doc, like {"blah":"BLAH"}
	 * @return true if GMCP was enabled for this session, false otherwise
	 */
	public boolean sendGMCPEvent(final String eventName, final String json);

	/**
	 * Returns the entire command history cached by this session.
	 * @return the entire command history cached by this session.
	 */
	public Enumeration<List<String>> getHistory();

	/**
	 * Send this session fake input as if the user had typed it in.
	 * @param input text to send.
	 */
	public void setFakeInput(String input);

	/** TELNET CODE: transmit binary */
	public static final int TELNET_BINARY=0;
	/** TELNET CODE: echo */
	public static final int TELNET_ECHO=1;
	/** TELNET CODE: echo */
	public static final int TELNET_LOGOUT=18;
	/** TELNET CODE: supress go ahead*/
	public static final int TELNET_SUPRESS_GO_AHEAD=3;
	/** TELNET CODE: sending terminal type*/
	public static final int TELNET_TERMTYPE=24;
	/** TELNET CODE: Negotiate About Window Size.*/
	public static final int TELNET_NAWS=31;
	/** TELNET CODE: Remote Flow Control.*/
	public static final int TELNET_TOGGLE_FLOW_CONTROL=33;
	/** TELNET CODE: Linemode*/
	public static final int TELNET_LINEMODE=34;
	/** TELNET CODE: MSDP protocol*/
	public static final int TELNET_MSDP=69;
	/** TELNET CODE: MSSP Server Status protocol*/
	public static final int TELNET_MSSP=70;
	/** TELNET CODE: text compression, protocol 1*/
	public static final int TELNET_COMPRESS=85;
	/** TELNET CODE: text compression, protocol 2*/
	public static final int TELNET_COMPRESS2=86;
	/** TELNET CODE: MSP SOund protocol*/
	public static final int TELNET_MSP=90;
	/** TELNET CODE: MXP Extended protocol*/
	public static final int TELNET_MXP=91;
	/** TELNET CODE: AARD protocol*/
	public static final int TELNET_AARD=102;
	/** TELNET CODE: End of subnegotiation parameters*/
	public static final int TELNET_SE=240;
	/** TELNET CODE: Are You There*/
	public static final int TELNET_AYT=246;
	/** TELNET CODE: Erase character*/
	public static final int TELNET_EC=247;
	/** TELNET CODE: ATCP protocol*/
	public static final int TELNET_ATCP=200;
	/** TELNET CODE: GMCP protocol*/
	public static final int TELNET_GMCP=201;
	/** TELNET CODE: Indicates that what follows is subnegotiation of the indicated option*/
	public static final int TELNET_SB=250;
	/** TELNET CODE: Indicates the desire to begin performing, or confirmation that you are now performing, the indicated option*/
	public static final int TELNET_WILL=251;
	/** TELNET CODE: Indicates the refusal to perform, or continue performing, the indicated option*/
	public static final int TELNET_WONT=252;
	/** TELNET CODE: 252 doubles as fake ansi 16 telnet code*/
	public static final int TELNET_ANSI16=252;
	/** TELNET CODE: Indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option*/
	public static final int TELNET_DO=253;
	/** TELNET CODE: 253 doubles as fake ansi telnet code*/
	public static final int TELNET_ANSI=253;
	/** TELNET CODE: Indicates the demand that the other party stop performing, or confirmation that you are no longer expecting the other party to perform, the indicated option.*/
	public static final int TELNET_DONT=254;
	/** TELNET CODE: Indicates that the other party can go ahead and transmit -- I'm done.*/
	public static final int TELNET_GA=249;
	/** TELNET CODE: Indicates that there is nothing to do?*/
	public static final int TELNET_NOP=241;
	/** TELNET CODE: IAC*/
	public static final int TELNET_IAC=255;
	/** Array String-friendly descriptions of the various telnet codes.  Indexed by code id 0-255*/
	public static final String[] TELNET_DESCS=
	{
		"BINARY","ECHO","2","SUPRESS GO AHEAD","4","5","6","7","8","9", //0-9
		"10","11","12","13","14","15","16","17","LOGOUT","19", //10-19
		"20","21","22","23","TERMTYPE","25","26","27","28","29", //20-29
		"30","NAWS","32","FLOWCONTROL","LINEMODE","35","36","37","38","39", //30-39
		"40","41","42","43","44","45","46","47","48","49", //40-49
		"50","51","52","53","54","55","56","57","58","59", //50-59
		"60","61","62","63","64","65","66","67","68","MSDP", //60-69
		"MSSP","71","72","73","74","75","76","77","78","79", //70-79
		"","","","","","COMPRESS","COMPRESS2","","","", //80-89
		"MSP","MXP","","","","","","","","", //90-99
		"","","AARD","","","","","","","", //100-109
		"","","","","","","","","","", //110-119
		"","","","","","","","","","", //120-129
		"","","","","","","","","","", //130-139
		"","","","","","","","","","", //140-149
		"","","","","","","","","","", //150-159
		"","","","","","","","","","", //160-169
		"","","","","","","","","","", //170-179
		"","","","","","","","","","", //180-189
		"","","","","","","","","","", //190-199
		"ATCP","GMCP","","","","","","","","", //200-209
		"","","","","","","","","","", //210-219
		"","","","","","","","","","", //220-229
		"","","","","","","","","","", //230-239
		"SE","NOP","","","","","AYT","EC","","GA", //240-249
		"SB","","","ANSI","","" 			 //250-255
	};

	/* The charset recognized by MSDP is unknown, so assume std ascii */
	public final static String MSDP_CHARSET = "US-ASCII";

	/** How to start a GMCP subnegotiation */
	public final static byte[] TELNETBYTES_GMCP_HEAD= new byte[]{(byte)Session.TELNET_IAC,(byte)Session.TELNET_SB,(byte)Session.TELNET_GMCP};
	/** How to end a telnet subnegotiation */
	public final static byte[] TELNETBYTES_END_SB	= new byte[]{(byte)Session.TELNET_IAC,(byte)Session.TELNET_SE};
	/** Go ahead bytes */
	public final static byte[] TELNETGABYTES		= {(byte)TELNET_IAC,(byte)TELNET_GA};

	/**
	 * The internal class to managing asynchronous user input.
	 * This class supports three types of input: open text (PROMPT),
	 * one-letter options (CHOOSE), and Y/N (CONFIRM).
	 * @author Bo Zimmerman
	 *
	 */
	public static abstract class InputCallback
	{
		/**
		 * The threa different types of user input processing
		 * supported by the abstract InputCallback class
		 * @author Bo Zimmerman
		 *
		 */
		public static enum Type { CONFIRM, PROMPT, CHOOSE, WAIT }

		private final Type			type;
		private final String		defaultInput;
		private final String		choicesStr;
		protected final long		timeoutMs;
		protected volatile long		timeout;
		protected volatile String	input		= "";
		protected volatile boolean	confirmed	= false;
		protected volatile boolean	waiting		= true;
		protected volatile boolean	noTrim		= false;

		/**
		 * Full constructor.  Receives the Type of processing, a default input for
		 * when the user just hits ENTER, a list of one-character choices (if CHOOSE Type
		 * is used) and an amount of time, in ms, for the user to be given before timeout
		 * and the timedOut() method is called.
		 * @param type the type of processing
		 * @param defaultInput default input value
		 * @param choicesStr list of one-character options (if CHOOSE Type)
		 * @param timeoutMs time, in ms, before the user is kicked
		 */
		public InputCallback(final Type type, final String defaultInput, final String choicesStr, final long timeoutMs)
		{
			this.type=type;
			if((choicesStr!=null)&&(choicesStr.trim().length()>0))
				this.choicesStr=choicesStr.toUpperCase().trim();
			else
			switch(type)
			{
				case CONFIRM:
					this.choicesStr = "YN";
					break;
				case CHOOSE:
					this.choicesStr = "YN";
					break;
				default:
					this.choicesStr = "";
			}
			this.timeoutMs=timeoutMs;
			if(this.timeoutMs<=0)
				this.timeout=0;
			else
				this.timeout=System.currentTimeMillis()+timeoutMs;
			this.waiting=true;
			this.defaultInput=defaultInput;
		}

		/**
		 * Constructor.  Receives the Type of processing, a default input for
		 * when the user just hits ENTER,  and an amount of time, in ms, for
		 * the user to be given before timeout and the timedOut() method is called.
		 * @param type the type of processing
		 * @param defaultInput default input value
		 * @param timeoutMs time, in ms, before the user is kicked
		 */
		public InputCallback(final Type type, final String defaultInput, final long timeoutMs)
		{
			this(type, defaultInput, "", timeoutMs);
		}

		/**
		 * Constructor.  Receives the Type of processing, and an amount of time, in ms,
		 * for the user to be given before timeout and the timedOut() method is called.
		 * @param type the type of processing
		 * @param timeoutMs time, in ms, before the user is kicked
		 */
		public InputCallback(final Type type, final long timeoutMs)
		{
			this(type, "", timeoutMs);
		}

		/**
		 * Constructor.  Receives the Type of processing.
		 * @param type the type of processing
		 */
		public InputCallback(final Type type)
		{
			this(type, 0);
		}

		/**
		 * Constructor.  Receives the Type of processing, a default input for
		 * when the user just hits ENTER.
		 * @param type the type of processing
		 * @param defaultInput default input value
		 */
		public InputCallback(final Type type, final String defaultInput)
		{
			this(type, "", 0);
		}

		/**
		 * Returns true if a timeout was given, and this class has been
		 * active longer than that amount of time.
		 * @return true if timed out, false otherwise.
		 */
		public boolean isTimedOut()
		{
			final boolean isTimedOut=(timeout > 0) && (System.currentTimeMillis() > timeout);
			if(isTimedOut)
				waiting=false;
			return isTimedOut;
		}

		/**
		 * Forces user-input into this class, potentially changing its user
		 * input waiting state.  If the input is invalid for CONFIRM or CHOOSE,
		 * then this will call ShowPrompt and go back to waiting. Otherwise,
		 * waiting is set to false and it becomes very likely that callBack()
		 * will be called.
		 * @param input the user input to force
		 */
		public void setInput(String input)
		{
			this.input=input;
			switch(type)
			{
			case PROMPT:
			{
				if((input.length()>0)&&(input.charAt(input.length()-1)=='\\'))
					this.input=input.substring(0,input.length()-1);
				else
					this.input=input;
				if((this.input.trim().length()==0)&&(!noTrim))
					this.input=defaultInput;
				waiting=false;
				break;
			}
			case WAIT:
				waiting=true;
				return;
			case CONFIRM:
				if(input.trim().toUpperCase().startsWith("T"))
					input="Y";
				//$FALL-THROUGH$
			case CHOOSE:
					this.input=input.toUpperCase().trim();
				if(this.input.length()==0)
					this.input=defaultInput.toUpperCase();
				if(this.input.length()>0)
				{
					this.input=this.input.substring(0,1);
					if((choicesStr.length()==0)
					||(choicesStr.indexOf(this.input)>=0))
					{
						waiting=false;
						if(type==Type.CONFIRM)
							this.confirmed=this.input.equals("Y");
					}
					else
					{
						waiting=true;
						showPrompt();
						return;
					}
				}
				break;
			}
			waiting=false;
		}

		/**
		 * Returns true if this class is currently waiting
		 * for user input.
		 * @return true if waiting, false if waiting is over.
		 */
		public boolean waitForInput()
		{
			return waiting;
		}

		/**
		 * This method allows reuse of a given InputCallback.
		 * It will re-start the timeout period, and flag
		 * the callback for requiring more input.
		 * @return this
		 */
		public InputCallback reset()
		{
			input="";
			if(timeoutMs>0)
				timeout=System.currentTimeMillis()+timeoutMs;
			waiting=true;
			confirmed=false;
			return this;
		}

		/**
		 * This method is called by InputCallback before user
		 * input is requested.  If a CHOOSE or CONFIRM type is
		 * used, and the user enters something unrecognized, then
		 * this method is called again before more input.
		 */
		public abstract void showPrompt();

		/**
		 * This method is call by InputCallback if a timeout
		 * value greater than 0 is given and that amount of time has
		 * been exceeded.
		 */
		public abstract void timedOut();

		/**
		 * This method is called if the user hits ENTER, and
		 * their input data is valid (one of the choices for
		 * CHOOSE or CONFIRM), or anything else for PROMPT.
		 * If the user has entered nothing, and a default
		 * value has been given, the default value is returned.
		 * The user entry is available to this method in
		 * this.input variable.
		 */
		public abstract void callBack();
	}

	public abstract class TickingCallback extends InputCallback
	{
		protected volatile int			counter			= 0;
		protected final StringBuilder	collectedInput	= new StringBuilder("");

		/**
		 * Only constructor is the one to tell out often to call back.
		 * @param tickerMs the time is ms between timeouts
		 */
		public TickingCallback(final long tickerMs)
		{
			super(Type.PROMPT,tickerMs);
		}
		/**
		 * TimeOutCallback has no prompt
		 */
		@Override
		public void showPrompt()
		{
		}

		@Override
		public void callBack()
		{
		}

		@Override
		public void setInput(String input)
		{
			super.setInput(input);
			collectedInput.append(this.input).append("\n\r");
			input="";
			waiting=true;
		}

		@Override
		public void timedOut()
		{
			timeout=System.currentTimeMillis()+timeoutMs;
			waiting=true;
			if(!tick(counter++))
			{
				timeout=System.currentTimeMillis()-1;
				waiting=false;
			}
		}

		/**
		 * This method id called every ticker ms with an incremented
		 * counter.  This is also where you control the process.
		 * @param counter the counter, higher than the last time
		 * @return true to keep ticking, false to finally stop.
		 */
		public abstract boolean tick(int counter);
	}

	/** for REPLY command, constant for maximum number of saved strings */
	public static final int MAX_PREVMSGS=100;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_MODE=1;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_MODEMASK_EDIT=1;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_MODEMASK_TRAPSIG=2;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_MODEMASK_ACK=4;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_SLC=3;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_SLC_DEFAULT=3;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_SLC_VALUE=2;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_SLC_CANTCHANGE=1;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_SLC_NOSUPPORT=0;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_SLC_ACK=128;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_SLC_XON=15;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_SLC_XOFF=16;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_SLC_EOF=8;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_SLC_SUSP=9;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_SLC_BRK=2;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_SLC_IP=3;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_SLC_AO=4;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_SLC_AYT=5;
	/** Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does */
	public static final int TELNET_LINEMODE_SLC_EOR=6;

	/** For MSDP protocol, denotes variable start*/
	public static final char MSDP_VAR			= 1;
	/** For MSDP protocol, denotes value start*/
	public static final char MSDP_VAL			= 2;
	/** For MSDP protocol, denotes table open*/
	public static final char MSDP_TABLE_OPEN	= 3;
	/** For MSDP protocol, denotes table done*/
	public static final char MSDP_TABLE_CLOSE	= 4;
	/** For MSDP protocol, denotes array start*/
	public static final char MSDP_ARRAY_OPEN	= 5;
	/** For MSDP protocol, denotes array done*/
	public static final char MSDP_ARRAY_CLOSE	= 6;

	/**
	 * The status of the session, from opening handshake, to final goodbyes
	 * @author Bo Zimmerman
	 */
	public static enum SessionStatus
	{
		HANDSHAKE_OPEN, HANDSHAKE_MCCP, HANDSHAKE_MXP, HANDSHAKE_MXPPAUSE, HANDSHAKE_DONE,
		LOGIN, LOGIN2, ACCOUNT_MENU, CHARCREATE, IDLE, MAINLOOP,
		LOGOUT, LOGOUT1, LOGOUT2, LOGOUT3, LOGOUT4, LOGOUT5, LOGOUT6, LOGOUT7, LOGOUT8,
		LOGOUT9, LOGOUT10, LOGOUT11, LOGOUT12, LOGOUTFINAL
	}
}

<MSG> The ability to apply arbitrary filters to outgoing text

git-svn-id: 0cdf8356e41b2d8ccbb41bb76c82068fe80b2514@18274 0d6f1817-ed0e-0410-87c9-987e46238f29

<DFF> @@ -48,14 +48,15 @@ public interface Session extends CMCommon, Modifiable, CMRunnable
 		/**
 		 * Applies this filter to the text about to be sent to a session.
 		 * Returns either the modified text, or null to cancel the filter.
-		 *
+		 * @param mob the mob whose session this is
 		 * @param source the source of the text message
 		 * @param target the target of the text message
 		 * @param tool the tool being used by the message generator
 		 * @param msg the message itself
+		 *
 		 * @return the modified message, or null to remove the filter
 		 */
-		public String applyFilter(final Physical source, final Environmental target, final Environmental tool, final String msg);
+		public String applyFilter(MOB mob, final Physical source, final Environmental target, final Environmental tool, final String msg);
 	}
 
 	/**

{'commit': 'diff --git a/com/planet_ink/coffee_mud/Common/DefaultSession.java b/com/planet_ink/coffee_mud/Common/DefaultSession.java\nindex 043b1b4f9d..0dc055e4fc 100644\n--- a/com/planet_ink/coffee_mud/Common/DefaultSession.java\n+++ b/com/planet_ink/coffee_mud/Common/DefaultSession.java\n@@ -1452,7 +1452,7 @@ public class DefaultSession implements Session\n \t\t\t\tfor(final Iterator<SessionFilter> s=textFilters.iterator();s.hasNext();)\r\n \t\t\t\t{\r\n \t\t\t\t\tfinal SessionFilter filter = s.next();\r\n-\t\t\t\t\tnewMsg = filter.applyFilter(src, trg, tol, newMsg);\r\n+\t\t\t\t\tnewMsg = filter.applyFilter(mob, src, trg, tol, newMsg);\r\n \t\t\t\t\tif(newMsg == null)\r\n \t\t\t\t\t{\r\n \t\t\t\t\t\ts.remove();\r\ndiff --git a/com/planet_ink/coffee_mud/Common/interfaces/Session.java b/com/planet_ink/coffee_mud/Common/interfaces/Session.java\nindex d303c9da5e..be1b59e4d5 100644\n--- a/com/planet_ink/coffee_mud/Common/interfaces/Session.java\n+++ b/com/planet_ink/coffee_mud/Common/interfaces/Session.java\n@@ -48,14 +48,15 @@ public interface Session extends CMCommon, Modifiable, CMRunnable\n \t\t/**\r\n \t\t * Applies this filter to the text about to be sent to a session.\r\n \t\t * Returns either the modified text, or null to cancel the filter.\r\n-\t\t *\r\n+\t\t * @param mob the mob whose session this is\r\n \t\t * @param source the source of the text message\r\n \t\t * @param target the target of the text message\r\n \t\t * @param tool the tool being used by the message generator\r\n \t\t * @param msg the message itself\r\n+\t\t *\r\n \t\t * @return the modified message, or null to remove the filter\r\n \t\t */\r\n-\t\tpublic String applyFilter(final Physical source, final Environmental target, final Environmental tool, final String msg);\r\n+\t\tpublic String applyFilter(MOB mob, final Physical source, final Environmental target, final Environmental tool, final String msg);\r\n \t}\r\n \r\n \t/**\r\n', 'commit_subject': 'The ability to apply arbitrary filters to outgoing text', 'repo_name': 'bozimmerman/CoffeeMud', 'committer': {'name': 'bozimmerman', 'email': 'dc45fe023482b3b890b5e574e53c1d051f45b1ef@zimmers.net', 'time_sec': '1562796501', 'tz_offset': '0', 'date': {'seconds': '1562796501'}}, 'commit_tree': 'f27b000d0af3c6912639caed11124635467a0788', 'commit_message': 'The ability to apply arbitrary filters to outgoing text\n\ngit-svn-id: 0cdf8356e41b2d8ccbb41bb76c82068fe80b2514@18274 0d6f1817-ed0e-0410-87c9-987e46238f29\n', 'language_name': 'JavaScript', 'license': 'apache-2.0', 'hunks': '@@ -48,14 +48,15 @@ public interface Session extends CMCommon, Modifiable, CMRunnable\n \t\t/**\r\n \t\t * Applies this filter to the text about to be sent to a session.\r\n \t\t * Returns either the modified text, or null to cancel the filter.\r\n-\t\t *\r\n+\t\t * @param mob the mob whose session this is\r\n \t\t * @param source the source of the text message\r\n \t\t * @param target the target of the text message\r\n \t\t * @param tool the tool being used by the message generator\r\n \t\t * @param msg the message itself\r\n+\t\t *\r\n \t\t * @return the modified message, or null to remove the filter\r\n \t\t */\r\n-\t\tpublic String applyFilter(final Physical source, final Environmental target, final Environmental tool, final String msg);\r\n+\t\tpublic String applyFilter(MOB mob, final Physical source, final Environmental target, final Environmental tool, final String msg);\r\n \t}\r\n \r\n \t/**\r\n', 'addition_count': 3, 'deletion_count': 2, 'src_file': 'a/com/planet_ink/coffee_mud/Common/interfaces/Session.java', 'tgt_file': 'b/com/planet_ink/coffee_mud/Common/interfaces/Session.java', 'file_extension': '.java', 'before_file': 'package com.planet_ink.coffee_mud.Common.interfaces;\nimport com.planet_ink.coffee_mud.core.interfaces.*;\nimport com.planet_ink.coffee_mud.core.threads.CMRunnable;\nimport com.planet_ink.coffee_mud.core.*;\nimport com.planet_ink.coffee_mud.core.collections.*;\nimport com.planet_ink.coffee_mud.Abilities.interfaces.*;\nimport com.planet_ink.coffee_mud.Areas.interfaces.*;\nimport com.planet_ink.coffee_mud.Behaviors.interfaces.*;\nimport com.planet_ink.coffee_mud.CharClasses.interfaces.*;\nimport com.planet_ink.coffee_mud.Commands.interfaces.*;\nimport com.planet_ink.coffee_mud.Common.interfaces.*;\nimport com.planet_ink.coffee_mud.Exits.interfaces.*;\nimport com.planet_ink.coffee_mud.Items.interfaces.*;\nimport com.planet_ink.coffee_mud.Libraries.interfaces.ColorLibrary.ColorState;\nimport com.planet_ink.coffee_mud.Locales.interfaces.*;\nimport com.planet_ink.coffee_mud.MOBS.interfaces.*;\nimport com.planet_ink.coffee_mud.Races.interfaces.*;\n\nimport java.util.*;\nimport java.io.IOException;\nimport java.net.Socket;\nimport java.net.SocketException;\n/*\n   Copyright 2001-2022 Bo Zimmerman\n\n   Licensed under the Apache License, Version 2.0 (the "License");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n\t   http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an "AS IS" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n*/\n/**\n * A Session object is the key interface between the internet user\n * and their player MOB.  In fact, the presence of an attached session\n * object to a MOB is the only difference between an NPC MOB and a player MOB.\n * This object handles input, output, and related processes.\n */\npublic interface Session extends CMCommon, Modifiable, CMRunnable\n{\n\tpublic interface SessionFilter\n\t{\n\t\t/**\r\n\t\t * Applies this filter to the text about to be sent to a session.\r\n\t\t * Returns either the modified text, or null to cancel the filter.\r\n\t\t *\r\n\t\t * @param source the source of the text message\r\n\t\t * @param target the target of the text message\r\n\t\t * @param tool the tool being used by the message generator\r\n\t\t * @param msg the message itself\r\n\t\t * @return the modified message, or null to remove the filter\r\n\t\t */\r\n\t\tpublic String applyFilter(final Physical source, final Environmental target, final Environmental tool, final String msg);\r\n\t}\r\n\r\n\t/**\r\n\t * Negotiates various telnet options (or attempts to), and\n\t * prints the introTextStr to the user.\n\t * @param s the socket the user connected from\n\t * @param groupName the name of the thread group the session goes to\n\t * @param introTextStr introductory text string (Hello!)\n\t */\n\tpublic void initializeSession(Socket s, String groupName, String introTextStr);\n\n\t/**\n\t * Returns the group name to which this session belongs\n\t * @return the thread group name\n\t */\n\tpublic String getGroupName();\n\n\t/**\n\t * Sets the group name to which this session belongs\n\t * @param group the thread group name\n\t */\n\tpublic void setGroupName(String group);\n\n\t/**\n\t * Returns a list of standard/foreground telnet coded strings\n\t * indexed by coffeemud color code.  May be from the standard list,\n\t * or read from player records for a customized list.\n\t * @return telnet coded color strings.\n\t */\n\tpublic String[] getColorCodes();\n\n\t/**\n\t * Low level text output method.\n\t * Implements such features as snoops, spam-stacking, page\n\t * breaks, and line caching\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#rawCharsOut(char[])\n\t * @param msg the string to send to the user\n\t * @param noCache true to disable line caching, false otherwise\n\t */\n\tpublic void onlyPrint(String msg, boolean noCache);\n\n\t/**\n\t * Low level text output method.\n\t * Implements such features as snoops, spam-stacking.\n\t * No page breaking, and Always line caching\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)\n\t * @param msg the string to send to the user\n\t */\n\tpublic void onlyPrint(String msg);\n\n\t/**\n\t * Lowest level user-output method.  Does nothing\n\t * but send the string to the user, period.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#rawCharsOut(char[])\n\t * @param msg the string to send to the user\n\t */\n\n\tpublic void rawOut(String msg);\n\n\t/**\n\t * Low level line-output method.  Sets the\n\t * prompt flag after write, and inserts\n\t * additional pre-linefeed if currently at\n\t * the prompt.  Adds post linefeed of course.\n\t * Does not do a page break.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#rawPrintln(String)\n\t * @param msg the string to send to the user\n\t */\n\tpublic void rawPrintln(String msg);\n\n\t/**\n\t * Low level line-output method.  Sets the\n\t * prompt flag after write, and inserts\n\t * additional pre-linefeed if currently at\n\t * the prompt.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#rawPrint(String)\n\t * @param msg the string to send to the user\n\t */\n\tpublic void rawPrint(String msg);\n\n\t/**\n\t * Low level line-output method.  Sets the\n\t * prompt flag after write, and inserts\n\t * additional pre-linefeed if currently at\n\t * the prompt.  Adds post linefeed of course.\n\t * Does not do a page break, or color, but does\n\t * protect mxp clients.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#safeRawPrint(String)\n\t * @param msg the string to send to the user\n\t */\n\tpublic void safeRawPrintln(String msg);\n\n\t/**\n\t * Low level line-output method.  Sets the\n\t * prompt flag after write, and inserts\n\t * additional pre-linefeed if currently at\n\t * the prompt.  Does not do color, but does\n\t * protect mxp clients.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#safeRawPrintln(String)\n\t * @param msg the string to send to the user\n\t */\n\tpublic void safeRawPrint(String msg);\n\n\t/**\n\t * Higher-level line output method.  Does full\n\t * filtering of special characters and codes.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#rawPrint(String)\n\t * @param msg the string to send to the user\n\t */\n\tpublic void stdPrint(String msg);\n\n\t/**\n\t * Higher-level line output method.  Does full\n\t * filtering of special characters and codes\n\t * using given variable values.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#rawPrint(String)\n\t * @param Source variable for special code parsing: Source\n\t * @param Target variable for special code parsing: Target\n\t * @param Tool variable for special code parsing: Tool\n\t * @param msg the string to send to the user\n\t */\n\tpublic void stdPrint(Physical Source,\n\t\t\t\t\t\t Environmental Target,\n\t\t\t\t\t\t Environmental Tool,\n\t\t\t\t\t\t String msg);\n\n\t/**\n\t * Higher-level line output method.  Does full\n\t * filtering of special characters and codes.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#rawPrintln(String)\n\t * @param msg the string to send to the user\n\t */\n\tpublic void stdPrintln(String msg);\n\n\t/**\n\t * Higher-level line output method.  Does full\n\t * filtering of special characters and codes\n\t * using given variable values.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#rawPrintln(String)\n\t * @param Source variable for special code parsing: Source\n\t * @param Target variable for special code parsing: Target\n\t * @param Tool variable for special code parsing: Tool\n\t * @param msg the string to send to the user\n\t */\n\tpublic void stdPrintln(Physical Source,\n\t\t\t\t\t\t   Environmental Target,\n\t\t\t\t\t\t   Environmental Tool,\n\t\t\t\t\t\t   String msg);\n\n\t/**\n\t * Lowest level user-output method.  Does nothing\n\t * but send the string to the user, period.\n\t * @param c string (as char array) to send out to the user\n\t */\n\tpublic void rawCharsOut(char[] c);\n\n\t/**\n\t * Checks whether this session is currently over its\n\t * time limit trying to write data to its socket.\n\t * For some reason this happens, and this method\n\t * detects it.\n\t * @return true if something bas happened, false otherwise\n\t */\n\tpublic boolean isLockedUpWriting();\n\n\t/**\n\t * Returns true if this session is merely a placeholder,\n\t * and does not represent an actual user connection.\n\t * Will ensure that the system continues to treat the\n\t * user as a mob.\n\t * @return true if this session is not a connection\n\t */\n\tpublic boolean isFake();\n\n\t/**\n\t * Adds a new text filter to this session, which can\n\t * modify any text immediately before it is sent\n\t * to the user.\n\t * @param filter the filter to add\n\t * @return true if the filter was added, false if it was already there\n\t */\n\tpublic boolean addSessionFilter(final SessionFilter filter);\n\n\t/**\n\t * Returns whether this session is engaged in a login/account\n\t * menu transaction.  If a loginsession is passed it, it will\n\t * return true only if the two sessions are engaging the\n\t * same login name.\n\t * @param otherLoginName another login name potentially match\n\t * @return true if it is pending, false otherwise\n\t */\n\tpublic boolean isPendingLogin(final String otherLoginName);\n\n\t/**\n\t * If the session is in a non-logged in state (or even if it\n\t * is), this will automatically login the user with the given\n\t * name and password, and switch the session to the main loop.\n\t * Sending null for name/password will reset the login session.\n\t * @param name the username\n\t * @param password the password\n\t * @return true if the login succeeded\n\t */\n\tpublic boolean autoLogin(String name, String password);\n\n\t/**\n\t * Medium-level text output method.  Does full\n\t * filtering of special characters and codes.\n\t * Does not manage the prompt, and should NOT be used for prompts.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#promptPrint(String)\n\t * @param msg the string to send to the user\n\t */\n\tpublic void print(String msg);\n\n\t/**\n\t * Medium-level text output method.  Does full\n\t * filtering of special characters and codes.\n\t * Does not manage the prompt. Should be used for prompts!\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)\n\t * @param msg the string to send to the user\n\t */\n\tpublic void promptPrint(String msg);\n\n\t/**\n\t * Medium-level text output method.  Does full\n\t * filtering of special characters and codes\n\t * using given variable values.\n\t * Does not manage the prompt.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)\n\t * @param Source variable for special code parsing: Source\n\t * @param Target variable for special code parsing: Target\n\t * @param Tool variable for special code parsing: Tool\n\t * @param msg the string to send to the user\n\t */\n\tpublic void print(Physical Source,\n\t\t\t\t\t  Environmental Target,\n\t\t\t\t\t  Environmental Tool,\n\t\t\t\t\t  String msg);\n\n\t/**\n\t * Medium-level text output method.  Does full\n\t * filtering of special characters and codes.\n\t * Does not manage the prompt.\n\t * Adds a linefeed at the end though.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)\n\t * @param msg the string to send to the user\n\t */\n\tpublic void println(String msg);\n\n\t/**\n\t * Medium-level text output method.  Does full\n\t * filtering of special characters and codes\n\t * using given variable values.\n\t * Does not manage the prompt.\n\t * Adds a linefeed at the end though.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)\n\t * @param Source variable for special code parsing: Source\n\t * @param Target variable for special code parsing: Target\n\t * @param Tool variable for special code parsing: Tool\n\t * @param msg the string to send to the user\n\t */\n\tpublic void println(Physical Source,\n\t\t\t\t\t\tEnvironmental Target,\n\t\t\t\t\t\tEnvironmental Tool,\n\t\t\t\t\t\tString msg);\n\n\t/**\n\t * Notifies this session to output the users prompt\n\t * again once it has reached a suitable lapse in\n\t * text output.\n\t * @param truefalse true to send another prompt, false otherwise\n\t */\n\tpublic void setPromptFlag(boolean truefalse);\n\n\t/**\n\t * Medium-level text output method.  Does full\n\t * filtering of special characters and codes.\n\t * DOES manage the prompt, but turns OFF word wrap!\n\t * Adds a linefeed at the end.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)\n\t * @param msg the string to send to the user\n\t */\n\tpublic void wraplessPrintln(String msg);\n\n\t/**\n\t * Medium-level text output method.  Does full\n\t * filtering of special characters and codes.\n\t * DOES manage the prompt, but turns OFF word wrap!\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)\n\t * @param msg the string to send to the user\n\t */\n\tpublic void wraplessPrint(String msg);\n\n\t/**\n\t * Lower-Medium-level text output method.  Does only the\n\t * parsing of color codes, no word wrapping, no codes.\n\t * Adds a linefeed at the end.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)\n\t * @param msg the string to send to the user\n\t * @param noCache true to disable line caching, false otherwise\n\t */\n\tpublic void colorOnlyPrintln(String msg, boolean noCache);\n\n\t/**\n\t * Lower-Medium-level text output method.  Does only the\n\t * parsing of color codes, no word wrapping, no codes.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)\n\t * @param msg the string to send to the user\n\t * @param noCache true to disable line caching, false otherwise\n\t */\n\tpublic void colorOnlyPrint(String msg, boolean noCache);\n\n\t/**\n\t * Lower-Medium-level text output method.  Does only the\n\t * parsing of color codes, no word wrapping, no codes.\n\t * Adds a linefeed at the end.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)\n\t * @param msg the string to send to the user\n\t */\n\tpublic void colorOnlyPrintln(String msg);\n\n\t/**\n\t * Lower-Medium-level text output method.  Does only the\n\t * parsing of color codes, no word wrapping, no codes.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#onlyPrint(String, boolean)\n\t * @param msg the string to send to the user\n\t */\n\tpublic void colorOnlyPrint(String msg);\n\n\t/**\n\t * Waits the given milliseconds for a key to be pressed, after which\n\t * it returns that key, or \\0 if nothing pressed.\n\t * @param maxWait the maximum milliseconds to wait\n\t * @return the key pressed, or \\0\n\t */\n\tpublic char hotkey(long maxWait);\n\n\t/**\n\t * Prompts the user to enter a string, and then returns what\n\t * the enter.  Does not time out, but may throw an exception\n\t * on disconnnect.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, long)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, String, long)\n\t * @param Message the prompt message to display to the user\n\t * @param Default the default response if the user just hits enter\n\t * @return the string entered by the user, or the Default\n\t * @throws IOException a disconnect\n\t */\n\tpublic String prompt(String Message, String Default)\n\t\tthrows IOException;\n\n\t/**\n\t * Puts the session into an input state, returning immediately.  The\n\t * given callback will be made when the ENTER key has been hit, and\n\t * the session will go back into a prompt state.\n\t * This is basically for non-blocking input.\n\t * @see InputCallback\n\t * @param callBack the callback to modify and make when done\n\t */\n\tpublic void prompt(InputCallback callBack);\n\n\t/**\n\t * Prompts the user to enter a string, and then returns what\n\t * the enter.  Possibly times out, and may throw an exception\n\t * on disconnnect or time out.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, String)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, long)\n\t * @param Message the prompt message to display to the user\n\t * @param Default the default response if the user just hits enter\n\t * @param maxTime max number of milliseconds to wait before timing out\n\t * @return the string entered by the user, or the Default\n\t * @throws IOException a disconnect or time out\n\t */\n\tpublic String prompt(String Message, String Default, long maxTime)\n\t\tthrows IOException;\n\n\t/**\n\t * Prompts the user to enter a string, and then returns what\n\t * the enter.  Does not time out, but may throw an exception\n\t * on disconnnect.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, String)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, long)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, String, long)\n\t * @param Message the prompt message to display to the user\n\t * @return the string entered by the user\n\t * @throws IOException a disconnect\n\t */\n\tpublic String prompt(String Message)\n\t\tthrows IOException;\n\n\t/**\n\t * Prompts the user to enter a string, and then returns what\n\t * the enter.  Possibly times out, and may throw an exception\n\t * on disconnnect or time out.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, String)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#prompt(String, String, long)\n\t * @param Message the prompt message to display to the user\n\t * @param maxTime max number of milliseconds to wait before timing out\n\t * @return the string entered by the user\n\t * @throws IOException a disconnect or time out\n\t */\n\tpublic String prompt(final String Message, long maxTime)\n\t\tthrows IOException;\n\n\t/**\n\t * Prompts the user to enter Y or N, and returns what they\n\t * enter.  Will not time out, but may throw an exception on\n\t * disconnect.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#confirm(String, String, long)\n\t * @param Message the prompt message to display to the user\n\t * @param Default the default response if the user just hits enter\n\t * @return true if they entered Y, false otherwise\n\t * @throws IOException a disconnect\n\t */\n\tpublic boolean confirm(final String Message, final String Default)\n\t\tthrows IOException;\n\n\t/**\n\t * Prompts the user to enter Y or N, and returns what they\n\t * enter. Possibly times out, and may throw an exception\n\t * on disconnnect or time out.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#confirm(String, String)\n\t * @param Message the prompt message to display to the user\n\t * @param Default the default response if the user just hits enter\n\t * @param maxTime max number of milliseconds to wait before timing out\n\t * @return true if they entered Y, false otherwise\n\t * @throws IOException a disconnect or time out\n\t */\n\tpublic boolean confirm(final String Message, final String Default, long maxTime)\n\t\tthrows IOException;\n\n\t/**\n\t * Prompts the user to enter one character responses from a set of\n\t * valid choices.  Repeats the prompt if the user does not enter\n\t * a valid choice.  ENTER is a valid choice for Default. Does not time out,\n\t * but may throw an exception on disconnnect.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#choose(String, String, String, long)\n\t * @param Message the prompt message to display to the user\n\t * @param Choices a list of uppercase characters that may be entered\n\t * @param Default the default response if the user just hits enter\n\t * @return the character entered from the choices\n\t * @throws IOException a disconnect\n\t */\n\tpublic String choose(final String Message, final String Choices, final String Default)\n\t\tthrows IOException;\n\n\t/**\n\t * Prompts the user to enter one character responses from a set of\n\t * valid choices.  Repeats the prompt if the user does not enter\n\t * a valid choice.  ENTER is a valid choice for Default. Does not time out,\n\t * but may throw an exception on disconnnect.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#choose(String, String, String, long)\n\t * @param Message the prompt message to display to the user\n\t * @param Choices a list of uppercase characters that may be entered\n\t * @param Default the default response if the user just hits enter\n\t * @param maxTime max number of milliseconds to wait before timing out\n\t * @param paramsOut an empty list to put any extra crap added to the end of the choice.\n\t * @return the character entered from the choices\n\t * @throws IOException a disconnect\n\t */\n\tpublic String choose(final String Message, final String Choices, final String Default, long maxTime, List<String> paramsOut)\n\t\tthrows IOException;\n\n\t/**\n\t * Prompts the user to enter one character responses from a set of\n\t * valid choices.  Repeats the prompt if the user does not enter\n\t * a valid choice.  ENTER is a valid choice for Default.   May time out,\n\t * and may throw an exception on disconnnect.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#choose(String, String, String)\n\t * @param Message the prompt message to display to the user\n\t * @param Choices a list of uppercase characters that may be entered\n\t * @param Default the default response if the user just hits enter\n\t * @param maxTime max number of milliseconds to wait before timing out\n\t * @return the character entered from the choices\n\t * @throws IOException a disconnect or time out\n\t */\n\tpublic String choose(final String Message, final String Choices, final String Default, long maxTime)\n\t\tthrows IOException;\n\n\t/**\n\t * Notifies this session that the given session is snooping it.\n\t * This session will manage said snooping.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setBeingSnoopedBy(Session, boolean)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#isBeingSnoopedBy(Session)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#snoopSuspension(int)\n\t * @param session the session to snoop on me.\n\t * @param onOff true to turn on snooping, false otherwise\n\t */\n\tpublic void setBeingSnoopedBy(Session session, boolean onOff);\n\n\t/**\n\t * Checks to see if the given session is snooping on this one.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setBeingSnoopedBy(Session, boolean)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#isBeingSnoopedBy(Session)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#snoopSuspension(int)\n\t * @param S the session to check for a snoop on me.\n\t * @return true if the given session is snooping on me, false otherwise\n\t */\n\tpublic boolean isBeingSnoopedBy(Session S);\n\n\t/**\n\t * Increments or decrements the snoop suspension counter\n\t * by the given amount.  Only when the counter is 0 does\n\t * snooping of this session actually occur.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setBeingSnoopedBy(Session, boolean)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#isBeingSnoopedBy(Session)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#snoopSuspension(int)\n\t * @param change the amount to change the snoop suspension counter by\n\t * @return the current value of the snoop suspension counter after the change\n\t */\n\tpublic int snoopSuspension(int change);\n\n\t/**\n\t * Force the current player to logoff, end the session, and/or kill the thread.\n\t * @param removeMOB true to remove the mob from the game\n\t * @param dropSession true to force closed sockets, and removed session\n\t * @param killThread true to force a thread death, and false to be more lenient\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#isStopped()\n\t */\n\tpublic void stopSession(boolean removeMOB, boolean dropSession, boolean killThread);\n\n\t/**\n\t * Returns whether this session is done, or slated to be done.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#logout(boolean)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#isStopped()\n\t * @return true if this session needs to go, false otherwise\n\t */\n\tpublic boolean isStopped();\n\n\t/**\n\t * Allows the user to select a different character, taking them back to the login\n\t * prompt, or to the account character listing screen, whichever is appropriate.\n\t * @param removeMOB true to remove the mob from the game\n\t */\n\tpublic void logout(boolean removeMOB);\n\n\t/**\n\t * Returns whether this mob/session is currently Away From Keyboard\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setAfkFlag(boolean)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setAFKMessage(String)\n\t * @return true if they are AFK, false otherwise\n\t */\n\tpublic boolean isAfk();\n\n\t/**\n\t * Sets whether this mob/session is currently Away From Keyboard\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#isAfk()\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getAfkMessage()\n\t * @param truefalse true if they are AFK, false otherwise\n\t */\n\tpublic void setAfkFlag(boolean truefalse);\n\n\t/**\n\t * Returns the reason given by the user that they are AFK.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setAfkFlag(boolean)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setAFKMessage(String)\n\t * @return  the reason given by the user that they are AFK.\n\t */\n\tpublic String getAfkMessage();\n\n\t/**\n\t * Returns the reason given by the user that they are AFK.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setAfkFlag(boolean)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getAfkMessage()\n\t * @param str the reason given by the user that they are AFK.\n\t */\n\tpublic void setAFKMessage(String str);\n\n\t/**\n\t * Blocks the current thread until the user attached to this session\n\t * hits ENTER, returning the characters they enter.  Completely filtered input.\n\t * @param timeoutMillis milliseconds before InterruptedIOException thrown\n\t * @param filter true to allow normal coffeemud input filtering\n\t * @return the string entered by the user\n\t * @throws IOException any exception generated during input\n\t */\n\tpublic String blockingIn(long timeoutMillis, boolean filter)\n\t\tthrows IOException;\n\n\t/**\n\t * Blocks for a short amount of time, returning an input\n\t * string only if the user happens to have hit enter.\n\t * @return a string entered by the user\n\t * @throws IOException exceptions thrown, typically a timeout\n\t * @throws SocketException exceptions thrown, typically socket error\n\t */\n\tpublic String readlineContinue()\n\t\tthrows IOException, SocketException;\n\n\t/**\n\t * Returns a pre-parsed, pre-filtered list of strings\n\t * representing the last command entered by the user\n\t * through this session.\n\t * @return a list of strings\n\t */\n\tpublic List<String> getPreviousCMD();\n\n\t/**\n\t * Returns the player MOB attached to this session object.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setMob(MOB)\n\t * @return  the player MOB attached to this session object.\n\t */\n\tpublic MOB mob();\n\n\t/**\n\t * Sets the player MOB attached to this session object.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#mob()\n\t * @param newmob the player MOB attached to this session object.\n\t */\n\tpublic void setMob(MOB newmob);\n\n\t/**\n\t * Sets the player acount attached to this session object.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#mob()\n\t * @param account the player account attached to this session object.\n\t */\n\tpublic void setAccount(PlayerAccount account);\n\n\t/**\n\t * Returns the current color code.\n\t * @return the current color code.\n\t */\n\tpublic ColorState getCurrentColor();\n\n\t/**\n\t * Sets the current color code.\n\t * @param newcolor the color to change it to\n\t */\n\tpublic void setCurrentColor(final ColorState newcolor);\n\n\t/**\n\t * Returns the marked color code.\n\t * @return the marked color code.\n\t */\n\tpublic ColorState popMarkedColor();\n\n\t/**\n\t * Sets the marked color code.\n\t * @param newcolor the color to change it to\n\t */\n\tpublic void pushMarkedColor(final ColorState newcolor);\n\n\t/**\n\t * Returns the previous current color code.\n\t * @return the previous current color code.\n\t */\n\tpublic ColorState getLastColor();\n\n\t/**\n\t * Returns the previous current color code.\n\t * @param newColor the color to change it to\n\t */\n\tpublic void setLastColor(final ColorState newColor);\n\n\t/**\n\t * Gets the column number for engine word-wrapping.\n\t * 0 Means disabled.\n\t *\n\t * @return the wrap column\n\t */\n\tpublic int getWrap();\n\n\t/**\n\t * Gets the current telnet clients ip address.\n\t *\n\t * @return the ip address\n\t */\n\tpublic String getAddress();\n\n\t/**\n\t * Gets the tick/thread status of this session object.\n\t *\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session.SessionStatus\n\t * @return the tick status\n\t */\n\tpublic SessionStatus getStatus();\n\n\t/**\n\t * Sets the tick/thread status of this session object.\n\t *\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session.SessionStatus\n\t * @param newStatus the tick status\n\t */\n\tpublic void setStatus(SessionStatus newStatus);\n\n\t/**\n\t * Returns whether this session is waiting for input\n\t *\n\t * @return true if it is, false otherwise\n\t */\n\tpublic boolean isWaitingForInput();\n\n\t/**\n\t * Gets the total milliseconds consumed by this session objects thread.\n\t *\n\t * @return the total milliseconds consumed\n\t */\n\tpublic long getTotalMillis();\n\n\t/**\n\t * Gets the total number of ticks consumed by this session object thread.\n\t *\n\t * @return the total ticks consumed\n\t */\n\tpublic long getTotalTicks();\n\n\t/**\n\t * Gets the number of milliseconds since a user entry was registered by this session\n\t *\n\t * @see Session#setIdleTimers()\n\t * @return the idle milliseconds passed\n\t */\n\tpublic long getIdleMillis();\n\n\t/**\n\t * Resets the internal idle timers.\n\t * @see Session#getIdleMillis()\n\t */\n\tpublic void setIdleTimers();\n\n\t/**\n\t * Gets the milliseconds elapsed since this user came online.\n\t *\n\t * @return the milliseconds online\n\t */\n\tpublic long getMillisOnline();\n\n\t/**\n\t * Gets the milliseconds timestamp since this user last registered a pk fight.\n\t *\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setLastPKFight()\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setLastNPCFight()\n\t * @return the last pk fight timestamp\n\t */\n\tpublic long getLastPKFight();\n\n\t/**\n\t * Sets now as the milliseconds timestamp since this user last registered a pk fight.\n\t *\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getLastPKFight()\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getLastNPCFight()\n\t */\n\tpublic void setLastPKFight();\n\n\t/**\n\t * Gets the milliseconds timestamp since this user last registered a npc fight.\n\t *\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setLastPKFight()\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setLastNPCFight()\n\t * @return the last npc fight timestamp\n\t */\n\tpublic long getLastNPCFight();\n\n\t/**\n\t * Sets now as the milliseconds timestamp since this user last registered a npc fight.\n\t *\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getLastPKFight()\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getLastNPCFight()\n\t */\n\tpublic void setLastNPCFight();\n\n\t/**\n\t * Returns the last time in milliseconds that this session began its input loop.\n\t * Is typically only held up by executing a user command, so it is an accurate\n\t * gauge of a locked up user command.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setInputLoopTime()\n\t *\n\t * @return the last time in milliseconds that this session began its input loop\n\t */\n\tpublic long getInputLoopTime();\n\n\t/**\n\t * Sets the last time in milliseconds that this session began its input loop.\n\t * Is typically only held up by executing a user command, so it is an accurate\n\t * gauge of a locked up user command.\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getInputLoopTime()\n\t */\n\tpublic void setInputLoopTime();\n\n\t/**\n\t * Whether this session is currently actively interacting with the user in\n\t * some way -- whether this session currently has "thread time".\n\t * @return true if its active and running, false otherwise\n\t */\n\tpublic boolean isRunning();\n\n\t/**\n\t * Returns a list of the last several message strings received by this user.\n\t * All are already previously filtered and parsed and ready to display.\n\t *\n\t * @return a list of string message strings\n\t */\n\tpublic List<String> getLastMsgs();\n\n\t/**\n\t * Gets the terminal type the user has\n\t * @return the terminal type\n\t */\n\tpublic String getTerminalType();\n\n\t/**\n\t * Sets a server telnet mode flag.\n\t *\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#TELNET_ANSI\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getServerTelnetMode(int)\n\t * @param telnetCode the telnet code\n\t * @param onOff true to turn on, false to turn off the flag\n\t */\n\tpublic void setServerTelnetMode(int telnetCode, boolean onOff);\n\n\t/**\n\t * Gets a server telnet mode flag.\n\t *\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#TELNET_ANSI\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setServerTelnetMode(int, boolean)\n\t * @param telnetCode the telnet code\n\t *\n\t * @return true, if server telnet mode is on, false otherwise\n\t */\n\tpublic boolean getServerTelnetMode(int telnetCode);\n\n\t/**\n\t * Sets a client telnet mode flag.\n\t *\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#TELNET_ANSI\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#getClientTelnetMode(int)\n\t *\n\t * @param telnetCode the telnet code\n\t * @param onOff true to turn on, false to turn off the flag\n\t */\n\tpublic void setClientTelnetMode(int telnetCode, boolean onOff);\n\n\t/**\n\t * Gets a client telnet mode flag.\n\t *\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#TELNET_ANSI\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setClientTelnetMode(int, boolean)\n\t *\n\t * @param telnetCode the telnet code\n\t *\n\t * @return true, if client telnet mode is on, false otherwise\n\t */\n\tpublic boolean getClientTelnetMode(int telnetCode);\n\n\t/**\n\t * Change telnet mode by sending the appropriate command to the clients client.\n\t * A response received later will trigger mode changed.\n\t *\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#TELNET_ANSI\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#TELNET_ANSI16\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setClientTelnetMode(int, boolean)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setServerTelnetMode(int, boolean)\n\t * @param telnetCode the telnet code\n\t * @param onOff true to turn on, false to turn off the flag\n\t */\n\tpublic void changeTelnetMode(int telnetCode, boolean onOff);\n\n\t/**\n\t * Change telnet mode by negotiating the command to the clients client.\n\t *\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#TELNET_ANSI\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#TELNET_ANSI16\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setClientTelnetMode(int, boolean)\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#setServerTelnetMode(int, boolean)\n\t * @param telnetCode the telnet code\n\t */\n\tpublic void negotiateTelnetMode(int telnetCode);\n\n\t/**\n\t * Initializes a telnet mode between this session and the connected client by negotiating\n\t * certain fundamental flags, like ANSI, MXP, and MSP.  It will use a bitmap of MOB flags\n\t * passed in as a guide.\n\t *\n\t * @see com.planet_ink.coffee_mud.MOBS.interfaces.MOB#getAttributesBitmap()\n\t * @see com.planet_ink.coffee_mud.MOBS.interfaces.MOB.Attrib\n\t * @see com.planet_ink.coffee_mud.Common.interfaces.Session#changeTelnetMode(int, boolean)\n\t * @param mobbitmap the mobbitmap the bitmap of mob flags to use as a guide in negotiation\n\t */\n\tpublic void initTelnetMode(int mobbitmap);\n\n\t/**\n\t * Returns true if the given max tag will be accepted by the client.\n\t * @param tag the tag to check\n\t * @return true if allowed, false otherwise\n\t */\n\tpublic boolean isAllowedMxp(String tag);\n\n\t/**\n\t * Returns true if this client supports the given package at the\n\t * given version.\n\t * @param packageName the package to check\n\t * @param version the version of the package to check\n\t * @return true if there\'s support, false otherwise\n\t */\n\tpublic boolean isAllowedMcp(String packageName, float version);\n\n\t/**\n\t * Sends a properly formatted MCP command to the session, if it or its package is supported.\n\t * @param packageCommand the fully formed command\n\t * @param parms the variable parameters, already well formed\n\t * @return true if it was sent, false otherwise\n\t */\n\tpublic boolean sendMcpCommand(String packageCommand, String parms);\n\n\t/**\n\t * Potentially sends the GMCP event of the given name with the given json\n\t * doc.\n\t * @param eventName the event name, like comm.channel\n\t * @param json the json doc, like {"blah":"BLAH"}\n\t * @return true if GMCP was enabled for this session, false otherwise\n\t */\n\tpublic boolean sendGMCPEvent(final String eventName, final String json);\n\n\t/**\n\t * Returns the entire command history cached by this session.\n\t * @return the entire command history cached by this session.\n\t */\n\tpublic Enumeration<List<String>> getHistory();\n\n\t/**\n\t * Send this session fake input as if the user had typed it in.\n\t * @param input text to send.\n\t */\n\tpublic void setFakeInput(String input);\n\n\t/** TELNET CODE: transmit binary */\n\tpublic static final int TELNET_BINARY=0;\n\t/** TELNET CODE: echo */\n\tpublic static final int TELNET_ECHO=1;\n\t/** TELNET CODE: echo */\n\tpublic static final int TELNET_LOGOUT=18;\n\t/** TELNET CODE: supress go ahead*/\n\tpublic static final int TELNET_SUPRESS_GO_AHEAD=3;\n\t/** TELNET CODE: sending terminal type*/\n\tpublic static final int TELNET_TERMTYPE=24;\n\t/** TELNET CODE: Negotiate About Window Size.*/\n\tpublic static final int TELNET_NAWS=31;\n\t/** TELNET CODE: Remote Flow Control.*/\n\tpublic static final int TELNET_TOGGLE_FLOW_CONTROL=33;\n\t/** TELNET CODE: Linemode*/\n\tpublic static final int TELNET_LINEMODE=34;\n\t/** TELNET CODE: MSDP protocol*/\n\tpublic static final int TELNET_MSDP=69;\n\t/** TELNET CODE: MSSP Server Status protocol*/\n\tpublic static final int TELNET_MSSP=70;\n\t/** TELNET CODE: text compression, protocol 1*/\n\tpublic static final int TELNET_COMPRESS=85;\n\t/** TELNET CODE: text compression, protocol 2*/\n\tpublic static final int TELNET_COMPRESS2=86;\n\t/** TELNET CODE: MSP SOund protocol*/\n\tpublic static final int TELNET_MSP=90;\n\t/** TELNET CODE: MXP Extended protocol*/\n\tpublic static final int TELNET_MXP=91;\n\t/** TELNET CODE: AARD protocol*/\n\tpublic static final int TELNET_AARD=102;\n\t/** TELNET CODE: End of subnegotiation parameters*/\n\tpublic static final int TELNET_SE=240;\n\t/** TELNET CODE: Are You There*/\n\tpublic static final int TELNET_AYT=246;\n\t/** TELNET CODE: Erase character*/\n\tpublic static final int TELNET_EC=247;\n\t/** TELNET CODE: ATCP protocol*/\n\tpublic static final int TELNET_ATCP=200;\n\t/** TELNET CODE: GMCP protocol*/\n\tpublic static final int TELNET_GMCP=201;\n\t/** TELNET CODE: Indicates that what follows is subnegotiation of the indicated option*/\n\tpublic static final int TELNET_SB=250;\n\t/** TELNET CODE: Indicates the desire to begin performing, or confirmation that you are now performing, the indicated option*/\n\tpublic static final int TELNET_WILL=251;\n\t/** TELNET CODE: Indicates the refusal to perform, or continue performing, the indicated option*/\n\tpublic static final int TELNET_WONT=252;\n\t/** TELNET CODE: 252 doubles as fake ansi 16 telnet code*/\n\tpublic static final int TELNET_ANSI16=252;\n\t/** TELNET CODE: Indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option*/\n\tpublic static final int TELNET_DO=253;\n\t/** TELNET CODE: 253 doubles as fake ansi telnet code*/\n\tpublic static final int TELNET_ANSI=253;\n\t/** TELNET CODE: Indicates the demand that the other party stop performing, or confirmation that you are no longer expecting the other party to perform, the indicated option.*/\n\tpublic static final int TELNET_DONT=254;\n\t/** TELNET CODE: Indicates that the other party can go ahead and transmit -- I\'m done.*/\n\tpublic static final int TELNET_GA=249;\n\t/** TELNET CODE: Indicates that there is nothing to do?*/\n\tpublic static final int TELNET_NOP=241;\n\t/** TELNET CODE: IAC*/\n\tpublic static final int TELNET_IAC=255;\n\t/** Array String-friendly descriptions of the various telnet codes.  Indexed by code id 0-255*/\n\tpublic static final String[] TELNET_DESCS=\n\t{\n\t\t"BINARY","ECHO","2","SUPRESS GO AHEAD","4","5","6","7","8","9", //0-9\n\t\t"10","11","12","13","14","15","16","17","LOGOUT","19", //10-19\n\t\t"20","21","22","23","TERMTYPE","25","26","27","28","29", //20-29\n\t\t"30","NAWS","32","FLOWCONTROL","LINEMODE","35","36","37","38","39", //30-39\n\t\t"40","41","42","43","44","45","46","47","48","49", //40-49\n\t\t"50","51","52","53","54","55","56","57","58","59", //50-59\n\t\t"60","61","62","63","64","65","66","67","68","MSDP", //60-69\n\t\t"MSSP","71","72","73","74","75","76","77","78","79", //70-79\n\t\t"","","","","","COMPRESS","COMPRESS2","","","", //80-89\n\t\t"MSP","MXP","","","","","","","","", //90-99\n\t\t"","","AARD","","","","","","","", //100-109\n\t\t"","","","","","","","","","", //110-119\n\t\t"","","","","","","","","","", //120-129\n\t\t"","","","","","","","","","", //130-139\n\t\t"","","","","","","","","","", //140-149\n\t\t"","","","","","","","","","", //150-159\n\t\t"","","","","","","","","","", //160-169\n\t\t"","","","","","","","","","", //170-179\n\t\t"","","","","","","","","","", //180-189\n\t\t"","","","","","","","","","", //190-199\n\t\t"ATCP","GMCP","","","","","","","","", //200-209\n\t\t"","","","","","","","","","", //210-219\n\t\t"","","","","","","","","","", //220-229\n\t\t"","","","","","","","","","", //230-239\n\t\t"SE","NOP","","","","","AYT","EC","","GA", //240-249\n\t\t"SB","","","ANSI","","" \t\t\t //250-255\n\t};\n\n\t/* The charset recognized by MSDP is unknown, so assume std ascii */\n\tpublic final static String MSDP_CHARSET = "US-ASCII";\n\n\t/** How to start a GMCP subnegotiation */\n\tpublic final static byte[] TELNETBYTES_GMCP_HEAD= new byte[]{(byte)Session.TELNET_IAC,(byte)Session.TELNET_SB,(byte)Session.TELNET_GMCP};\n\t/** How to end a telnet subnegotiation */\n\tpublic final static byte[] TELNETBYTES_END_SB\t= new byte[]{(byte)Session.TELNET_IAC,(byte)Session.TELNET_SE};\n\t/** Go ahead bytes */\n\tpublic final static byte[] TELNETGABYTES\t\t= {(byte)TELNET_IAC,(byte)TELNET_GA};\n\n\t/**\n\t * The internal class to managing asynchronous user input.\n\t * This class supports three types of input: open text (PROMPT),\n\t * one-letter options (CHOOSE), and Y/N (CONFIRM).\n\t * @author Bo Zimmerman\n\t *\n\t */\n\tpublic static abstract class InputCallback\n\t{\n\t\t/**\n\t\t * The threa different types of user input processing\n\t\t * supported by the abstract InputCallback class\n\t\t * @author Bo Zimmerman\n\t\t *\n\t\t */\n\t\tpublic static enum Type { CONFIRM, PROMPT, CHOOSE, WAIT }\n\n\t\tprivate final Type\t\t\ttype;\n\t\tprivate final String\t\tdefaultInput;\n\t\tprivate final String\t\tchoicesStr;\n\t\tprotected final long\t\ttimeoutMs;\n\t\tprotected volatile long\t\ttimeout;\n\t\tprotected volatile String\tinput\t\t= "";\n\t\tprotected volatile boolean\tconfirmed\t= false;\n\t\tprotected volatile boolean\twaiting\t\t= true;\n\t\tprotected volatile boolean\tnoTrim\t\t= false;\n\n\t\t/**\n\t\t * Full constructor.  Receives the Type of processing, a default input for\n\t\t * when the user just hits ENTER, a list of one-character choices (if CHOOSE Type\n\t\t * is used) and an amount of time, in ms, for the user to be given before timeout\n\t\t * and the timedOut() method is called.\n\t\t * @param type the type of processing\n\t\t * @param defaultInput default input value\n\t\t * @param choicesStr list of one-character options (if CHOOSE Type)\n\t\t * @param timeoutMs time, in ms, before the user is kicked\n\t\t */\n\t\tpublic InputCallback(final Type type, final String defaultInput, final String choicesStr, final long timeoutMs)\n\t\t{\n\t\t\tthis.type=type;\n\t\t\tif((choicesStr!=null)&&(choicesStr.trim().length()>0))\n\t\t\t\tthis.choicesStr=choicesStr.toUpperCase().trim();\n\t\t\telse\n\t\t\tswitch(type)\n\t\t\t{\n\t\t\t\tcase CONFIRM:\n\t\t\t\t\tthis.choicesStr = "YN";\n\t\t\t\t\tbreak;\n\t\t\t\tcase CHOOSE:\n\t\t\t\t\tthis.choicesStr = "YN";\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthis.choicesStr = "";\n\t\t\t}\n\t\t\tthis.timeoutMs=timeoutMs;\n\t\t\tif(this.timeoutMs<=0)\n\t\t\t\tthis.timeout=0;\n\t\t\telse\n\t\t\t\tthis.timeout=System.currentTimeMillis()+timeoutMs;\n\t\t\tthis.waiting=true;\n\t\t\tthis.defaultInput=defaultInput;\n\t\t}\n\n\t\t/**\n\t\t * Constructor.  Receives the Type of processing, a default input for\n\t\t * when the user just hits ENTER,  and an amount of time, in ms, for\n\t\t * the user to be given before timeout and the timedOut() method is called.\n\t\t * @param type the type of processing\n\t\t * @param defaultInput default input value\n\t\t * @param timeoutMs time, in ms, before the user is kicked\n\t\t */\n\t\tpublic InputCallback(final Type type, final String defaultInput, final long timeoutMs)\n\t\t{\n\t\t\tthis(type, defaultInput, "", timeoutMs);\n\t\t}\n\n\t\t/**\n\t\t * Constructor.  Receives the Type of processing, and an amount of time, in ms,\n\t\t * for the user to be given before timeout and the timedOut() method is called.\n\t\t * @param type the type of processing\n\t\t * @param timeoutMs time, in ms, before the user is kicked\n\t\t */\n\t\tpublic InputCallback(final Type type, final long timeoutMs)\n\t\t{\n\t\t\tthis(type, "", timeoutMs);\n\t\t}\n\n\t\t/**\n\t\t * Constructor.  Receives the Type of processing.\n\t\t * @param type the type of processing\n\t\t */\n\t\tpublic InputCallback(final Type type)\n\t\t{\n\t\t\tthis(type, 0);\n\t\t}\n\n\t\t/**\n\t\t * Constructor.  Receives the Type of processing, a default input for\n\t\t * when the user just hits ENTER.\n\t\t * @param type the type of processing\n\t\t * @param defaultInput default input value\n\t\t */\n\t\tpublic InputCallback(final Type type, final String defaultInput)\n\t\t{\n\t\t\tthis(type, "", 0);\n\t\t}\n\n\t\t/**\n\t\t * Returns true if a timeout was given, and this class has been\n\t\t * active longer than that amount of time.\n\t\t * @return true if timed out, false otherwise.\n\t\t */\n\t\tpublic boolean isTimedOut()\n\t\t{\n\t\t\tfinal boolean isTimedOut=(timeout > 0) && (System.currentTimeMillis() > timeout);\n\t\t\tif(isTimedOut)\n\t\t\t\twaiting=false;\n\t\t\treturn isTimedOut;\n\t\t}\n\n\t\t/**\n\t\t * Forces user-input into this class, potentially changing its user\n\t\t * input waiting state.  If the input is invalid for CONFIRM or CHOOSE,\n\t\t * then this will call ShowPrompt and go back to waiting. Otherwise,\n\t\t * waiting is set to false and it becomes very likely that callBack()\n\t\t * will be called.\n\t\t * @param input the user input to force\n\t\t */\n\t\tpublic void setInput(String input)\n\t\t{\n\t\t\tthis.input=input;\n\t\t\tswitch(type)\n\t\t\t{\n\t\t\tcase PROMPT:\n\t\t\t{\n\t\t\t\tif((input.length()>0)&&(input.charAt(input.length()-1)==\'\\\\\'))\n\t\t\t\t\tthis.input=input.substring(0,input.length()-1);\n\t\t\t\telse\n\t\t\t\t\tthis.input=input;\n\t\t\t\tif((this.input.trim().length()==0)&&(!noTrim))\n\t\t\t\t\tthis.input=defaultInput;\n\t\t\t\twaiting=false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase WAIT:\n\t\t\t\twaiting=true;\n\t\t\t\treturn;\n\t\t\tcase CONFIRM:\n\t\t\t\tif(input.trim().toUpperCase().startsWith("T"))\n\t\t\t\t\tinput="Y";\n\t\t\t\t//$FALL-THROUGH$\n\t\t\tcase CHOOSE:\n\t\t\t\t\tthis.input=input.toUpperCase().trim();\n\t\t\t\tif(this.input.length()==0)\n\t\t\t\t\tthis.input=defaultInput.toUpperCase();\n\t\t\t\tif(this.input.length()>0)\n\t\t\t\t{\n\t\t\t\t\tthis.input=this.input.substring(0,1);\n\t\t\t\t\tif((choicesStr.length()==0)\n\t\t\t\t\t||(choicesStr.indexOf(this.input)>=0))\n\t\t\t\t\t{\n\t\t\t\t\t\twaiting=false;\n\t\t\t\t\t\tif(type==Type.CONFIRM)\n\t\t\t\t\t\t\tthis.confirmed=this.input.equals("Y");\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\twaiting=true;\n\t\t\t\t\t\tshowPrompt();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\twaiting=false;\n\t\t}\n\n\t\t/**\n\t\t * Returns true if this class is currently waiting\n\t\t * for user input.\n\t\t * @return true if waiting, false if waiting is over.\n\t\t */\n\t\tpublic boolean waitForInput()\n\t\t{\n\t\t\treturn waiting;\n\t\t}\n\n\t\t/**\n\t\t * This method allows reuse of a given InputCallback.\n\t\t * It will re-start the timeout period, and flag\n\t\t * the callback for requiring more input.\n\t\t * @return this\n\t\t */\n\t\tpublic InputCallback reset()\n\t\t{\n\t\t\tinput="";\n\t\t\tif(timeoutMs>0)\n\t\t\t\ttimeout=System.currentTimeMillis()+timeoutMs;\n\t\t\twaiting=true;\n\t\t\tconfirmed=false;\n\t\t\treturn this;\n\t\t}\n\n\t\t/**\n\t\t * This method is called by InputCallback before user\n\t\t * input is requested.  If a CHOOSE or CONFIRM type is\n\t\t * used, and the user enters something unrecognized, then\n\t\t * this method is called again before more input.\n\t\t */\n\t\tpublic abstract void showPrompt();\n\n\t\t/**\n\t\t * This method is call by InputCallback if a timeout\n\t\t * value greater than 0 is given and that amount of time has\n\t\t * been exceeded.\n\t\t */\n\t\tpublic abstract void timedOut();\n\n\t\t/**\n\t\t * This method is called if the user hits ENTER, and\n\t\t * their input data is valid (one of the choices for\n\t\t * CHOOSE or CONFIRM), or anything else for PROMPT.\n\t\t * If the user has entered nothing, and a default\n\t\t * value has been given, the default value is returned.\n\t\t * The user entry is available to this method in\n\t\t * this.input variable.\n\t\t */\n\t\tpublic abstract void callBack();\n\t}\n\n\tpublic abstract class TickingCallback extends InputCallback\n\t{\n\t\tprotected volatile int\t\t\tcounter\t\t\t= 0;\n\t\tprotected final StringBuilder\tcollectedInput\t= new StringBuilder("");\n\n\t\t/**\n\t\t * Only constructor is the one to tell out often to call back.\n\t\t * @param tickerMs the time is ms between timeouts\n\t\t */\n\t\tpublic TickingCallback(final long tickerMs)\n\t\t{\n\t\t\tsuper(Type.PROMPT,tickerMs);\n\t\t}\n\t\t/**\n\t\t * TimeOutCallback has no prompt\n\t\t */\n\t\t@Override\n\t\tpublic void showPrompt()\n\t\t{\n\t\t}\n\n\t\t@Override\n\t\tpublic void callBack()\n\t\t{\n\t\t}\n\n\t\t@Override\n\t\tpublic void setInput(String input)\n\t\t{\n\t\t\tsuper.setInput(input);\n\t\t\tcollectedInput.append(this.input).append("\\n\\r");\n\t\t\tinput="";\n\t\t\twaiting=true;\n\t\t}\n\n\t\t@Override\n\t\tpublic void timedOut()\n\t\t{\n\t\t\ttimeout=System.currentTimeMillis()+timeoutMs;\n\t\t\twaiting=true;\n\t\t\tif(!tick(counter++))\n\t\t\t{\n\t\t\t\ttimeout=System.currentTimeMillis()-1;\n\t\t\t\twaiting=false;\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * This method id called every ticker ms with an incremented\n\t\t * counter.  This is also where you control the process.\n\t\t * @param counter the counter, higher than the last time\n\t\t * @return true to keep ticking, false to finally stop.\n\t\t */\n\t\tpublic abstract boolean tick(int counter);\n\t}\n\n\t/** for REPLY command, constant for maximum number of saved strings */\n\tpublic static final int MAX_PREVMSGS=100;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_MODE=1;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_MODEMASK_EDIT=1;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_MODEMASK_TRAPSIG=2;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_MODEMASK_ACK=4;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_SLC=3;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_SLC_DEFAULT=3;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_SLC_VALUE=2;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_SLC_CANTCHANGE=1;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_SLC_NOSUPPORT=0;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_SLC_ACK=128;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_SLC_XON=15;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_SLC_XOFF=16;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_SLC_EOF=8;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_SLC_SUSP=9;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_SLC_BRK=2;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_SLC_IP=3;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_SLC_AO=4;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_SLC_AYT=5;\n\t/** Some sort of TELNET protocol constant related to LINEMODE -- I\'ve no idea what it does */\n\tpublic static final int TELNET_LINEMODE_SLC_EOR=6;\n\n\t/** For MSDP protocol, denotes variable start*/\n\tpublic static final char MSDP_VAR\t\t\t= 1;\n\t/** For MSDP protocol, denotes value start*/\n\tpublic static final char MSDP_VAL\t\t\t= 2;\n\t/** For MSDP protocol, denotes table open*/\n\tpublic static final char MSDP_TABLE_OPEN\t= 3;\n\t/** For MSDP protocol, denotes table done*/\n\tpublic static final char MSDP_TABLE_CLOSE\t= 4;\n\t/** For MSDP protocol, denotes array start*/\n\tpublic static final char MSDP_ARRAY_OPEN\t= 5;\n\t/** For MSDP protocol, denotes array done*/\n\tpublic static final char MSDP_ARRAY_CLOSE\t= 6;\n\n\t/**\n\t * The status of the session, from opening handshake, to final goodbyes\n\t * @author Bo Zimmerman\n\t */\n\tpublic static enum SessionStatus\n\t{\n\t\tHANDSHAKE_OPEN, HANDSHAKE_MCCP, HANDSHAKE_MXP, HANDSHAKE_MXPPAUSE, HANDSHAKE_DONE,\n\t\tLOGIN, LOGIN2, ACCOUNT_MENU, CHARCREATE, IDLE, MAINLOOP,\n\t\tLOGOUT, LOGOUT1, LOGOUT2, LOGOUT3, LOGOUT4, LOGOUT5, LOGOUT6, LOGOUT7, LOGOUT8,\n\t\tLOGOUT9, LOGOUT10, LOGOUT11, LOGOUT12, LOGOUTFINAL\n\t}\n}\n', 'message': 'The ability to apply arbitrary filters to outgoing text\n\ngit-svn-id: 0cdf8356e41b2d8ccbb41bb76c82068fe80b2514@18274 0d6f1817-ed0e-0410-87c9-987e46238f29\n', 'author_name': 'bozimmerman', 'lang': 'java'}