def killall_cmd(ses, args, input): """ Clears all sessions of session oriented stuff: aliases, substitutions, gags, variables, so on so forth. category: commands """ for mem in exported.get_active_sessions(): mem.clear() exported.write_message("killall: session %s cleared." % mem.getName())
def unload(): """ Unloads the module by calling any unload/unbind functions.""" global sm modutils.unload_commands(commands_dict.keys()) exported.remove_manager("speedwalk") exported.hook_unregister("user_filter_hook", sm.userfilter) exported.hook_unregister("write_hook", sm.persist) # remove configuration items for every session involved for mem in exported.get_active_sessions(): exported.remove_config("speedwalk", mem)
def unload(): """ Unloads the module by calling any unload/unbind functions.""" global sm modutils.unload_commands(commands_dict.keys()) exported.remove_manager("substitute") exported.hook_unregister("mud_filter_hook", sm.mudfilter) exported.hook_unregister("write_hook", sm.persist) # remove configuration items for every session involved for mem in exported.get_active_sessions(): exported.remove_config("ignoresubs", mem)
def unload(): """ Unloads the module by calling any unload/unbind functions.""" global am, var_module modutils.unload_commands(commands_dict.keys()) exported.remove_manager("alias") exported.hook_unregister("mud_filter_hook", am.mudfilter) exported.hook_unregister("write_hook", am.persist) exported.hook_unregister("variable_change_hook", am.variableChange) # remove configuration items for every session involved for mem in exported.get_active_sessions(): exported.remove_config("ignoreactions", mem)
def load(): """ Initializes the module by binding all the commands.""" global sm modutils.load_commands(commands_dict) sm = SpeedwalkManager() exported.add_manager("speedwalk", sm) exported.hook_register("user_filter_hook", sm.userfilter, 80) exported.hook_register("write_hook", sm.persist) from lyntin import config for mem in exported.get_active_sessions(): tc = config.BoolConfig("speedwalk", 1, 1, "Allows you to turn on and turn off speedwalk handling.") exported.add_config("speedwalk", tc, mem)
def load(): """ Initializes the module by binding all the commands.""" global sm modutils.load_commands(commands_dict) sm = SubstituteManager() exported.add_manager("substitute", sm) exported.hook_register("mud_filter_hook", sm.mudfilter, 50) exported.hook_register("write_hook", sm.persist) from lyntin import config for mem in exported.get_active_sessions(): tc = config.BoolConfig("ignoresubs", 0, 1, "Allows you to turn on and turn off substitutions.") exported.add_config("ignoresubs", tc, mem)
def load(): """ Initializes the module by binding all the commands.""" global am, var_module modutils.load_commands(commands_dict) am = ActionManager() exported.add_manager("action", am) exported.hook_register("mud_filter_hook", am.mudfilter, 75) exported.hook_register("write_hook", am.persist) exported.hook_register("variable_change_hook", am.variableChange) from lyntin import config for mem in exported.get_active_sessions(): # we need a separate BoolConfig for each session tc = config.BoolConfig("ignoreactions", 0, 1, "Allows you to turn off action handling.") exported.add_config("ignoreactions", tc, mem)
def session_cmd(ses, args, input): """ This command creates a connection to a specific mud. When you create a session, that session becomes the active Lyntin session. To create a session to 3k.org named "3k": #session 3k www.3k.org 5000 To create a session and initialize it with commands from a specific file: #session 3k www.3k.org 5000 /home/david/3k/3k.lyntin Then to create another session to another mud: #session eto gytje.pvv.unit.no 4000 Then if 3k was your active session, you could do things on the eto session by prepending your command with "#eto ": #eto say hello or switch to the eto session by typing just "#eto". category: commands """ name = args["sessionname"] host = args["host"] port = args["port"] filename = args["filename"] if not name and not host and (not port or port == -1): data = "Sessions available:\n" for mem in exported.get_active_sessions(): data += " %s: %r\n" % (mem.getName(), mem._socket) exported.write_message(data[:-1]) return if not name or not host or port == -1: exported.write_error("syntax: #session <sesname> <host> <port>") return if name.isdigit(): exported.write_error("session: session name cannot be all numbers.") return e = exported.myengine ses = e.getSession(name) if ses != None: preexistingsession = 1 else: preexistingsession = 0 if preexistingsession == 1 and ses.isConnected(): exported.write_error("session: session of that name already exists.") return try: # create and register a session for this connection.... if ses == None: ses = e.createSession(name) sock = net.SocketCommunicator(e, ses, host, port) ses.setSocketCommunicator(sock) ses._host = host ses._port = port e.changeSession(name) # connect to the mud... # this might take a while--we block here until this is done. sock.connect(host, port, name) # start the network thread e.startthread("network", sock.run) except: exported.write_traceback("session: had problems creating the session.") ses.setSocketCommunicator(None) if preexistingsession == 0: try: e.unregisterSession(ses) except: pass try: e.closeSession(name) except: pass # populate the session using the specified file if filename: read_cmd(ses, args, '')