Module manager :: Class Manager
[show private | hide private]
[frames | no frames]

Class Manager

Known Subclasses:
CommandManager, HelpManager, HistoryManager, HookManager

Base manager class for managing things in Lyntin. The Manager class gives all managers a standard way of interacting with sessions and user queries for information,
Method Summary
  __init__(self)
  addSession(self, newsession, basesession)
Tells the manager to create a new session based on another session.
  clear(self, ses)
Removes everything the manager was managing--essentially reinitializes it.
string getInfo(self, ses, text)
Returns information managed by this class.
list of strings getState(self, ses)
Returns the state of something as a list of command strings without the command char (which is added by #write).
string getStatus(self, ses)
Returns a one-liner status of the state of this manager for a given session.
  removeSession(self, ses)
Tells the manager to remove information regarding the session.

Method Details

addSession(self, newsession, basesession=None)

Tells the manager to create a new session based on another session. For example, when we connected to the 3k mud, we would tell all the managers to clone the common session to the new session created thus populating the new session.
Parameters:
newsession - the new session just created
           (type=Session)
basesession - the session to use as a template for the new session. most managers just copy the data from the basesession to the newsession. if this is None, then we don't want to clone from anything--we use None when Lyntin starts up and we create the common session.
           (type=Session)

clear(self, ses=None)

Removes everything the manager was managing--essentially reinitializes it. Override this to clear out the data your manager is managing. This is typically session oriented and gets called by the "#clear" command.
Parameters:
ses - the session this applies to--None if it applies to all sessions
           (type=session.Session)

getInfo(self, ses, text='')

Returns information managed by this class. This is mostly for display to the user--we shouldn't be using this method for Lyntin introspection.
Parameters:
text - allows the user to pass in a name filter which should show a subset of the data based on what names match the filter
           (type=string)
Returns:
a string of everything involved
           (type=string)

getState(self, ses)

Returns the state of something as a list of command strings without the command char (which is added by #write).

For example, getState on the AliasManager might return:
 ["alias {t3k} {#ses a localhost 3000}", "alias {toch} {nwnnen;vortex}"]
Parameters:
ses - the session to persist
           (type=Session)
Returns:
the command strings representing all the data for this session being held by this manager
           (type=list of strings)

getStatus(self, ses)

Returns a one-liner status of the state of this manager for a given session. If this manager does not apply to sessions then it should return an empty string.

For example, the SubstituteManager which is holding 5 substitutes and 2 gags for a session named "3k" would return the string:
 "5 substitute(s). 2 gag(s)."
But the ThreadManager which is a globally scoped manager and doesn't apply to the "3k" session would return an empty string.
Parameters:
ses - the session to get status for
           (type=Session)
Returns:
a one-liner string of the status or an empty string
           (type=string)

removeSession(self, ses)

Tells the manager to remove information regarding the session.
Parameters:
ses - the session we no longer need to hold information for because the session has gone away
           (type=Session)

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