Method code for $guest.request_cmd()

[Turn on line numbering]
arg @args;
var msg, ans, utypes, line, mail;

(> .perms(caller(), 'command) <);

// hardcoded questions for now--should eventually drop this in a
// configurable 'schema' dict somewhere --Brandon
.tell(["", "*" * .linelen()]);
.tell([">> This is the new-user request system.  You will be asked a few questions", ">> at this time.  Please answer to the best of your ability."]);
.tell(["*" * .linelen(), ""]);
msg = ["Email:".pad(22) + .user_info("email")];
line = "Read Tutorial:".pad(22);
ans = (> .prompt(">> Have you read the Introductory Tutorial? [no] ") <);
if (!ans || ans.is_boolean() < 1) {
    line += "no";
    .tell(["", ">> We suggest you take some time afterwards and enter the Introductory", ">> Tutorial.  To do so, just type: @tutorial", ""]);
} else {
    .tell("");
    line += "yes";
}
msg += [line];
line = "Heard about us from: ".pad(22);
ans = "";
while (ans == "") {
    ans = (> .prompt(">> Where did you hear about " + $motd.server_name() + "? ") <);
    ans = strsed(ans, "^ +", "");
}
msg += (line + ans).wrap_lines(.linelen(), " " * 22);
.tell("");
line = "Interest is with: ".pad(22);
ans = "";
while (ans == "") {
    ans = (> .prompt(">> What is your reason for requesting a user? ") <);
    ans = strsed(ans, "^ +", "");
}
msg += (line + ans).wrap_lines(.linelen(), " " * 22);
line = "User type: ".pad(22);
ans = "";
.tell("");
utypes = ["User", "Builder", "Programmer"];
while (!(ans in utypes)) {
    ans = (> .prompt([">> Available user types:"] + utypes.prefix(">>    ") + [">> Which of the above user types are you most interested in:"]) <);
    ans = ans.strip();
}
msg += [line + ans];
.tell("");
if (ans == "Programmer") {
    ans = (> .prompt([">> By asking for Programmer permissions, do you agree never to exploit", ">> any problem or security hole which may be found by yourself or others,", ">> and to reveal any problems to the appropriate administration as soon", ">> as possible? [yes] "]) <);
    line = "Will not exploit:".pad(22);
    ans = ans.is_boolean();
    if (ans == 1)
        msg += [line + "yes"];
    else if (ans == 0)
        msg += [line + "no"];
    else
        return "Invalid response.  Try the command again, and enter \"yes\" or \"no\" in response to the question.";
}
mail = $mail_message.new_mail();
mail.set_subject("New User Request for: " + .name());
mail.set_text(msg);
catch any
    mail.send($mail_admin);
with
    return traceback()[1][2];
return ["New User Request Sent as:"] + msg;

// $#Edited: 18 Jun 98 00:18 $brandon
// $#Edited: 23 Sep 99 22:14 $brian

["// Created 26-Mar-1995 as a part of ColdCore, see: @help Credit"]

the Cold Dark