parent $connection_interfaces
object $login_interface
var $root dbref 'login_interface
var $root child_index 1417
var $root fertile 1
var $root manager $login_interface
var $root owned [$login_interface]
var $root owners [$login_interface]
var $root writable []
var $root readable ['parameters, 'methods, 'code]
var $has_commands commands [["@quit|QUIT", 'quit_cmd], ["connect guest *", 'connect_guest_cmd], ["connect *", 'connect_cmd], ["@who|WHO", 'who_cmd], ["m?otd", 'motd_cmd], ["h?elp", 'help_cmd], ["@create|CREATE *", 'create_cmd]]
var $has_commands shortcuts []
var $root inited 1
var $old_command_environment verb_cache #[]
var $old_command_environment command_cache []
var $old_command_environment shortcuts_cache []
method connect_cmd
arg cmd, args;
var syn, stderr, passwd, name, user;
(> .perms(sender(), 'this) <);
syn = cmd + " <name> <pass>";
stderr = "Either that user does not exist or has a different password.";
// parse the args
args = explode(args);
if (listlen(args) < 2)
$parse.tell_error("Last word is taken as the password.", syn);
passwd = args[listlen(args)];
name = $list.to_string(sublist(args, 1, listlen(args) - 1));
// find the user
catch ~namenf {
user = $user_db.find(name);
} with handler {
$parse.tell_error(stderr, syn);
}
// validate the password
if (!(user.check_password(passwd)))
$parse.tell_error(stderr, syn);
// log the user in
.login_user(user);
.
method create_cmd
arg cmd, args;
var syn, msg, user, sys_email;
(> .perms(sender(), 'this) <);
syn = cmd + " <name> <password> <email@host>";
sys_email = $sys.get_system_email('login);
// Get user name, password, and email.
args = explode(args);
if (listlen(args) != 3)
$parse.tell_error("", syn);
// Create a new user object.
catch any {
user = $sys.create_user(args[1], args[2], args[3]);
} with handler {
switch (error()) {
case ~duplicate:
msg = ("The user " + toliteral(args[1])) + " already exists.";
default:
msg = ["There was a problem creating you:"];
msg = [@msg, (traceback()[1])[2]];
msg = [@msg, "If there is a problem contact: " + sys_email];
}
if (user)
(| user.destroy() |);
$login_log.log(traceback());
$parse.tell_error(msg, syn);
}
// Log the user in.
.login_user(user);
.
method quit_cmd
arg cmd;
(> .perms(sender(), 'this) <);
.send("Goodbye.");
return 'disconnect;
.
method connect_guest_cmd
arg cmd, guest, args;
var syn, msg, email, name, result, sys_email, user;
(> .perms(sender(), 'this) <);
syn = ((cmd + " ") + guest) + " <name> <email>";
sys_email = $sys.get_system_email('login);
// Get user name and password.
args = explode(args);
if (listlen(args) < 2)
$parse.tell_error("", syn);
name = $list.to_string(sublist(args, 1, listlen(args) - 1));
email = args[listlen(args)];
if ($sys.validate_email_addresses())
result = $code.valid_email(email);
if ((result[1]) != 'valid) {
switch (result[1]) {
case 'invalid:
msg = ["The given email address is not a legitimate address."];
msg = [@msg, "Specify both username and hostname (do not use brackets)."];
$parse.tell_error(msg, syn);
case 'invip, 'invhostname:
$channels.announce('System, ((((("Invalid Connection Email: " + email) + " <") + ((.connection()).address())) + "> (") + name) + ")");
.tell(("Syntax: `" + syn) + "`");
.tell($string.wrap_line(((("The hostname \"" + (result[3])) + "\" is invalid, (you are connecting from \"") + ((.connection()).address())) + "\", but this may not be your email host). The server is not currently locking out invalid email addresses, although your connection has been noted (We do realize that some hosts may not function normally).", 79, "! ", 1));
}
}
catch any {
user = $sys.create_user(name, 0, email, 'anonymous_user_class);
} with handler {
$login_log.log("User creation ($login_interface.connect_guest_cmd):");
$login_log.log($parse.traceback(traceback()));
switch (error()) {
case ~duplicate:
msg = ("The name " + toliteral(words[1])) + " is already in use.";
default:
msg = "There was a problem creating you:";
msg = [msg, " => " + ((traceback()[1])[2])];
msg = [@msg, "If there is a problem contact: " + sys_email];
}
$parse.tell_error(msg, syn);
}
// Log the user in.
.login_user(user);
.
method who_cmd
arg com;
(> .perms(sender(), 'this) <);
.send($code.generate_listing($user_db.connected()));
.
method help_cmd
arg com;
(> .perms(sender(), 'this) <);
.send($motd.connect_help());
.
method null_cmd
arg null;
return (> .invalid_cmd(null) <);
.
method invalid_cmd
arg null;
var x, line, c;
(> .perms(sender(), 'this) <);
line = [];
for x in (.command_cache())
line = [@line, (x[1]).parse_template()];
line = "Try: " + (line.to_english("", " or "));
.send(line);
.
method login_user
arg user;
var c;
(> .perms(sender(), 'this) <);
(.connection()).change_interface_object(user);
.
method motd
var out;
out = [$motd.build('default), ""];
out = [@out, " ** Use 'H?elp' for a list of commands **".center(79), ""];
return out;
.
method motd_cmd
arg cmd;
(> .perms(sender(), 'this) <);
.send(.motd());
.
method connection_starting
(> .perms(caller(), $connection) <);
.send(.motd());
.