Module exported
[show private | hide private]
[frames | no frames]

Module exported

This is the API for lyntin internals and is guaranteed to change very rarely even though we might change Lyntin's internals. If it does change it'll be between major Lyntin versions.
Function Summary
  add_command(cmd, func, arguments, argoptions, helptext)
The best way to add commands to Lyntin.
string add_help(fqn, helptext)
Adds a help topic to the structure.
  add_manager(name, mgr)
Registers a manager with the engine.
string expand_ses_arguments(text, ses)
Grabs the variable manager (which we're hoping is using the same expand_vars as what's registered--only time will tell) and expands variables using the variable manager and its varmap.
string expand_ses_vars(text, ses)
Grabs the variable manager (which we're hoping is using the same expand_vars as what's registered--only time will tell) and expands variables using the variable manager and its varmap.
list of session.Session's get_active_sessions()
Returns a list of the active sessions including the common one.
list of strings get_commands()
Returns a list of the commands currently bound.
session.Session get_current_session()
Returns the current session.
engine.Engine get_engine()
Nice way of retrieving the engine instance.
string get_help(fqn)
Retrieves a help topic via a fully qualified name.
list of strings get_history(count)
Retrieves the history as a oldest to youngest list of strings.
Hook get_hook(hookname)
If the hook exists, returns the hook.
manager.Manager get_manager(name)
Retrieves a manager from the engine.
int get_num_errors()
Returns the total number of errors Lyntin has had thus far.
session.Session get_session(name)
Returns a named session or None if the session doesn't exist.
  hook_register(hookname, func, place)
Registers a function with a hook.
  hook_unregister(hookname, func)
If the hook exists, unregisters the func from the hook.
  lyntin_command(text, internal, session)
The best way of executing a Lyntin command as if the user had typed it.
boolean remove_command(text)
Removes a command from Lyntin.
  remove_help(fqn)
Removes a help topic from Lyntin.
boolean remove_manager(name)
Removes a manager from the engine.
  set_current_session(ses)
Changes the current session to another session.
  set_num_errors(num)
Sets the number of errors Lyntin has had thus far.
  tally_error()
This adds one to the current error count and checks to see if we're over our limit.
  write_error(text, ses)
Calls engine.myengine.writeError which writes ERROR message.
  write_message(text, ses)
Calls engine.myengine.writeMessage which writes LTDATA message.
  write_mud_data(text, ses)
Calls engine.myengine.writeMudData which writes a MUDDATA message.
  write_traceback(message, ses)
Convenience method for grabbing the traceback, formatting it, piping it through write_error, with a message for the user.
  write_ui(text)
Calls engine.myengine.writeUI which writes a message to the ui.
  write_user_data(text, ses)
Calls engine.myengine.writeUserData which writes a USERDATA message.

Function Details

add_command(cmd, func, arguments=None, argoptions=None, helptext='')

The best way to add commands to Lyntin.
Parameters:
cmd - the command name to add. ex. "help"
           (type=string)
func - the function to call to handle the command
           (type=function)
arguments - the argument spec for building the ArgumentParser
           (type=string)
argoptions - the options to give the ArgumentParser to tell it how to parse the arguments
           (type=string)
helptext - the helptext associated with this command to give to the HelpManager
           (type=string)

add_help(fqn, helptext)

Adds a help topic to the structure. See the helpmanager documentation for more details as to what the helptext should look like.
Parameters:
fqn - a . delmited string of categories ending with a help name
           (type=string)
helptext - the help text
           (type=string)
Returns:
the fqn of where the help topic was stored (you can place category overrides in the helptext)
           (type=string)

add_manager(name, mgr)

Registers a manager with the engine.
Parameters:
name - the name of the manager to register with Lyntin
           (type=string)
mgr - the manager instance being registered
           (type=manager.Manager)

expand_ses_arguments(text, ses)

Grabs the variable manager (which we're hoping is using the same expand_vars as what's registered--only time will tell) and expands variables using the variable manager and its varmap. Should be used for arguments that were passed into a command, since in some modes these will have already been fully processed.
Parameters:
text - the string to expand variables in
           (type=string)
ses - the session object to pass to the VariableManager
           (type=session.Session)
Returns:
the text with variables expanded
           (type=string)

expand_ses_vars(text, ses)

Grabs the variable manager (which we're hoping is using the same expand_vars as what's registered--only time will tell) and expands variables using the variable manager and its varmap.
Parameters:
text - the text to expand variables in
           (type=string)
ses - the session object to pass to the VariableManager
           (type=session.Session)
Returns:
the text with variables expanded
           (type=string)

get_active_sessions()

Returns a list of the active sessions including the common one.
Returns:
the list of active sessions
           (type=list of session.Session's)

get_commands()

Returns a list of the commands currently bound.
Returns:
the list of commands currently registered with Lyntin
           (type=list of strings)

get_current_session()

Returns the current session.
Returns:
the current session
           (type=session.Session)

get_engine()

Nice way of retrieving the engine instance.
Returns:
the Engine singleton instance
           (type=engine.Engine)

get_help(fqn)

Retrieves a help topic via a fully qualified name.
Parameters:
fqn - a . delimited string of categories ending with a help name
           (type=string)
Returns:
the help topic of that name or None if the topic doesn't exist
           (type=string)

get_history(count=30)

Retrieves the history as a oldest to youngest list of strings.
Parameters:
count - the number of lines to return
           (type=int)
Returns:
the history oldest to youngest
           (type=list of strings)

get_hook(hookname)

If the hook exists, returns the hook. Otherwise it creates a new hook and returns that.
Parameters:
hookname - the name of the hook to retrieve
           (type=string)
Returns:
the Hook by the name of hookname
           (type=Hook)

get_manager(name)

Retrieves a manager from the engine.
Parameters:
name - the name of the manager to retrieve
           (type=string)
Returns:
the manager instance
           (type=manager.Manager)

get_num_errors()

Returns the total number of errors Lyntin has had thus far.
Returns:
the number of unhandled errors Lyntin has encountered so far
           (type=int)

get_session(name)

Returns a named session or None if the session doesn't exist.
Parameters:
name - the name of the session to retrieve
           (type=string)
Returns:
the session instance or None
           (type=session.Session)

hook_register(hookname, func, place=None)

Registers a function with a hook.
Parameters:
hookname - the name of the hook
           (type=string)
func - the function to register with the hook
           (type=function)
place - the function will get this place in the call order. functions with the same place specified will get arbitrary ordering. defaults to hooks.LAST.
           (type=int)

hook_unregister(hookname, func)

If the hook exists, unregisters the func from the hook.
Parameters:
hookname - the name of the hook
           (type=string)
func - the function to remove from the hook
           (type=function)

lyntin_command(text, internal=0, session=None)

The best way of executing a Lyntin command as if the user had typed it.
Parameters:
text - the command to execute. ex. "#help"
           (type=string)
internal - whether (1) or not (0) to execute the line internally suppressing history and the spamhook.
           (type=boolean)
session - the session instance to execute this command in (defaults to the current session)
           (type=Session)

remove_command(text)

Removes a command from Lyntin.
Parameters:
text - the name of the command to remove
           (type=string)
Returns:
0 if no command was found, 1 if the command was removed successfully
           (type=boolean)

remove_help(fqn)

Removes a help topic from Lyntin.
Parameters:
fqn - a . delmited string of categories ending with a help name
           (type=string)

remove_manager(name)

Removes a manager from the engine.
Parameters:
name - the name of the manager to remove from Lyntin
           (type=string)
Returns:
0 if nothing happened, 1 if the manager was removed
           (type=boolean)

set_current_session(ses)

Changes the current session to another session.
Parameters:
ses - the session instance to set the current session to
           (type=session.Session)

set_num_errors(num)

Sets the number of errors Lyntin has had thus far. Do be careful when setting this because Lyntin keeps track of errors for a reason.
Parameters:
num - the number of errors to set
           (type=int)

tally_error()

This adds one to the current error count and checks to see if we're over our limit. If we are, it enqueues a shutdown event which will shutdown Lyntin.

write_error(text, ses=None)

Calls engine.myengine.writeError which writes ERROR message. If there is no engine instance available, it prints it to sysout.
Parameters:
text - the message to send
           (type=string)
ses - the session instance the error data is associated with
           (type=session.Session)

write_message(text, ses=None)

Calls engine.myengine.writeMessage which writes LTDATA message. If there is no engine instance available, it prints it to sysout.
Parameters:
text - the message to send
           (type=string)
ses - the session instance the error data is associated with
           (type=session.Session)

write_mud_data(text, ses=None)

Calls engine.myengine.writeMudData which writes a MUDDATA message. If there is no engine instance available, it prints it to sysout.
Parameters:
text - the message to send
           (type=string)
ses - the session instance the mud data is associated with
           (type=session.Session)

write_traceback(message='', ses=None)

Convenience method for grabbing the traceback, formatting it, piping it through write_error, with a message for the user.
Parameters:
message - any message you want to pass to the user--this gets printed first
           (type=string)
ses - the session instance the mud data is associated with
           (type=session.Session)

write_ui(text)

Calls engine.myengine.writeUI which writes a message to the ui. If there is no engine instance available, it prints it to sysout.
Parameters:
text - the message to write to the ui
           (type=string or ui.Message)

write_user_data(text, ses=None)

Calls engine.myengine.writeUserData which writes a USERDATA message. If there is no engine instance available, it prints it to sysout.
Parameters:
text - the message to send
           (type=string)
ses - the session instance the user data is associated with
           (type=session.Session)

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