Module session :: Class Session
[show private | hide private]
[frames | no frames]

Class Session


A session is a nice container of all the stuff that encompasses a user session: aliases, actions, commands...

All input and output goes through the Session object. Almost everything happens through the Session.
Method Summary
  __init__(self)
Initialize.
  __repr__(self)
  addToDataBuffer(self, text)
Adds data to the buffer by thinking about everything in terms of lines.
  clear(self)
Clears the session (except for connections).
  clearDataBuffer(self)
Clears the databuffer.
list of strings getDataBuffer(self)
Returns the DataBuffer instance for this session.
string getName(self)
Returns the name of the session.
boolean getSnoop(self)
Returns whether or not we show text when we're not the current session.
SocketCommunicator getSocketCommunicator(self)
Returns the socket communicator.
string getStatus(self)
Returns status of the session.
  getWriteFileInfo(self, args)
Implements the write_hook.
  handleMudData(self, input)
Handles input coming from the mud.
  handleUserData(self, input, internal)
Handles input in the context of this session specifically.
boolean isConnected(self)
Tells you whether (1) or not (0) a session has a connection.
  prompt(self)
Deals with printing a prompt if this is the common session.
  resizeDataBuffer(self, newsize)
Changes the buffer max.
  setName(self, name)
Sets the name of the session.
  setSnoop(self, snoop)
Sets whether or not we show text when we're not the current session.
  setSocketCommunicator(self, sc)
Sets the socket communicator.
  shutdown(self, args)
Shuts down the session, shuts down the underlying SocketCommunicator.
  writeSocket(self, message, tag)
Writes data to the socket.

Method Details

__init__(self)
(Constructor)

Initialize.

addToDataBuffer(self, text)

Adds data to the buffer by thinking about everything in terms of lines.
Parameters:
text - the text to add to the buffer
           (type=string)

clear(self)

Clears the session (except for connections). Goes through the list of managers registered with the engine and calls the clear method with itself.

clearDataBuffer(self)

Clears the databuffer.

getDataBuffer(self)

Returns the DataBuffer instance for this session.
Returns:
list of strings
           (type=list of strings)

getName(self)

Returns the name of the session.
Returns:
the name of the session
           (type=string)

getSnoop(self)

Returns whether or not we show text when we're not the current session.
Returns:
1 if we show text, 0 if not
           (type=boolean)

getSocketCommunicator(self)

Returns the socket communicator.
Returns:
SocketCommunicator instance
           (type=SocketCommunicator)

getStatus(self)

Returns status of the session. Most specifically the session name, the socket we're connected to.
Returns:
the status string
           (type=string)

getWriteFileInfo(self, args)

Implements the write_hook. Persists information about whether speedwalking and ansicolor are active.
Parameters:
args - the args tuple for the write_hook
           (type=tuple)

handleMudData(self, input)

Handles input coming from the mud.
Parameters:
input - the data coming from the mud
           (type=string)

handleUserData(self, input, internal=0)

Handles input in the context of this session specifically.
Parameters:
input - the user data
           (type=string)
internal - whether the command came from interally. we won't spam hooks and may at some point prevent output for internal stuff too. 1 if internal, 0 if not.
           (type=boolean)

isConnected(self)

Tells you whether (1) or not (0) a session has a connection.
Returns:
1 if connected, 0 if not
           (type=boolean)

prompt(self)

Deals with printing a prompt if this is the common session.

resizeDataBuffer(self, newsize=10000)

Changes the buffer max.
Parameters:
newsize - the new buffer max size
           (type=int)

setName(self, name)

Sets the name of the session.
Parameters:
name - the new name
           (type=string)

setSnoop(self, snoop)

Sets whether or not we show text when we're not the current session.
Parameters:
snoop - 1 if we show text, 0 if not
           (type=boolean)

setSocketCommunicator(self, sc)

Sets the socket communicator.
Parameters:
sc - the new SocketCommunicator instance
           (type=SocketCommunicator)

shutdown(self, args)

Shuts down the session, shuts down the underlying SocketCommunicator.
Parameters:
args - the args tuple for the shutdown_hook.
           (type=tuple)

writeSocket(self, message, tag=None)

Writes data to the socket.
Parameters:
message - the data to be written to the mud
           (type=string)
tag - Used to tag data being sent to the mud for identification when it comes out of the to_mud_hook. Simply passed through as-is by lyntin internals.
           (type=varies)

Generated by Epydoc 1.1 on Mon Apr 28 21:11:25 2003 http://epydoc.sf.net