Roxen.git / server / plugins / protocols / prot_hilfe.pike

version» Context lines:

Roxen.git/server/plugins/protocols/prot_hilfe.pike:1: - // This is a roxen protocol module. + // This is a ChiliMoon protocol module.   // Copyright © 2001, Roxen IS.      inherit Protocol;   constant supports_ipless = 0;   constant name = "hilfe";   constant prot_name = "telnet";   constant requesthandlerfile = "plugins/protocols/hilfe.pike";   constant default_port = 2345;      class Connection
Roxen.git/server/plugins/protocols/prot_hilfe.pike:204:    rl->readline->write( sprintf("Request for %s in %O from %s\n",    id->not_query, id->conf, id->remoteaddr),1);    })    {    id->conf->pri[4]->first_modules -= ({ this_object() });    id->conf->invalidate_cache();    }    }    }    -  mixed hilfe_debug( string what ) -  { -  if( !stringp( what ) ) -  error("Syntex: debug(\"what\");"); -  switch( what ) -  { +  class CommandDebug { +  inherit Tools.Hilfe.Command; +  string help(string what) { return "Debug ChiliMoon"; } +  +  void exec(Tools.Hilfe.Evaluator e, string line, array(string) words, +  array(string) tokens) { +  if(sizeof(words)!=2) { +  e->safe_write(help("")+"\n"); +  return; +  } +  +  switch( words[1] ) {    case "accesses":    foreach( roxen->configurations, Configuration c ) -  if( c->inited ) -  { +  if( c->inited ) {    c->pri[4]->first_modules += ({ InsinuateFirst() });    c->invalidate_cache();    } -  +  e->safe_write("Access debug started\n");    break;       default: -  error("Don't know how to debug "+what+"\n"); +  e->safe_write(help("")+"\n");    }    } -  +  }    -  +  class CommandExit { +  inherit Tools.Hilfe.Command; +  string help(string what) { return "Exit Hilfe."; } +  +  void exec(Tools.Hilfe.Evaluator e, string line, array(string) words, +  array(string) tokens) { +  begone(); +  } +  } +     class Handler {    inherit Tools.Hilfe.Evaluator;       void got_data( string d )    { -  +  replace(d, "\r", "\n"); +  sscanf(d, "%s\n", d);    add_input_line( d ); -  +  if(catch(state)) return;    write( state->finishedp() ? "> " : ">> " );    user->settings->set("hilfe_history",    rl->readline->get_history()->encode());    user->settings->save();    }    -  class CommandExit { -  inherit Tools.Hilfe.Command; -  string help(string what) { return "Exit Hilfe."; } -  -  void exec(Tools.Hilfe.Evaluator e, string line, array(string) words, -  array(string) tokens) { -  begone(); -  } -  } -  +     void create()    {    ::create();    write = lambda(string ... in) { rl->readline->write(sprintf(@in)); };    commands->exit = CommandExit();    commands->quit = commands->exit; -  +  commands->debug = CommandDebug();    constants["RequestID"] = myRequestID;    constants["conf"] = my_conf;    constants["port"] = my_port_obj;    constants["user"] = user; -  constants["debug"] = hilfe_debug; +     user->settings->defvar( "hilfe_history", Variable.String("", 65535,0,0 ) );    user->settings->restore( );    string hi;    if( (hi = user->settings->query("hilfe_history")) != "" )    rl->readline->get_history()->create( 512, hi/"\n" );    rl->readline->get_history()->finishline("");    print_version();    got_data("");    }    }
Roxen.git/server/plugins/protocols/prot_hilfe.pike:365:       void write_more()    {    }       int n;    static void init2( )    {    if( rl->readline )    { -  rl->readline->write("Welcome to Roxen Hilfe 1.1\n", 1); +  rl->readline->write("Welcome to ChiliMoon Hilfe 1.2\n", 1);    rl->readline->write("Username: ");    return;    }    n++;    if( n < 100 )    call_out( init2, 0.1 );    else    {    rl->message("Failed to set up terminal.\n");    begone();