Package lyntin :: 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, engine_instance)
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.
SocketCommunicator getSocketCommunicator(self)
Returns the socket communicator.
string getStatus(self)
Returns status of the session.
  getVariable(self, var, default)
  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.
  removeVariable(self, var)
Removes a variable from the local _vars dict.
  resizeDataBuffer(self, newsize)
Changes the buffer max.
  setName(self, name)
Sets the name of the session.
  setSocketCommunicator(self, sc)
Sets the socket communicator.
  setupCommonSession(self)
  setVariable(self, var, expansion)
Sets a variable value.
  shutdown(self, args)
Shuts down the session, shuts down the underlying SocketCommunicator.
  writeSocket(self, message, tag)
Writes data to the socket.

Class Variable Summary
dict global_vars = {}

Method Details

__init__(self, engine_instance)
(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)

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)

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.

removeVariable(self, var)

Removes a variable from the local _vars dict. This also spams the variable_change_hook.
Parameters:
var - the name of the variable to remove
           (type=string)

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)

setSocketCommunicator(self, sc)

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

setVariable(self, var, expansion)

Sets a variable value. This also calls the variable_change_hook.
Parameters:
var - the variable name to set
           (type=string)
expansion - the new value of the variable. this can be a string or a class with a __str__ method.
           (type=string)

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)

Class Variable Details

global_vars

Type:
dict
Value:
{}                                                                     

Generated by Epydoc 2.1 on Mon Aug 9 09:17:42 2004 http://epydoc.sf.net