# multiple line input via :do_login_command

ThwartedEfforts (abakun@scinc.com)
Fri, 2 Aug 1996 10:07:00 PDT

- Messages sorted by:[ date ][ thread ][ subject ][ author ]

    >If you _do_ want to log in an FTP connection (and to be
    >honest, I am now not so sure it's a good idea) then :do_login_command()
    >must perform one or more read()s to get the user's reply to the PASS line.

    You make it sound like it's impossible.  Make it simple and sweet.  Here is
    code.  I make no guarntees.  Enjoy. (excuse my assoc-list style)

    @prop #0.input_lines {{}, {}}
    @program #0:do_login_command
    loc = player in this.input_lines[1];
    if (!loc)
      this.input_lines[1] = {@this.input_lines[1], player};
      this.input_lines[2] = {@this.input_lines[2], {}};
      loc = length(this.input_lines[1]);
    endif
    if (argstr != "LOG ME IN")
      buffer = this.input_lines[2][loc];
      buffer = {@buffer, argstr};
      this.input_lines[2][loc] = buffer;
    else
      what_they_entered = this.input_lines[2][loc];
      this.input_lines[1][loc..loc] = {};
      this.input_lines[2][loc..loc] = {};
      who_they_are = this:figure_out_who_they_are(what_they_entered);
      return who_they_are;
    endif
    return 0;

    Voila.  To get the 'reply to the PASS line', you'd have to expand on it a
    little more to make it a finite state machine, probally in
    :figure_out_who_they_are, which would return 0 if it still needed more input
    or the object number to log them in as.  Abstracting "LOG ME IN" to a prop
    that could be changed lets :figure_out_who_they_are change it to make
    :do_login_command wait for a different ending line.

    >I hope that makes more sense now!  :)  As I said, logging in FTP
    >connections may not be such a hot idea, but logging in HTTP connections,
    >that's more desirable.  Plus "connect_player()" would be very useful for
    >linked MOOs and multiprocessor MOOs, as I mentioned before.

    I think it makes more sense to login in FTP connections rather than HTTP.  I
    don't see how you can use HTTP for a live connection once the user is logged
    in.  HTTP is stateless.  What are you going to do with the now logged in
    HTTP connection that can't be done by just having it be unconnected, only
    communicating with it through :do_login_command and notify()?

    Having a connect_player() function would be cool, but for reasons of design,
    not because of (non-)blocking reads.

    Andy.