patch
./upgradedb-3.0.1999-08-28/files/patch · 302.7 KB
From the archive upgradedb-3.0.1999-08-28.tar.gz
Download the archive « Back to the archive contents
new obj
Inserting httpd_ui.cdc...
new object $httpd_ui: $user_interfaces;
var $root manager = $httpd_ui;
var $command_cache modules = [];
var $root flags = ['variables, 'methods, 'code, 'core, 'general_cache];
var $root created_on = 887523264;
var $dmi_data descriptions = #[];
var $has_commands shortcuts = #[];
var $has_commands remote = #[];
var $has_commands local = #[["@list-entries", [["@list-entries", "on *", "@list-entries on <descendant of $directories>", 'list_entries_cmd, #[[2, ['descendant, [$directories]]]]]]], ["@add-entry", [["@add-entry", "* to *", "@add-entry <any:+t?arget> to <descendant of $directories>", 'add_entry_cmd, #[[1, ['any_opt, ["t?arget"]]], [3, ['descendant, [$directories]]]]]]], ["@del-entry", [["@del-entry", "* from *", "@del-entry <any> from <descendant of $directories>", 'del_entry_cmd, #[[1, ['any, []]], [3, ['descendant, [$directories]]]]]]]];
var $root inited = 1;
var $root managed = [$httpd_ui];
var $root credit = ["Bruce Mitchener, Jr <bruce@puremagic.com>"];
public method .list_entries_cmd() {
arg cmd, cmdstr, prep, directory;
var output, x;
output = map x in (directory.entries()) to ($cml_lib.format_tr_tag($cml_lib.format_td_tag(x[1]), $cml_lib.format_td_tag(x[2])));
return $ctext_frob.new_with([("Directory entries for " + directory) + ":", $cml_lib.format_table_tag("25%,75%", @output), $cml_lib.format_sep_tag()]);
};
public method .add_entry_cmd() {
arg cmd, cmdstr, @args;
var name, opt, prep, directory, target;
[[[name], [opt]], prep, directory] = args;
if ((opt.length()) != 4)
return "You must specify the target object via +target.";
target = opt[4];
if (!(target = (| $object_lib.to_dbref(target) |)))
return "The target must be a valid object.";
if (!(target.is($page)))
return "The target must be a descendant of $page.";
directory.add_entry(name, target);
return;
};
public method .del_entry_cmd() {
arg cmd, cmdstr, @args;
var name, prep, directory;
[name, prep, directory] = args;
catch ~keynf {
directory.del_entry(name);
sender().tell(((("Entry, '" + name) + "', removed from ") + directory) + ".");
} with {
sender().tell(((("Entry, '" + name) + "', was not an entry on ") + directory) + ".");
}
return;
};
new obj
Inserting help_obj_float.cdc...
new object $help_obj_float: $help_obj;
var $root manager = $help_obj_float;
var $help_node index = $help_index_objects;
var $root flags = ['variables, 'methods, 'code, 'core];
var $root created_on = 910069163;
var $dmi_data descriptions = #[];
var $has_name name = ['prop, "Float", "Float"];
var $help_node links = #[];
var $help_node body = <$ctext_frob, [[<$format, ["dl", [["ind", "8"]], [<$format, ["dt", [], [".", <$format, ["method", [["float.ceiling", 1]], ["ceiling"], 'do_method]>, "(", <$format, ["var", [], ["float"], 'do_var]>, ")"], 'do_dt]>, <$format, ["dd", [], ["This method calculates the ceiling of the floating point value. The ceiling is the next largest integer, so the ceiling of 5.4 is 6.0."], 'do_dd]>, <$format, ["dt", [], [".", <$format, ["method", [["float.floor", 1]], ["floor"], 'do_method]>, "(", <$format, ["var", [], ["float"], 'do_var]>, ")"], 'do_dt]>, <$format, ["dd", [], ["This method calculates the floor of the floating point value ", <$format, ["var", [], ["float"], 'do_var]>, ". The floor is the next smallest integer, so the floor of 5.4 is 5.0."], 'do_dd]>, <$format, ["dt", [], [".", <$format, ["method", [["float.round", 1]], ["round"], 'do_method]>, "(", <$format, ["var", [], ["float"], 'do_var]>, ")"], 'do_dt]>, <$format, ["dd", [], ["This method returns the rounded off value of ", <$format, ["var", [], ["float"], 'do_var]>, " to the nearest integral value."], 'do_dd]>, <$format, ["dt", [], [".", <$format, ["method", [["float.round_to", 1]], ["round_to"], 'do_method]>, "(", <$format, ["var", [], ["float"], 'do_var]>, ", ", <$format, ["var", [], ["places"], 'do_var]>, ")"], 'do_dt]>, <$format, ["dd", [], ["This method rounds the value ", <$format, ["var", [], ["float"], 'do_var]>, " off to the given number of places as specified by the argument ", <$format, ["var", [], ["places"], 'do_var]>, "."], 'do_dd]>, <$format, ["dt", [], [".", <$format, ["method", [["float.fractional_part", 1]], ["fractional_part"], 'do_method]>, "(", <$format, ["var", [], ["float"], 'do_var]>, ")"], 'do_dt]>, <$format, ["dd", [], ["This method returns the fractional part of a floating point value. The result for 1.234 would be 0.234. The value will always be positive."], 'do_dd]>, <$format, ["dt", [], [".", <$format, ["method", [["float.to_integer", 1]], ["to_integer"], 'do_method]>, "(", <$format, ["var", [], ["float"], 'do_var]>, ")"], 'do_dt]>, <$format, ["dd", [], ["This method returns the integral value of a floating point number."], 'do_dd]>, <$format, ["dt", [], [".", <$format, ["method", [["float.log", 1]], ["log"], 'do_method]>, "(", <$format, ["var", [], ["base"], 'do_var]>, ", ", <$format, ["var", [], ["value"], 'do_var]>, ")"], 'do_dt]>, <$format, ["dd", [], ["Given a base, ", <$format, ["var", [], ["base"], 'do_var]>, ", and a value, ", <$format, ["var", [], ["value"], 'do_var]>, ", this method returns the log of the value in the given base."], 'do_dd]>], 'do_dl]>], #[]]>;
var $root inited = 1;
var $root managed = [$help_obj_float];
new obj
Inserting float.cdc...
new object $float: $libraries;
var $root manager = $float;
var $float powers_of_ten = [10.0, 100.0, 1000.0, 10000.0, 100000.0, 1e+06];
var $root flags = ['variables, 'methods, 'code, 'core];
var $root created_on = 909982362;
var $dmi_data descriptions = #[];
var $root inited = 1;
var $root help_node = $help_obj_float;
var $root managed = [$float];
public method .floor() {
arg float;
return tofloat(toint(float));
};
public method .ceiling() {
arg float;
return tofloat(toint(float) + 1);
};
public method .round() {
arg float;
return round(float);
};
public method .round_to() {
arg float, places;
var place_value;
if ((places < 1) || (places > 6))
throw(~range, "Second argument must between 1 and 6.");
place_value = powers_of_ten[places];
return round(float * place_value) / place_value;
};
public method .to_integer() {
arg float;
return toint(float);
};
public method .log() {
arg base, value;
return log(value) / log(base);
};
public method .fractional_part() {
arg float;
return abs(float - toint(float));
};
new obj
Inserting systrust_group.cdc...
new object $systrust_group: $core_group;
var $root manager = $systrust_group;
var $root flags = ['variables, 'methods, 'code, 'core];
var $root created_on = 913800511;
var $group group = #[[$scheduler, 1], [$directories, 1]];
var $root inited = 1;
var $root managed = [$systrust_group];
maintenance
public method $root.__upgrade_handle_var() {
arg handle, vref, old, current, new;
if (current != old) {
// if (handle == 1) {
if (type(old) != type(current)) {
dblog("ERROR: datatype inconsistency for " + vref +
" " + type(old) + " != " + type(current));
}
switch (type(current)) {
case 'dictionary:
return dict_union(new, current);
case 'list:
return union(new, current);
default:
return new;
}
// }
}
return new;
};
update objvar
Updating objvar $root<$root>,managed
object $root;
var $root managed = [];
old method
Deleting normal method $root.new_descendants()
object $root;
eval {
del_method('new_descendants);
};
method flags
Changing method $root.list_method() flags from to nooverride
object $root;
eval {
var l;
dblog("set_method_flags('list_method, 'public");
catch any {
set_method_flags('list_method, ['nooverride ]);
} with {
for l in ($parse_lib.traceback(traceback()))
dblog(l);
}
};
new method
Replacing public method $root.trusts(): nooverride
public method $root.trusts(): nooverride {
arg obj;
var o;
for o in (.trusted()) {
if (o.has_ancestor($group)) {
if (o.includes(obj))
return 1;
} else if (o == obj) {
return 1;
}
}
return ($systrust_group.includes(obj)) || ($sys.is_system(obj));
};
new method
Replacing public method $root.del_var(): nooverride
public method $root.del_var(): nooverride {
arg name;
var n, obj, errs;
(caller() == definer()) || (> .perms(sender()) <);
(> $sys.touch() <);
// try and clear the variable on all of the descendants, before
// deleting the variable...since we are root, dont use the standard
// hooks as perms may not be right
n = tosym("_dclear_var_" + tostr(time()));
catch any {
add_method([("clear_var('" + name) + ");"], n);
for obj in (.descendants()) {
(| obj.(n)() |);
pause();
}
}
(| del_method(n) |);
// now delete the variable
(> del_var(name) <);
if ('core in (.flags()))
$changelog.log((((("DEL-VAR: " + this()) + ",") + name) + " by ") + sender());
};
new method
Replacing public method $root.ancestry(): nooverride
public method $root.ancestry(): nooverride {
arg gen;
var i, out;
out = [];
if (type(gen) == 'objnum) {
for i in (.ancestors()) {
if (i.has_ancestor(gen))
out += [i];
}
return out;
}
if (gen != 0) {
for i in (.parents())
out = union(out, i.ancestry(gen - 1));
}
return out;
};
new method
Replacing public method $root.initialize(): nooverride
public method $root.initialize(): nooverride {
var ancestors, pos, len, method, a, def, str, tb;
// called by $sys.create() to create a new object.
if ((caller() != $sys) && (sender() != this()))
throw(~perm, "Caller is not $sys and sender is not this.");
if (inited)
throw(~perm, "Already initialized.");
ancestors = ancestors().reverse();
for a in (ancestors) {
refresh();
if (!(method = (| tosym("init_" + tostr(a.objname())) |)))
continue;
if ((def = (| find_method(method) |))) {
if (def != a) {
(| (def.manager()).tell(((("Initialization method for " + a) + " in wrong place (") + find_method(method)) + ")") |);
} else {
catch any {
.(method)();
} with {
// try and let somebody know they made a boo-boo somewhere
str = ((("UNINIT ERROR " + this()) + "<") + def) + ">:";
tb = traceback().fmt_tb();
if (def) {
(| (def.manager()).tell(str) |);
(| (def.manager()).tell(tb) |);
}
if ((.manager()) != sender()) {
(| sender().tell(str) |);
(| sender().tell(tb) |);
}
(| sender().tell("Continuing init..") |);
(| $sys.log_traceback(tb, "** " + str) |);
}
}
}
}
inited = 1;
};
new method
Adding root method $root.pass_test()
root method $root.pass_test() {
return "YYYYYYY";
};
new method
Replacing public method $root.debug()
public method $root.debug() {
arg @stuff;
var x, line, mngr, meth, stack, out, ref;
stack = stack();
meth = (| (((stack[2])[3]) + "() line ") + ((stack[2])[4]) |);
// dont even bother
mngr = .manager();
if (!(| mngr.find_method('tell) |))
return;
if (sender() != caller())
ref = ((sender() + "<") + caller()) + ">";
else
ref = sender();
if (meth)
line = ((("DEBUG " + ref) + ".") + meth) + ":";
else
line = ("DEBUG " + ref) + ":";
mngr.tell(line);
for x in (stuff) {
refresh();
mngr.tell(($data_lib.unparse_indent(x)).prefix("DEBUG "));
}
};
new method
Replacing public method $root.is_writable_by(): nooverride
public method $root.is_writable_by(): nooverride {
arg obj;
var o;
for o in (.writers()) {
if (o.has_ancestor($group)) {
if (o.includes(obj))
return 1;
} else if (o == obj) {
return 1;
}
}
return $sys.is_system(obj);
// return (| obj in .writers() |) || $sys.is_system(obj);
};
new method
Replacing public method $root.generations(): nooverride
public method $root.generations(): nooverride {
arg gen;
var p, out;
out = [this()];
if (gen != 0) {
for p in (.parents())
out = union(out, p.generations(gen - 1));
}
return out;
};
new method
Replacing root method $root.change_parents(): nooverride
root method $root.change_parents(): nooverride {
arg parents;
var old_a, old_p, a, obj, new_a, definer, branch, method, str;
if (!parents)
throw(~noparents, "Objects must have at least 1 parent");
// remember a few things
old_a = setremove(ancestors(), this());
old_p = .parents();
branch = (.descendants()) + [this()];
// build the new ancestors list by hand, so we can figure out what is
// changing, and uninitialize those ancestors that are going away
new_a = [];
for obj in (parents)
new_a = union(new_a, obj.ancestors());
// uninit any ancestors going away
for a in (old_a.set_difference(new_a)) {
// call this ancestor's uninit on the obj and all its children
method = tosym("uninit_" + (a.objname()));
if ((definer = (| find_method(method) |))) {
if (definer != a) {
// scream madly and run around--everybody should know this
str = "UNINIT ERROR: uninit method for " + a;
str += (" in wrong place (" + definer) + ")";
(| (definer.manager()).tell(str) |);
(| (a.manager()).tell(str) |);
(| sender().tell(str) |);
continue;
}
// call the uninit method on this object only
catch any {
.(method)();
} with {
// try and let somebody know they made a boo-boo somewhere
str = ((("UNINIT ERROR " + obj) + "<") + this()) + ">:";
(| (.manager()).tell(str) |);
(| (.manager()).tell_traceback(traceback()) |);
(| sender().tell(str) |);
(| sender().tell_traceback(traceback()) |);
(| sender().tell("Continuing chparent..") |);
}
}
// cleanup any old obj vars left lying around
// if (branch)
// $sys.clear_definer_vars(a, branch);
$sys.clear_definer_vars(a, [this()]);
refresh();
}
// make the change
(> chparents(parents) <);
if ('core in (.flags()))
$changelog.log(((((("CHANGE-PARENTS: " + this()) + " from ") + old_p) + " to ") + parents()) + " by ");
new_a = setremove(ancestors(), this());
// init anybody new to the family
for a in (new_a.set_difference(old_a)) {
method = tosym("init_" + (a.objname()));
if ((definer = (| find_method(method) |))) {
if (definer != a) {
// scream madly and run around--everybody should know this
// (damn inlaws, can't ever get things right)
str = "INIT ERROR: uninit method for " + a;
str += (" in wrong place (" + definer) + ")";
(| (definer.manager()).tell(str) |);
(| (a.manager()).tell(str) |);
(| sender().tell(str) |);
continue;
}
// introduce the new ancestor
catch any {
.(method)();
} with {
// try and let somebody know they made a boo-boo somewhere
str = ((("INIT ERROR " + obj) + "<") + this()) + ">:";
(| (.manager()).tell(str) |);
(| (.manager()).tell_traceback(traceback()) |);
(| sender().tell(str) |);
(| sender().tell_traceback(traceback()) |);
(| sender().tell("Continuing chparent..") |);
}
}
refresh();
}
};
update objvar
Updating objvar $sys<$sys>,core_version
object $sys;
var $sys core_version = "3.0.1999-08-28";
old method
Deleting normal method $sys.backup()
object $sys;
eval {
del_method('backup);
};
new method
Replacing public method $sys.touch()
public method $sys.touch() {
arg @nocorelock;
if ((!nocorelock) && ((sender().has_flag('core)) && (!writable_core)))
throw(~perm, sender() + " is a core object, and the core isn't writable. '@set $sys:writable-core = yes' to allow this.");
touched = time();
};
new method
Replacing public method $sys.configure_core()
public method $sys.configure_core() {
var list, l, x, t, err, s;
if (caller() != $admin)
(> .perms(sender()) <);
s = sender();
// if there is nothing left to config, leave..
if (configured) {
if (!(list = config_set.set_difference(configured.keys())))
return;
} else {
configured = #[];
}
.add_to_system(s);
// wait for other things to finish printing messages to them
pause();
pause();
// expand on this as we go
s.tell(["*" * 78, strfmt("%78{*}c", " Welcome to ColdCore "), "*" * 78]);
s.tell(("This is an interactive configuration system which any admin who connects (until it is completed) is sent through. You must complete this configuration before you can do anything else. You can skip a specific question at any time by typing '@skip'. Suggested default values will be enclosed in square brackets. Pressing enter without any value will use the default value.".wrap_lines(78)).mmap('center, 78));
s.tell("*" * 78);
// first question please
if (!(configured.contains('new_user_class))) {
s.tell("What class should new users be created as? Available classes:");
list = filter x in ($user.descendants()) where (('general_cache in (x.flags())) && (x != $guest));
t = .get_new_user_class();
list = map x in (list) to ((list == t) ? (x + " (current class)") : x);
s.tell(list.prefix(" "));
while (!l) {
refresh();
l = (> s.prompt(("New User Class [" + t) + "] ") <);
if (l == "@skip") {
s.tell("Skipping..");
break;
}
if (l) {
catch any {
l = $object_lib.to_dbref(l);
if (!(l in list))
s.tell("Invalid selection, try again.");
} with {
s.tell(("Invalid selection '" + l) + "'");
continue;
}
} else {
l = t;
}
.set_setting("new-user-class", $sys, l);
configured = configured.add('new_user_class, 1);
s.tell("New User Class set to: " + l);
}
s.tell(["", "You can set this at any time, with the command:"]);
s.tell(" @set $sys:new-user-class=" + l);
}
refresh();
// server name/title
if (!(configured.contains('server_name))) {
s.tell(["", "---"]);
t = $motd.server_name();
l = (> s.prompt(("What is your server name? [" + t) + "] ") <) || t;
if (l == "@skip") {
s.tell("Skipping..");
} else {
$motd.set_setting("server-name", $motd, l);
configured = configured.add('server_name, 1);
s.tell("Server name set to: " + l);
}
s.tell(["", "You can set this at any time, with the command:"]);
s.tell(" @set $motd:server-name=" + l);
}
refresh();
if (!(configured.contains('server_title))) {
s.tell(["", "---"]);
t = $motd.server_title();
l = (> s.prompt(("What is your server title? [" + t) + "] ") <) || t;
if (l == "@skip") {
s.tell("Skipping..");
} else {
$motd.set_setting("server-title", $motd, l);
configured = configured.add('server_title, 1);
s.tell("Server title set to: " + l);
}
s.tell(["", "You can set this at any time, with the command:"]);
s.tell(" @set $motd:server-title=" + l);
}
refresh();
if (!(configured.contains('daemons))) {
s.tell(["", "---"]);
while (1) {
refresh();
list = ($daemon.children()).setremove($login_daemon);
s.tell("Which network daemons do you want to have automatically startup,");
s.tell("Other than $login_daemon. Available daemons:");
t = filter l in (startup['objects]) where (l.is($daemon));
for l in (list) {
if (l in t)
s.tell(strfmt(" %20s (auto starting)", l));
else
s.tell(" " + l);
}
l = (> s.prompt(("Auto-Start: [" + (t.join(", "))) + "] ") <);
if (l == "@skip") {
s.tell("Skipping..");
break;
} else if (!l) {
s.tell("Using existing daemons: " + (t.join(", ")));
configured = configured.add('daemons, 1);
break;
} else {
err = 0;
for x in (l.explode_english_list()) {
catch any {
.set_setting("startup-objects", $sys, "+" + x);
s.tell(("Added " + x) + " as a startup daemon.");
} with {
s.tell(("Unable to add '" + x) + "' as a daemon:");
s.tell("=> " + ((traceback()[1])[2]));
err++;
}
}
if (!err) {
configured = configured.add('daemons, 1);
break;
}
s.tell("Errors occurred...");
}
}
s.tell(["", "You can set this at any time, with the command:"]);
s.tell(" @set $motd:startup-objects=OBJECTS...");
}
// Other things to add: HTTP Virtual Hosting info,
// Let them know, if they actually saw anything..
s.tell(["", strfmt("%79{*}c", " Configuration Complete ")]);
};
new method
Replacing public method $sys.del_from_system()
public method $sys.del_from_system() {
arg obj;
if (!(.is_admin(sender())))
throw(~perm, "Sender is not an admin.");
if (!((obj in admins) || (obj in agents)))
throw(~perm, "Object is not an agent or admin.");
system = setremove(system, obj);
};
new method
Replacing public method $sys.add_to_system()
public method $sys.add_to_system() {
arg obj;
if (!(.is_admin(sender())))
throw(~perm, "Sender is not an admin.");
if (!((obj in admins) || (obj in agents)))
throw(~perm, "Object is not an agent or admin.");
system = setadd(system, obj);
};
new method
Replacing driver method $sys.startup()
driver method $sys.startup() {
arg args;
var opt, str, obj, f, ver, firsttime, doinit;
set_heartbeat(0);
// clean db?
if ("-clean" in args) {
catch any {
dblog("** Cleaning Database..");
(> .clean_database() <);
dblog("** Done.");
if (dict_contains(startup, 'time))
startup = dict_del(startup, 'time);
} with {
.log($parse_lib.traceback(traceback()));
}
doinit = "-init" in args;
} else {
doinit = ("-init" in args) || (!dict_contains(startup, 'time));
}
// init?
if (doinit) {
catch any {
dblog("** Initializing Database..");
(> .init_database() <);
dblog("** Done.");
} with {
.log($parse_lib.traceback(traceback()));
}
}
// done?
if ("-quit" in args) {
dblog("** Shutting down.");
.shutdown();
return;
}
// make core?
if ((opt = find opt in (args) where (opt.match_begin("-makecore=")))) {
ver = regexp(args[opt], "-MAKECORE=(.*)$")[1];
dblog(("** Calling .make_core(\"" + ver) + "\")..");
.make_core(ver);
return;
}
// Standard startup..
startup = startup.add('time, time());
backup = backup.add('next, time() + (backup['interval]));
// In case we're recovering from a backup
if (dict_contains(backup, 'started))
backup = dict_del(backup, 'started);
catch any {
// get back the heartbeat
set_heartbeat(startup['heartbeat_interval]);
// Bind functions for security
for f in (bindings) {
catch any
bind_function(@f);
with
dblog((("** Unable to bind function " + (f[1])) + "() to ") + (f[2]));
}
// tell objects who should know, that we are online
if (type(args) != 'list)
args = [];
for obj in (startup['objects]) {
.log(("Calling " + obj) + ".startup()");
catch any
(> obj.startup(@args) <);
with
.log($parse_lib.traceback(traceback()));
}
} with {
.log(("** Startup ERROR at " + ctime()) + ":");
.log(toliteral(traceback()));
.log($parse_lib.traceback(traceback(), -1, ""));
}
};
new method
Replacing private method $sys.create()
private method $sys.create() {
arg parents, name, manager;
var new;
new = create(parents);
catch any {
new.initialize();
// niggle the names around... $has_name may have initted the wrong name
new.set_objname(name);
if ((new.has_ancestor($has_name)) && ((new.name()) == ("#" + (new.objnum())))) {
catch ~invname
new.set_name(substr(tostr(new), 2));
}
// let it manage itself
new.change_manager(manager);
} with {
// Failed to initialize the child; destroy it.
$sys.log_traceback(traceback(), ((((("CREATE (" + parents) + ", '") + name) + ", ") + manager) + ")");
(| new.destroy() |);
rethrow(error());
}
return new;
};
new method
Replacing private method $sys.clean_database()
private method $sys.clean_database() {
var obj, p, c, cmd;
// cleanup some of $root's messiness
for obj in ($root.descendants()) {
(| obj.clean_root() |);
refresh();
}
// purge all command caches
for obj in ($command_cache.descendants()) {
(| obj.purge_cache() |);
refresh();
}
// check user info (move'em home etc)
for obj in ($user.descendants()) {
if ((| (obj.home()) != (obj.location()) |))
(| obj.move_to(obj.home()) |);
refresh();
}
// validate all locations and location content's
for obj in ($physical.descendants()) {
(| obj.validate_contents() |);
if (obj.has_ancestor($located)) {
if ((!valid(obj.location())) || (!(obj in ((obj.location()).contents()))))
(| obj.move_to((| obj.home() |) || $lost_and_found) |);
}
refresh();
}
};
new method
Replacing public method $sys.server_info()
public method $sys.server_info() {
arg what, @long;
var tmp;
switch (what) {
case 'up_time:
return time() - (startup['time]);
case 'startup_time:
return startup['time];
case 'server_hostname:
return $dns.hostname("");
case 'server_ip:
return $dns.ip("");
case 'last_backup:
return backup['last];
case 'driver_version:
tmp = .version();
return (((((((long ? "Genesis " : "") + (tmp[1])) + ".") + (tmp[2])) + ".") + (tmp[3])) + "-") + ((listlen(tmp) == 3) ? "NEED TO UPGRADE" : (tmp[4]));
case 'core_version:
return (long ? "ColdCore " : "") + core_version;
case 'version:
tmp = .version();
return ((((((((("Genesis/" + (tmp[1])) + ".") + (tmp[2])) + ".") + (tmp[3])) + "-") + (tmp[4])) + " ") + "ColdCore/") + core_version;
default:
throw(~unknown, "Unknown flag.");
}
};
update objvar
Updating objvar $mutex<$root>,flags
object $mutex;
var $root flags = ['variables, 'methods, 'code, 'core, 'fertile];
add objvar
Adding objvar $dmi_data<$root>,credit
object $dmi_data;
var $root credit = ["Bruce Mitchener, Jr <bruce@puremagic.com>"];
old method
Deleting normal method $dictionary.nunion()
object $dictionary;
eval {
del_method('nunion);
};
new method
Adding public method $buffer.bufsub2()
public method $buffer.bufsub2() {
arg buf, a, b;
var i, la, lb, lt;
if ((a == b) || ((buflen(a) > buflen(buf)) || ((!a) || (!buf))))
return buf;
la = buflen(a);
lb = buflen(b);
lt = buflen(buf) - la;
i = 1;
anticipate_assignment();
while ((i < lt) && (i = bufidx(buf, a, i))) {
buf = (subbuf(buf, 1, i - 1) + b) + subbuf(buf, i + la);
i += lb;
}
return buf;
};
new method
Replacing public method $string.decode64()
public method $string.decode64() {
arg enc_chars;
var i, j, k, ints, out_buf, len, num, ob;
i = 1;
out_buf = `[];
len = enc_chars.length();
while (i < len) {
refresh();
ints = [0, 0, 0, 0];
j = 1;
while (j <= 4) {
if (((enc_chars[i]) in base64str) || ((enc_chars[i]) == "=")) {
for k in [1 .. 64] {
refresh();
if (strcmp(enc_chars[i], base64str[k]) == 0) {
ints = replace(ints, j, (k - 1) % 64);
break;
}
}
j++;
}
i++;
}
out_buf = out_buf + `[(((ints[1]).shleft(2)) % 256) + ((ints[2]).shright(4)), (((ints[2]).shleft(4)) % 256) + ((ints[3]).shright(2)), (((ints[3]).shleft(6)) % 256) + (ints[4])];
}
return buf_to_str(out_buf);
};
new method
Adding public method $string.index()
public method $string.index() {
arg @args;
return stridx(@args);
};
new method
Adding public method $string.equals()
public method $string.equals() {
arg str1, str2;
return str1 == str2;
};
new method
Replacing public method $object_lib.to_dbref()
public method $object_lib.to_dbref() {
arg obj;
var dbref;
switch (type(obj)) {
case 'string:
if (!obj)
throw(~invdbref, "Invalid object reference \"\".");
if ((obj[1]) == "$") {
obj = obj.subrange(2);
dbref = (| lookup(tosym(obj)) |);
} else if ((obj[1]) == "#") {
obj = substr(obj, 2);
if (obj.is_numeric())
dbref = (| toobjnum(toint(obj)) |);
else
throw(~objnf, ("Cannot find object \"#" + obj) + "\".");
} else {
dbref = toint(obj[1]);
if (dbref || (obj == "0"))
dbref = toobjnum(dbref);
else
dbref = (| lookup(obj) |);
}
if (!dbref) {
dbref = (obj.replace(" ", "_")).lowercase();
catch ~symbol
dbref = tosym(dbref);
with
throw(~symbol, ("Object reference '" + dbref) + "' is invalid.");
dbref = (> lookup(dbref) <);
}
return dbref;
case 'objnum:
return obj;
default:
return (> lookup(obj) <);
}
};
new method
Replacing public method $parse_lib.filter_ctext()
public method $parse_lib.filter_ctext() {
arg what, @defaults;
var dic, output, prop, eff, ctext;
dic = #[['receiver, sender()], ['time, 'post], ['formatter, $plain_format]];
if (defaults && (type(defaults[1]) == 'dictionary))
dic = dict_union(dic, defaults[1]);
switch (class(what)) {
case $ctext_frob:
output = (what.set_vars(dic)).format();
case $message_frob:
output = what.format(dic);
case $filtered_frob:
if ((prop = (| sender().default_propagator() |)))
what = what.propagate(prop);
if (!what) {
output = `[];
} else {
ctext = (what.message()).to_ctext(dic);
for eff in (what.effects()) {
if (type(eff) == 'string)
ctext = ($ctext_frob.new_with([eff + " "], ctext.vars())).append(ctext);
else
ctext = $propagator_effects.(eff[1])(ctext, dic, eff.subrange(2));
}
ctext = ctext.set_vars(what.sensory());
output = ctext.format();
}
default:
output = what;
}
return output;
};
update objvar
Updating objvar $code_lib<$root>,flags
object $code_lib;
var $root flags = ['methods, 'variables, 'core, 'code];
new method
Adding public method $mail_lib.generate_unique_id()
public method $mail_lib.generate_unique_id() {
arg message;
if (!($mail_lib.has_mail_perms(caller())))
(> message.perms(sender()) <);
return crypt(toliteral([message.time(), message.from(), message.recipients(), message.subject(), message.body()]), "POP3").subrange(9);
};
new method
Replacing public method $foundation.all_edit_types(): nooverride
public method $foundation.all_edit_types(): nooverride {
var i, l, t;
l = [];
for i in (.ancestors()) {
if (type((| (t = i.get_edit_types()) |)) == 'list)
l = union(l, i.get_edit_types());
}
return l;
};
new method
Replacing public method $has_commands.get_command_info()
public method $has_commands.get_command_info() {
arg type, cmd;
var info, a, ainfo;
info = [];
for a in (ancestors()) {
if (a == definer())
break;
if ((ainfo = (| a.command_info(type, cmd) |)))
info = union(info, ainfo);
}
return info;
};
new method
Replacing public method $has_commands.add_command()
public method $has_commands.add_command() {
arg template, method, @type;
var cmd, types, count, x;
(> .perms(sender()) <);
[(type ?= 'local)] = type;
if ("*" in template)
throw(~invcmd, "Invalid command, command templates cannot contain \"*\"!.");
cmd = (> $command_lib.validate_command_template(template) <);
if (!(type in ['local, 'remote]))
throw(~type, "Command types can be either 'local or 'remote");
if ('this in (((cmd[2]).values()).slice(1)))
type = 'remote;
if (type == 'remote) {
for x in (((cmd[2]).values()).slice(1)) {
if (x == 'this)
count++;
}
if (!count)
throw(~add_command, "Command type defined as remote with no <this> argument.");
else if (count > 1)
throw(~add_command, "More than one <this> argument specified in template.");
}
if (!get_var(type))
set_var(type, #[]);
set_var(type, get_var(type).setadd_elem((cmd[1])[1], [@cmd[1], template, method, cmd[2]]));
if (type == 'remote)
$remote_cache.add_remote_command((cmd[1])[1], this());
else if ((.command_modules()) || filter x in (parents()) where ('general_cache in (x.flags())))
(| .cache_client_init() |);
};
new method
Replacing public method $has_name.match_name()
public method $has_name.match_name() {
arg str;
var m, t;
if (!str)
return 0;
if ((m = match_begin(name[2], str)))
return m;
for t in (templates || []) {
if ((m = match_template(str, t)))
return m;
}
return 0;
};
new method
Replacing public method $has_name.init_has_name()
public method $has_name.init_has_name() {
var objname;
objname = tostr(this());
if ((objname[1]) == "$")
objname = substr(objname, 2);
name = ['prop, objname, objname];
};
new method
Replacing public method $described._edit_prose_callback()
public method $described._edit_prose_callback() {
arg text, client_data;
(> .perms(caller(), $editor_reference) <);
catch ~parse
.set_prose(text);
with
return ['failure, ["Error: " + ((traceback()[1])[2])]];
return ['success, ["Description set."]];
};
new method
Replacing public method $described.get_description(): nooverride
public method $described.get_description(): nooverride {
arg @dflags;
var flags, f;
flags = #[['prose, 1], ['actor, sender()]];
if (dflags && (type(dflags[1]) == 'dictionary))
flags = dict_union(flags, dflags[1]);
return .description(flags);
};
new method
Replacing public method $described.set_prose()
public method $described.set_prose() {
arg new;
(> .perms(sender()) <);
if (new != 0) {
switch (type(new)) {
case 'string, 'list:
new = (> $compiler.compile_cml(new) <);
case 'frob:
// we'll let this pass by unharmed -- potentially dangerous
default:
throw(~invalid, "Prose can be submitted as CML or Ctext");
}
}
prose = new;
};
add objvar
Adding objvar $event_handler<$root>,help_node
object $event_handler;
var $root help_node = $help_sys_events;
new method
Replacing public method $event_handler.deregister_event()
public method $event_handler.deregister_event() {
arg event, update_on;
var value, event, src, status;
(> .perms(sender()) <);
if ((events.contains(update_on)) && ((events[update_on]).contains(event))) {
// clean it up first.. (ignore status)
[status, src] = (events[update_on])[event];
switch (src) {
case 'location:
(| loc.unhook_from_event(event) |);
case 'this:
(| .unhook_from_event(event) |);
default:
(| src.hook_into_event(event) |);
}
// now cleanup 'events'
value = (events[update_on]).del(event);
if (value)
events = events.add(update_on, value);
else
events = events.del(update_on);
if (!events)
clear_var('events);
}
};
add objvar
Adding objvar $scheduler<$root>,credit
object $scheduler;
var $root credit = ["Miroslav Silovic <silovic@zesoi.fer.hr>"];
new method
Replacing public method $compiler._make_tag()
public method $compiler._make_tag() {
arg token, mode, vars, name, flags, args;
var method, class;
if (mode == 'fmtname) {
if (token != "}")
throw(~parse, "Extra ']' encountered.");
method = tosym("do_" + (name.strip()));
class = $format;
}
if (mode == 'genname) {
if (token != "]")
throw(~parse, "Extra '}' encountered.");
method = tosym("gen_" + (name.strip()));
class = $generator;
}
catch ~methodnf
return (> .(method)(vars, flags, args) <);
with
return (> [class.new_tag(name, flags, args), vars] <);
};
new method
Adding public method $compiler.do_web()
public method $compiler.do_web() {
arg vars, flags, args;
if (!(flags.contains("src")))
throw(~parse, "no 'src' flag for {web}");
if (!(flags.contains("name")))
throw(~parse, "no 'name' flag for {web}");
return [$format.new_tag("web", flags, args), vars];
};
new method
Adding public method $compiler.gen_random()
public method $compiler.gen_random() {
arg vars, flags, args;
if (!(flags.contains("high")))
throw(~parse, "no high flag for [random]");
return [$generator.new_tag("random", flags, args), vars];
};
new method
Replacing public method $compiler.do_table()
public method $compiler.do_table() {
arg vars, flags, args;
if (!(flags.contains("cols")))
throw(~parse, "no 'cols' flag for {table}.");
return [$format.new_tag("table", flags, ._kill_spaces(args)), vars];
};
new method
Replacing public method $compiler.parse_string_new()
public method $compiler.parse_string_new() {
arg vars, tokens;
var mode, out, word, token, i, tmp, ret;
if (!tokens)
return [[], vars];
mode = ['spaces, 'plain];
i = 1;
out = [];
word = "";
while (i <= (tokens.length())) {
refresh();
token = tokens[i++];
switch (mode[1]) {
case 'spaces:
if (token != " ") {
i--;
mode = mode.subrange(2);
}
case 'plain:
if (!(token in ["{", "["])) {
if (token == " ") {
// No scatter because .check can throw
if ((| (ret = ._check_glue(tokens, i)) |)) {
i = ret[1];
mode = [ret[2], @mode];
if (word)
out += [word];
word = "";
continue;
}
}
word += token.sed("\\\(.)", "%1", "g");
} else {
if (word)
out += [word];
word = "";
mode = ['spaces, (token == "{") ? 'fmtname : 'genname, @mode];
}
case 'fmtname, 'genname:
if (((mode[1]) == 'fmtname) && (token == "quote")) {
mode = mode.subrange(2);
out += [$format.new_tag("quote", [], [tokens[i++]])];
i++;
} else {
if (token in glue_table)
mode = [mode[1], 'spaces, @mode.subrange(2)];
mode = ['spaces, 'flags, #[], token, @mode];
}
case 'flags:
if (token in ["}", "]"]) {
ret = (> ._make_tag(token, mode[4], vars, mode[3], mode[2], []) <);
vars = ret[2];
out += [ret[1]];
mode = mode.subrange(5);
} else if (token == "=") {
throw(~parse, "Value flag with no key.");
} else if (token == ":") {
mode = ['spaces, 'args, out, mode[2], @mode.subrange(3)];
out = [];
} else if ((| (tokens[i]) == "=" |)) {
mode = ['flagvalue, token, @mode];
i++;
} else {
mode = mode.replace(2, (mode[2]).add(token, 1));
}
case 'flagvalue:
if (token in ["}", "]", ":"]) {
mode = mode.subrange(3);
i--;
} else if (token == " ") {
mode = mode.subrange(3);
} else if (!(token in ["[", "{"])) {
mode = ['spaces, @(mode.subrange(3)).replace(2, (mode[4]).add(mode[2], token.sed("\\\(.)", "%1", "g")))];
} else {
if (word)
out += [word];
word = "";
mode = ['spaces, (token == "{") ? 'fmtname : 'genname, 'flagset, @mode.subrange(2)];
}
case 'flagset:
i--;
mode = ['spaces, @(mode.subrange(3)).replace(2, (mode[4]).add(mode[2], out[out.length()]))];
out = out.subrange(1, (out.length()) - 1);
case 'args:
if (token in ["}", "]"]) {
if (word) {
out += [word];
word = "";
}
ret = ._make_tag(token, mode[5], vars, mode[4], mode[3], out);
vars = ret[2];
out = (mode[2]) + [ret[1]];
mode = mode.subrange(6);
} else if (token in ["{", "["]) {
if (word)
out += [word];
word = "";
mode = ['spaces, (token == "{") ? 'fmtname : 'genname, @mode];
} else {
if (token == " ") {
if ((| (ret = ._check_glue(tokens, i)) |)) {
i = ret[1];
mode = [ret[2], @mode];
if (word)
out += [word];
word = "";
continue;
}
}
word += token.sed("\\\(.)", "%1", "g");
}
}
}
if (word)
out += [word];
while ((mode[1]) == 'spaces)
mode = mode.subrange(2);
if (mode != ['plain])
throw(~parse, "Unclosed tag.");
return [out, vars];
};
new method
Adding public method $bs_eval.gen_random()
public method $bs_eval.gen_random() {
arg vars, flags, args;
var range, low, high;
// No need to ._eval_ctext() since there are no args.
low = toint((| flags.getkey("low") |) || 1);
high = toint(flags.getkey("high"));
return [[random(high - low) + low], vars];
};
new method
Replacing public method $plain_format.do_table()
public method $plain_format.do_table() {
arg vars, flags, args;
var tblinfo, i, ntbinfo, info, width, l, lr, lc, inds, ind, cwidth;
tblinfo = (| vars['table_info] |) || 0;
width = vars['width];
if (!(| (ntbinfo = flags.getkey("cols")) |))
throw(~flags, "Need column information.");
ind = (| abs(toint(flags.getkey("ind"))) |) || 0;
info = [];
cwidth = width - ind;
if ("%" in ntbinfo) {
for i in (ntbinfo.explode(","))
info += [toint(cwidth * (toint(i) / 100.0))];
} else {
for i in (ntbinfo.explode(","))
info += [toint(i)];
}
vars = dict_union(vars, #[['table_info, [info, 0]], ['rinfo, $list.make(info.length(), 0)], ['rcont, $list.make(info.length(), [])]]);
[args, vars] = ._eval_ctext(args, vars);
vars = tblinfo ? (vars.add('table_info, tblinfo)) : (vars.del('table_info));
vars = vars.add('width, width);
return ["\n" + args, vars];
};
new method
Replacing public method $ansi_format.weed_ansi()
public method $ansi_format.weed_ansi() {
arg str;
var out;
out = str.global_regexp("[\]A[0-9A-LN-Za-ln-z;]+m");
return out;
return str.global_regexp("\\\A[0-9A-Ln-z;a-ln-z;]+[a-z]");
};
new method
Adding public method $html_format.do_input()
public method $html_format.do_input() {
arg vars, flags, args;
[args, vars] = ._eval_ctext(args, vars);
return [(("\n<input " + ((flags.mmap('join, "=")).join(" "))) + ">") + args, vars];
};
new method
Replacing public method $html_format.do_web()
public method $html_format.do_web() {
arg vars, flags, args;
[args, vars] = ._eval_ctext(args, vars);
return [((((args + "<a href=\"") + (flags.getkey("src"))) + "\">") + (flags.getkey("name"))) + "</a>", vars];
};
new method
Adding public method $html_format.do_option()
public method $html_format.do_option() {
arg vars, flags, args;
[args, vars] = ._eval_ctext(args, vars);
return [(("\n<option " + ((flags.mmap('join, "=")).join(" "))) + ">") + args, vars];
};
new method
Replacing public method $html_format.do_td()
public method $html_format.do_td() {
arg vars, flags, args;
var f, n, c, width, align;
c = vars['table_col];
vars = vars.add('table_col, c + 1);
width = (| (vars['table_cols])[c] |);
f = " " + join(flags.mmap('join, "="), " ");
if (!(| flags.getkey("valign") |))
f += " valign=top";
if (width)
f += (" width=\"" + width) + "\"";
[args, vars] = ._eval_ctext(args, vars);
return [((("\n<td " + f) + ">") + args) + "</td>", vars];
};
new method
Replacing root method $world.core_world()
root method $world.core_world() {
.set_setting("realms", $world, "$realm_of_creation");
.set_setting("starting-place", $world, $the_pit);
};
update objvar
Updating objvar $motd<$motd>,connect_help
object $motd;
var $motd connect_help = ["Connection Help", "===============", "", " Connecting as a guest: 'guest <name> <email>'", " Example: 'guest John Doe johndoe@domain.com'", "", " Connecting as a user: 'connect <name> <password>'", " Example: 'connect John Doe mypassword'", "", " Quitting (this screen): '@quit' or 'quit'", "", "Connected Users Listing: '@who'", "", " Creating a user: 'create <name> <password> <email@host>'", " Example: 'connect John Doe mypassword johndoe@domain.com'"];
update objvar
Updating objvar $motd<$motd>,notes
object $motd;
var $motd notes = ["", "Due to a disk failure we have reverted to an older copy of the db", "If you had a user but do not now, this is why.", "Sorry!", ""];
new method
Adding public method $located.eject(): nooverride
public method $located.eject(): nooverride {
arg @args;
var old, mover, place;
[(place ?= $nowhere)] = args;
if (!($sys.is_system(sender()))) {
if (sender() == location)
place = (.has_ancestor($body)) ? ($world.starting_place()) : $nowhere;
else
throw(~perm, ("Only system objects and " + (.name())) + "'s current location may call .eject()");
}
// Don't do anything if we're already here.
if (place == location)
return;
if (!(place.has_ancestor($location)))
throw(~type, (place.namef('ref)) + " is not a location.");
if (place == this())
throw(~move, "You cannot move something into itself.");
if (!valid(location))
location = $nowhere;
mover = sender();
// Set location.
old = location;
location = place;
old.del_sender_from_contents();
place.add_sender_to_contents();
// Notify involved parties of completed move, in reverse order.
place.did_arrive(mover, old);
old.did_leave(mover, place);
.did_move(mover, old);
};
new method
Replacing protected method $command_cache.cache_client_uninit()
protected method $command_cache.cache_client_uninit() {
var p;
if (sender() != this())
(> .perms(sender()) <);
if (.is($place)) {
for p in (.contents()) {
if (p.is($command_cache))
return;
}
}
for p in (([this()] + parents()) + modules)
(| p.cache_server_uninit() |);
};
new method
Replacing public method $command_cache.cache_server_uninit()
public method $command_cache.cache_server_uninit() {
var user;
if (caller() != $command_cache)
throw(~perm, "Caller is not of the command subsystem.");
// see if anybody still needs us, otherwise purge
if (.is_general_cache()) {
for user in ($user_db.connected()) {
if ((user.has_ancestor(this())) || (this() in (user.command_modules())))
return;
}
}
.purge_cache();
};
new method
Replacing public method $command_cache.match_command()
public method $command_cache.match_command() {
arg str, cmd, args;
var command, m, matched, templates, info, cdef, def, cmds, c, p;
templates = (matched = []);
cmds = #[];
if (dict_contains(commands, cmd))
cmds = #[[this(), commands[cmd]]];
for def in (parents() + modules) {
if ((c = def.command_cache()) && dict_contains(c, cmd))
cmds = dict_add(cmds, def, c[cmd]);
}
if (!cmds)
return 0;
for def in (cmds) {
if ((def[1]) in parents())
p = this();
else
p = def[1];
for command in (def[2]) {
if (!(info = (command[2]).command_info('local, command[1])))
continue;
for cdef in (info) {
if ((m = match_template(args, cdef[2])) != 0)
matched += [[listlen(m), [str, cmd, @m], p, @sublist(cdef, 3)]];
}
templates = union(templates, info.slice(3));
refresh();
}
}
if (matched) {
info = [matched[1]];
matched = delete(matched, 1);
for m in (matched) {
if ((m[1]) > ((info[1])[1]))
info = [m];
else if ((m[1]) == ((info[1])[1]))
info += [m];
}
return ['command, info];
}
if (!templates)
return 0;
return ['partial, templates];
};
new method
Replacing public method $command_cache.cache_client_init()
public method $command_cache.cache_client_init() {
var p;
if (sender() != this())
(> .perms(sender()) <);
modules ?= [];
for p in (([this()] + parents()) + modules)
(| p.cache_server_init() |);
};
new method
Replacing public method $command_cache.match_remote_command()
public method $command_cache.match_remote_command() {
arg str, cmd, args;
var command, m, matched, templates, info, cdef, def, cmds, c;
if (this() != $remote_cache)
throw(~perm, "This should only be used on $remote_cache");
templates = (matched = []);
if (commands && dict_contains(commands, cmd))
cmds = commands[cmd];
else
return 0;
for command in (cmds) {
if (!(info = (command[2]).command_info('remote, command[1])))
continue;
for cdef in (info) {
if ((m = match_template(args, cdef[2])) != 0)
matched += [[listlen(m), command[2], [str, cmd, @m], @sublist(cdef, 3)]];
}
templates = union(templates, info.slice(3));
refresh();
}
if (matched)
return ['remote, matched];
if (!templates)
return 0;
return ['partial, templates];
};
add objvar
Adding objvar $remote_cache<$command_cache>,shortcuts
object $remote_cache;
var $command_cache shortcuts = 0;
clear objvar
Clearing objvar $user_interfaces<$command_cache>,shortcuts
object $user_interfaces;
old var $command_cache shortcuts;
clear objvar
Clearing objvar $user_interfaces<$command_cache>,commands
object $user_interfaces;
old var $command_cache commands;
new method
Replacing public method $mail_list.set_name()
public method $mail_list.set_name() {
arg new_name, @args;
var old_name;
old_name = .name('noarticle);
if (new_name && ((new_name[1]) == "*"))
new_name = new_name.subrange(2);
(> pass(new_name, @args) <);
(| $mail_db.key_changed(old_name, new_name) |);
};
clear objvar
Clearing objvar $mail_ui<$command_cache>,shortcuts
object $mail_ui;
old var $command_cache shortcuts;
clear objvar
Clearing objvar $mail_ui<$command_cache>,commands
object $mail_ui;
old var $command_cache commands;
new method
Replacing protected method $mail_ui.unsubscribe_cmd()
protected method $mail_ui.unsubscribe_cmd() {
arg cmdstr, cmd, str;
var list, line, mname;
(> .perms(caller(), 'command) <);
if (!str)
return .mail_lists_cmd();
catch ~listnf, ~ambig {
list = (> $mail_lib.match_mail_recipient(str) <);
} with {
if (error() == ~listnf)
return (traceback()[1])[2];
else
return ((("The list '" + str) + "' could match ") + ((((traceback()[1])[3]).mmap('mail_name)).to_english("nothing", " or "))) + ".";
}
if (list == this())
return "You cannot unsubscribe yourself.";
mname = list.mail_name();
if (!(list in (subscribed.keys())))
return "You are not subscribed to " + mname;
.unsubscribe(list);
return ("Successfully unsubscribed from " + mname) + ".";
};
new method
Replacing protected method $mail_ui.parse_mail_recipient_list()
protected method $mail_ui.parse_mail_recipient_list() {
arg str;
var recip, lists;
lists = [];
for recip in (str.explode_english_list()) {
catch ~listnf, ~ambig {
recip = (> $mail_lib.match_mail_recipient(recip) <);
if (recip.list_is_sendable_by(this()))
lists += [recip];
else
.tell("You cannot send to " + (recip.mail_name()));
} with {
if (error() == ~listnf)
.tell(("The recipient \"" + recip) + "\" is invalid.");
else
.tell(((("The list '" + recip) + "' could match ") + ((((traceback()[1])[3]).mmap('mail_name)).to_english("nothing", " or "))) + ".");
}
}
return lists;
};
new method
Replacing protected method $mail_ui.next_new_cmd()
protected method $mail_ui.next_new_cmd() {
arg cmdstr, cmd, str;
var mail, list, keys, start;
(> .perms(caller(), 'command) <);
str = strsed(str, "^ *on +", "");
if (str) {
catch any {
list = (> $mail_lib.match_mail_recipient(str) <);
} with {
if (error() == ~ambig)
return ((("The list '" + str) + "' could match ") + ((((traceback()[1])[3]).mmap('mail_name)).to_english("nothing", " or "))) + ".";
else
return (traceback()[1])[2];
}
.new_list(list);
mail = (| list.mail_list_next((subscribed[list])[2]) |);
while (mail && (mail.has_read(this()))) {
refresh();
mail = (| list.mail_list_next(mail) |);
}
if (!mail)
return ("No new mail on " + ($mail_lib.mail_name(list))) + ".";
.read_mail(mail, list);
} else {
keys = dict_keys(subscribed);
if (!keys)
return "You are not subscribed to any lists.";
if (!((current['list]) in keys))
current = current.add('list, keys[1]);
start = (list = current['list]);
while (1) {
// anything left on this list?
mail = (| list.mail_list_next((subscribed[list])[2]) |);
while (mail && (mail.has_read(this()))) {
refresh();
mail = (| list.mail_list_next(mail) |);
}
if (mail)
break;
// pick a new list
catch any
list = (> keys[(list in keys) + 1] <);
with
list = (| keys[1] |);
// die?
if ((!list) || (list == start))
return "No new mail.";
}
.new_list(list);
.read_mail(mail, list);
}
};
new method
Replacing protected method $mail_ui.reply_cmd()
protected method $mail_ui.reply_cmd() {
arg cmdstr, cmd, str;
var list, msg, args, i, subj, text, recip;
(> .perms(caller(), 'command) <);
if ((args = match_template(str, "to *")))
str = args[2];
if ((args = match_template(str, "* on *")))
[msg, str, list] = args;
else
msg = str;
if (!list) {
list = current['list];
} else {
catch ~listnf, ~perm, ~ambig {
list = (> $mail_lib.match_mail_recipient(list) <);
(> .new_list(list) <);
} with {
if (error() == ~ambig)
return ((("The list '" + list) + "' could match ") + ((((traceback()[1])[3]).mmap('mail_name)).to_english("nothing", " or "))) + ".";
else
return (traceback()[1])[2];
}
}
if (!msg) {
if (!valid((msg = (| (subscribed[list])[2] |))))
return "No current message to reply to.";
} else {
catch ~range
msg = $mail_lib.range_to_actual($parse_lib.range(msg), current);
with
return (traceback()[1])[2];
msg = msg[1];
}
i = msg in (list.mail());
if (list.is($user))
recip = msg.from();
else
recip = list;
if (!(recip.is($mail_list)))
return (list.namef('ref)) + " is not a valid mail recipient.";
.tell(((("Replying to message " + i) + " on ") + (list.mail_name())) + ".");
text = msg.body();
if (text == ["", "(no message)", ""])
text = [];
text = $mail_lib.indent_reply(text);
text = [((("On " + ($time.format("%d-%b-%Y", msg.time()))) + " ") + ((msg.from()).namef('ref))) + " said: "] + text;
if (.active_editor()) {
.tell("Storing active editor..");
.store_editor();
}
subj = msg.subject();
if (!(subj.match_begin("Re:")))
subj = "Re: " + subj;
(> .invoke_editor(this(), '_edit_mail_callback, text, ['mail, [recip], subj, i, msg]) <);
if (.active_editor()) {
.tell(("Editor invoked with " + ((.active_editor()).session_name())) + ".");
.tell("Type 'help' for available commands.");
}
};
new method
Replacing protected method $mail_ui.mail_remove_cmd()
protected method $mail_ui.mail_remove_cmd() {
arg cmdstr, cmd, str;
var mail, args, lmail, list, rng, m, x, name, lname, offset, ans;
(> .perms(caller(), 'command) <);
if ((args = match_template(str, "* on|from *"))) {
rng = args[1];
list = args[3];
} else if (!str) {
return "You must specify a message and list.";
} else {
// grr, be hacky
args = explode(str);
if ((args.length()) > 1) {
list = args.last();
if (!(| $mail_lib.match_mail_recipient(list) |)) {
rng = str;
list = "";
} else {
rng = (args.delete(args.length())).join();
}
} else {
rng = str;
list = "";
}
}
if (!rng)
return ("You must specify a message to remove from " + lname) + ".";
if (!list) {
list = current['list];
ans = (> .prompt(((("Remove mail " + rng) + " from ") + (list.mail_name())) + "? ") <);
if (match_regexp(ans, "no|n"))
return "Ok, aborting..";
} else {
catch ~listnf, ~ambig {
list = (> $mail_lib.match_mail_recipient(list) <);
} with {
if (error() == ~listnf)
return (traceback()[1])[2];
else
return ((("The list '" + list) + "' could match ") + ((((traceback()[1])[3]).mmap('mail_name)).to_english("nothing", " or "))) + ".";
}
}
lname = list.mail_name();
catch any
(> .new_list(list) <);
with
return (traceback()[1])[2];
if (rng == "$") {
mail = (> $mail_lib.range_to_actual(['end, 'single], current) <);
} else if (rng && ((rng[1]) == "$")) {
catch ~namenf
mail = [(> $object_lib.to_dbref(rng) <)];
with
return (traceback()[1])[2];
} else {
catch ~range
mail = (> $mail_lib.range_to_actual($parse_lib.range(rng), current) <);
with
return (traceback()[1])[2];
}
lmail = list.mail();
if ((mail[1]) != (| lmail[1] |)) {
offset = (mail[1]) in lmail;
lmail = sublist(lmail, offset);
offset--;
}
for m in (mail) {
catch ~perm {
x = (m in lmail) + offset;
name = ((((("#" + x) + " \"") + (m.subject())) + "\" (") + m) + ")";
list.del_mail(m);
.tell(((("Removed message " + name) + " from ") + (list.mail_name())) + ".");
} with {
.tell((traceback()[1])[2]);
}
}
};
new method
Replacing protected method $mail_ui.mail_on_cmd()
protected method $mail_ui.mail_on_cmd() {
arg cmdstr, cmd, str;
var args, lmail, mail, rng, start, end, line, list, len, out, m, rows, o, from, subj;
(> .perms(caller(), 'command) <);
if ((args = match_template(str, "* on *"))) {
rng = args[1];
list = args[3];
} else if (match_template(str, "* to *")) {
return "Please use the @send command instead.";
} else {
rng = "";
list = str;
}
if (!list) {
list = current['list];
} else {
catch ~listnf, ~perm, ~ambig {
list = (> $mail_lib.match_mail_recipient(list) <);
(> .new_list(list) <);
} with {
if (error() == ~ambig)
return ((("The list '" + list) + "' could match ") + ((((traceback()[1])[3]).mmap('mail_name)).to_english("nothing", " or "))) + ".";
else
return (traceback()[1])[2];
}
}
if (!rng) {
mail = list.mail();
end = mail.length();
// minus two for the head and tail
rows = (.get_rows()) - 2;
if (end > rows) {
start = end - rows;
mail = sublist(mail, start);
} else {
start = 1;
}
rng = (start + "-") + end;
} else {
catch ~range
mail = $mail_lib.range_to_actual($parse_lib.range(rng), current);
with
return (traceback()[1])[2];
}
if (!mail)
return "No mail on " + (list.mail_name());
len = (.linelen()) - 36;
out = [((("Mail from " + rng) + " on ") + (list.mail_name())) + ":"];
lmail = list.mail();
o = [];
for m in (mail) {
if (!valid(m)) {
list.notify_bad_mail(m);
} else {
from = $object_lib.get_name(m.from(), 'name);
if ((args = regexp(from, "<([^>]+)>")))
from = explode(args[1], "@")[1];
subj = m.subject();
subj = strsed(subj, "^\[[^]]+\] *", "");
o += [$cml_lib.format_tr_tag($cml_lib.format_td_tag((m == (| (subscribed[list])[2] |)) ? "=>" : " "), $cml_lib.format_td_tag(m in lmail), $cml_lib.format_td_tag((m.has_read(this())) ? " " : "!"), $cml_lib.format_td_tag(subj), $cml_lib.format_td_tag(from), $cml_lib.format_td_tag(m.lines()), $cml_lib.format_td_tag($time.format("%d-%h-%Y", m.time())))];
}
}
return $ctext_frob.new_with((out + [$cml_lib.format_table_tag("5%,5%,2%,50%,17%,5%,15%", o)]) + [$cml_lib.format_sep_tag()]);
};
new method
Replacing protected method $mail_ui.subscribe_cmd()
protected method $mail_ui.subscribe_cmd() {
arg cmdstr, cmd, str;
var list, mname, l, args, line, len, out;
(> .perms(caller(), 'command) <);
// this is ugly bad bad
args = (> $parse_lib.opt(str, "n?ew") <);
if (!(args[1])) {
if ("n?ew" in ((args[2]).slice(1))) {
out = [];
for l in ((subscribed.keys()).setremove(this())) {
if ((l.last_received_on()) > ((subscribed[l])[1]))
out += [" " + (l.mail_name())];
}
if (out)
.tell(["New mail on:"] + out);
else
.tell(["No new mail on the lists you are subscribed to."]);
return;
}
.tell("Currently Subscribed Lists:");
len = (.linelen()) / 3;
for l in ((subscribed.keys()).setremove(this())) {
if (!valid(l)) {
subscribed = dict_del(subscribed, l);
} else {
line = " " + (l.mail_name());
if ((l.last_received_on()) > ((subscribed[l])[1]))
line += " (new mail)";
.tell(line);
}
}
.tell("---");
return;
}
catch ~listnf, ~ambig {
list = $mail_lib.match_mail_recipient(str);
} with {
if (error() == ~listnf)
return (traceback()[1])[2];
else
return ((("The list '" + str) + "' could match ") + ((((traceback()[1])[3]).mmap('mail_name)).to_english("nothing", " or "))) + ".";
}
mname = $mail_lib.mail_name(list);
if (list in (subscribed.keys()))
return .tell(("You are already subscribed to " + mname) + ".");
if (!(list.list_is_readable_by(this())))
return .tell(mname + " is not subscribeable by you.");
.subscribe(list);
.tell(("Successfully subscribed to " + mname) + ".");
};
new method
Replacing protected method $mail_ui.mail_lists_cmd()
protected method $mail_ui.mail_lists_cmd() {
arg @args;
var l, output;
if (caller() != $mail_ui)
(> .perms(caller(), 'command) <);
output = map l in (($mail_db.database()).values()) to ($cml_lib.format_tr_tag($cml_lib.format_td_tag(l.mail_name()), $cml_lib.format_td_tag(dict_contains(subscribed, l) ? "[subscribed]" : " "), $cml_lib.format_td_tag((l.list_is_sendable_by(this())) ? "[sendable]" : " "), $cml_lib.format_td_tag((l.list_is_readable_by(this())) ? "[readable]" : " ")));
return $ctext_frob.new_with(["All Available Mail Lists:", $cml_lib.format_table_tag("53%,17%,15%,15%", @output), $cml_lib.format_sep_tag()]);
};
new method
Replacing protected method $mail_ui.mail_read_cmd()
protected method $mail_ui.mail_read_cmd() {
arg cmdstr, cmd, str;
var mail, m, args, opts, lname, list, rng, args, meta;
(> .perms(caller(), 'command) <);
[args, opts] = (> $parse_lib.opt(str, "m?eta") <);
str = args.join(" ");
meta = [];
if ((m = "m?eta" in (opts.slice(1)))) {
if ((opts[m])[3])
meta = [1];
}
if ((args = match_template(str, "* on *"))) {
rng = args[1];
catch ~listnf, ~ambig {
list = (> $mail_lib.match_mail_recipient(args[3]) <);
} with {
if (error() == ~listnf) {
return (traceback()[1])[2];
} else {
// error == ~ambig
return ((("The list '" + (args[3])) + "' could match ") + ((((traceback()[1])[3]).mmap('mail_name)).to_english("nothing", " or "))) + ".";
}
}
} else {
rng = str;
list = current['list];
}
catch ~perm
(> .new_list(list) <);
with
return (traceback()[1])[2];
if (((list.mail()).length()) == 0)
return ("There is no mail on " + (list.mail_name())) + ".";
if (!rng)
return ("You must specify a message to read on " + (list.mail_name())) + ".";
catch ~range {
if (rng == "next") {
.read_mail((> list.mail_list_next((subscribed[list])[2]) <), list, @meta);
} else if (rng == "prev") {
.read_mail((> list.mail_list_prev((subscribed[list])[2]) <), list, @meta);
} else {
for m in ($mail_lib.range_to_actual($parse_lib.range(rng), current))
.read_mail(m, list, @meta);
}
} with {
return ((("Mail message " + rng) + " does not exist on ") + (list.mail_name())) + ".";
}
};
new method
Replacing root method $location.uninit_location()
root method $location.uninit_location() {
var obj;
for obj in (contents)
(| obj.eject() |);
};
new method
Replacing public method $location.add_sender_to_contents(): nooverride
public method $location.add_sender_to_contents(): nooverride {
if (caller() != $located)
throw(~perm, "Caller is not $located.");
if ((sender().location()) != this())
throw(~location, "Sorry, but you're not here.");
contents = setadd(contents, sender());
};
add objvar
Adding objvar $body<$command_cache>,shortcuts
object $body;
var $command_cache shortcuts = 0;
add objvar
Adding objvar $body<$command_cache>,commands
object $body;
var $command_cache commands = 0;
new method
Replacing public method $body.pose_cmd()
public method $body.pose_cmd() {
arg cmdstr, cmd, args;
var shortwords, preword_punct_chars, postword_punct_chars, preword_punct_expr, postword_punct_expr, pronouns, ant_pronouns, selfmsg, othersmsg, recips, antecedent, prepunct, postpunct, word, oword, things, who, aliases, msg, cap, name, wname, m, w, quoted, msgdict, posessive, name_expr;
(> .perms(caller(), $user, $body) <);
args = explode("." + (args.trim()));
if (args == ["."]) {
(.location()).announce(.name());
return;
}
// ------------
shortwords = ["a", "an", "the", "to", "for", "out", "of", "on", "at", "and"];
preword_punct_chars = "[\"'`([{]";
postword_punct_chars = "[]})\"',.!?:;]";
// ------------
preword_punct_expr = ("^" + preword_punct_chars) + "+";
postword_punct_expr = postword_punct_chars + "+$";
pronouns = (.gender()).pronouns();
ant_pronouns = $gender_neuter.pronouns();
selfmsg = (othersmsg = (recips = (antecedent = [])));
quoted = 0;
for word in (args) {
if ((m = match_regexp(word, preword_punct_expr))) {
prepunct = substr(word, @m[1]);
word = substr(word, ((m[1])[2]) + 1);
} else {
prepunct = "";
}
if ((m = match_regexp(word, postword_punct_expr))) {
postpunct = substr(word, @m[1]);
word = substr(word, 1, ((m[1])[1]) - 1);
} else {
postpunct = "";
}
oword = word;
quoted = (quoted + (((prepunct + word).sed("[^\"]+", "", "g")).length())) % 2;
if ((!quoted) && ((word.length()) > 0)) {
if ((word[1]) == "\\") {
oword = (word = word.subrange(2));
} else if (word in shortwords) {
// don't match against common short words.
} else if (word in ["me", "myself"]) {
word = "yourself";
oword = pronouns['pr];
} else if (word == "I") {
word = "you";
oword = pronouns['ps];
} else if (word == "my") {
word = "your";
oword = pronouns['pp];
} else if (word == "mine") {
word = "yours";
oword = pronouns['pq];
} else if (word in [ant_pronouns['ps], "%s"]) {
word = ant_pronouns['ps];
oword = antecedent ? [antecedent, word, "you"] : word;
} else if (word in [ant_pronouns['po], "%o"]) {
word = ant_pronouns['po];
oword = antecedent ? [antecedent, word, "you"] : word;
} else if (word in [ant_pronouns['pp], "%p"]) {
word = ant_pronouns['pp];
oword = antecedent ? [antecedent, word, "your"] : word;
} else if (word in [ant_pronouns['pr], "%r"]) {
word = ant_pronouns['pr];
oword = antecedent ? [antecedent, word, ((antecedent.length()) > 1) ? "yourselves" : "yourself"] : word;
} else if (word in [ant_pronouns['pq], "%q"]) {
word = ant_pronouns['pq];
oword = antecedent ? [antecedent, word, "yours"] : word;
} else if ((word[1]) == ".") {
// verb to conjugate
word = substr(word, 2);
if (match_regexp(word, "(ch|sh|s)$"))
oword = word + "es";
else if (match_regexp(word, "[^a]y$"))
oword = substr(word, 1, strlen(word) - 1) + "ies";
else
oword = word + "s";
} else if ((word[1]) == ":") {
// a verb for antecedent, to conjugate
word = substr(word, 2);
if (match_regexp(word, "es$"))
oword = substr(word, 1, strlen(word) - 2);
else if (match_regexp(word, "ies$"))
oword = substr(word, 1, strlen(word) - 3) + "y";
else if (match_regexp(word, "s$"))
oword = substr(word, 1, strlen(word) - 1);
if ((antecedent.length()) < 2)
oword = [antecedent, word, oword];
else
word = oword;
} else {
if ((| substr(word, (word.length()) - 1, 2) |) == "'s") {
posessive = "'s";
word = (oword = substr(word, 1, (word.length()) - 2));
} else {
posessive = "";
}
if (((word[word.length()]) == "*") || (word in ["everyone", "everything"])) {
// look for matching things..
if (word in ["everyone", "everything"]) {
things = word == "everything";
word = "";
} else if (((word.length()) > 1) && ((word[(word.length()) - 1]) == "*")) {
// match things too.
word = substr(word, 1, (word.length()) - 2);
things = 1;
} else {
// just match people.
things = 0;
word = substr(word, 1, (word.length()) - 1);
}
catch ~ambig, ~objnf {
who = [.match_environment(word)];
} with {
if ((error() == ~objnf) && word) {
who = [];
} else {
catch ~ambig, ~objnf {
who = [(.environment()).match_object(word)];
} with {
if (error() == ~ambig)
who = (traceback()[1])[3];
else
throw(~stop, ("Object '" + word) + "' not found.");
}
}
}
who = setremove(who, this());
if (!things)
who = filter w in (who) where (w.is($body));
else
who = filter w in (who) where (w.is($thing));
if (who) {
word = map w in (who) to ((w.name()) + posessive).to_english();
recips = union(recips, who);
} else {
word = (things ? "nothing" : "nobody") + posessive;
}
oword = word;
posessive = "";
antecedent = who;
ant_pronouns = ((antecedent.length()) == 1) ? (((antecedent[1]).gender()).pronouns()) : ($gender_plural.pronouns());
} else if ((| (who = .match_environment((w = word))) |) && (who.is($body))) {
// Might be a valid match for a username..
if ((wname = who.name()) == w) {
// full name match. Make sure it's capitalized right.
word = (oword = wname);
recips = setadd(recips, who);
antecedent = [who];
ant_pronouns = (who.gender()).pronouns();
} else {
aliases = who.name_templates();
aliases = map w in (aliases) to (explode(w, "|")).flatten();
aliases = map w in (aliases) to (strsub(w, "?", ""));
if (word in aliases) {
word = (oword = wname);
recips = setadd(recips, who);
antecedent = [who];
ant_pronouns = (who.gender()).pronouns();
}
}
}
word += posessive;
oword += posessive;
}
}
quoted = (quoted + ((postpunct.sed("[^\"]+", "", "g")).length())) % 2;
selfmsg += [(prepunct + word) + postpunct];
if (type(oword) == 'string)
othersmsg += [(prepunct + oword) + postpunct];
else
othersmsg += [[oword[1], (prepunct + (oword[2])) + postpunct, (prepunct + (oword[3])) + postpunct]];
refresh();
}
msg = "";
cap = 0;
for word in (selfmsg) {
word = cap ? (" " + (word.capitalize())) : (" " + word);
msg += word;
cap = match_regexp(word, "[.!?:][^A-Za-z0-9_]*$");
refresh();
}
msgdict = #[[this(), (<$ctext_frob, [[("You" + msg) + (cap ? "" : ".")], #[]]>)]];
name = .name();
for w in (recips + [0]) {
wname = w ? (w.name()) : 0;
cap = 0;
msg = "";
name_expr = ((((("( |^)" + preword_punct_chars) + "*(") + ((w.name()).regexp_escape())) + ")('s)?") + postword_punct_chars) + "*( |$)";
for word in (othersmsg) {
switch (type(word)) {
case 'string:
if (w && (wname != "you")) {
while ((m = word.match_regexp(name_expr))) {
if ((m[4])[1])
word = ((word.subrange(1, ((m[3])[1]) - 1)) + "your") + (word.subrange(((m[4])[1]) + ((m[4])[2])));
else
word = ((word.subrange(1, ((m[3])[1]) - 1)) + "you") + (word.subrange(((m[3])[1]) + ((m[3])[2])));
}
}
word = cap ? (" " + (word.capitalize())) : (" " + word);
case 'list:
if (w in (word[1]))
word = cap ? (" " + ((word[3]).capitalize())) : (" " + (word[3]));
else
word = cap ? (" " + ((word[2]).capitalize())) : (" " + (word[2]));
}
msg += word;
cap = match_regexp(word, "[.!?:][^A-Za-z0-9_]*$");
refresh();
}
msg = (name + msg) + (cap ? "" : ".");
msgdict = msgdict.add(w || "general", (<$ctext_frob, [[msg], #[]]>));
}
(.location()).announce((<$message_frob, msgdict>));
};
new method
Replacing protected method $body.say_cmd()
protected method $body.say_cmd() {
arg cmdstr, cmd, what;
var type, how, idx;
(> .perms(caller(), 'command) <);
if (what)
how = $code_lib.punctuation_type(what);
else
how = "say";
(.location()).announce((((((.name()) + " ") + how) + "s, \"") + what) + "\"");
};
new method
Replacing protected method $body.remove_cmd()
protected method $body.remove_cmd() {
arg cmd, cmdstr, what;
(> .perms(caller(), $user, $body) <);
what = (> .match_env_nice(what) <);
if (!(what.is($wearable_frob)))
return ("You are not wearing " + (what.name())) + ".";
catch any
what = (> what.shed() <);
with
return (traceback()[1])[2];
return "You remove " + (what.name());
};
new method
Replacing protected method $body.parse_interaction_reference()
protected method $body.parse_interaction_reference() {
arg targets, what, @userdb;
var recip, target, msg, out;
[(userdb ?= 0)] = userdb;
targets = (targets && (targets.explode_list())) || [];
if (!targets) {
if (!(targets = (| interaction['objs] |)))
throw(~stop, ("You must direct your " + what) + " to a target.");
out = targets[2];
} else {
out = [];
for recip in (targets) {
target = 0;
if (userdb)
target = (| $user_db.match_begin(recip) |);
if (!target) {
catch ~objnf, ~namenf, ~invdbref, ~context, ~ambig
target = (> .match_environment(recip) <);
with
throw(~stop, (traceback()[1])[2]);
}
if (!(target.is($body)))
throw(~stop, (target.namef('ref)) + " is not a valid recipient.");
out = setadd(out, target);
}
}
return filter target in (out) where (valid(target));
};
update objvar
Updating objvar $robot<$located>,location
object $robot;
var $located location = $the_pit;
add objvar
Adding objvar $robot<$command_cache>,shortcuts
object $robot;
var $command_cache shortcuts = 0;
add objvar
Adding objvar $robot<$command_cache>,commands
object $robot;
var $command_cache commands = 0;
clear objvar
Clearing objvar $command_aliases<$command_cache>,shortcuts
object $command_aliases;
old var $command_cache shortcuts;
clear objvar
Clearing objvar $command_aliases<$command_cache>,commands
object $command_aliases;
old var $command_cache commands;
clear objvar
Clearing objvar $bad_commands<$command_cache>,shortcuts
object $bad_commands;
old var $command_cache shortcuts;
clear objvar
Clearing objvar $bad_commands<$command_cache>,commands
object $bad_commands;
old var $command_cache commands;
update objvar
Updating objvar $bad_commands<$bad_commands>,non_supported_cmds
object $bad_commands;
var $bad_commands non_supported_cmds = #[["quit", "@quit"], ["WHO", "@who"], ["@create", "@new"], ["help", "@help"], ["news", "@news"], ["page", "@page"], ["@gender", "@set gender"], ["uptime", "@status"], ["@alias", "@add-command-alias` or `@add-name-alias"], ["@check", "@monitor"], ["@paranoid", "@monitor"], ["@version", "@status"], ["@lock", "@set lock"], ["@unlock", "@set lock"], ["+com", ["See: `@help Channels`"]], ["tell", "@page"]];
update objvar
Updating objvar $bad_commands<$has_commands>,local
public method $has_commands.__upgrade_set_var() {
var old, new;
old = #[["@create", [["@create", "*", "@create <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["help", [["help", "*", "help <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["page", [["page", "*", "page <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["who", [["who", "*", "who <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["quit", [["quit", "*", "quit <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["news", [["news", "*", "news <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@gender", [["@gender", "*", "@gender <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["uptime", [["uptime", "*", "uptime <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@alias", [["@alias", "*", "@alias <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@check|@paranoid", [["@check|@paranoid", "*", "@check|@paranoid <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@version", [["@version", "*", "@version <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@lock", [["@lock", "*", "@lock <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@unlock", [["@unlock", "*", "@unlock <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["+com", [["+com", "*", "+com <any>", 'old_command_cmd, #[[1, ['any, []]]]]]]];
new = #[["@create", [["@create", "*", "@create <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["help", [["help", "*", "help <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["page", [["page", "*", "page <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["who", [["who", "*", "who <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["quit", [["quit", "*", "quit <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["news", [["news", "*", "news <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@gender", [["@gender", "*", "@gender <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["uptime", [["uptime", "*", "uptime <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@alias", [["@alias", "*", "@alias <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@check|@paranoid", [["@check|@paranoid", "*", "@check|@paranoid <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@version", [["@version", "*", "@version <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@lock", [["@lock", "*", "@lock <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@unlock", [["@unlock", "*", "@unlock <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["+com", [["+com", "*", "+com <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["tell", [["tell", "*", "tell <any>", 'old_command_cmd, #[[1, ['any, []]]]]]]];
catch any {
dblog("__upgrade_handle_var(1, local)");
local = .__upgrade_handle_var(1, "$bad_commands<$has_commands>,local", old, local, new);
} with {
dblog("ERROR: " + traceback()[1][2]);
}
};
object $bad_commands;
eval {
.__upgrade_set_var();
};
object $has_commands;
eval {
del_method('__upgrade_set_var);
};
// old public method $has_commands.__upgrade_set_var();
clear objvar
Clearing objvar $help_ui<$command_cache>,shortcuts
object $help_ui;
old var $command_cache shortcuts;
clear objvar
Clearing objvar $help_ui<$command_cache>,commands
object $help_ui;
old var $command_cache commands;
update objvar
Updating objvar $editor_reference<$has_commands>,local
public method $has_commands.__upgrade_set_var() {
var old, new;
old = #[["@mcp-upload-session", [["@mcp-upload-session", "*", "@mcp-upload-session <descendant of $editor_session>", 'mcp_upload_cmd, #[[1, ['descendant, [$editor_session]]]]]]], ["@cleanup-sessions|@c-s?essions", [["@cleanup-sessions|@c-s?essions", "", "@cleanup-sessions|@c-s?essions", 'cleanup_sessions, #[]]]], ["@edit", [["@edit", "*", "@edit <any>", 'edit_cmd, #[[1, ['any, []]]]]]]];
new = #[["@mcp-upload-session", [["@mcp-upload-session", "*", "@mcp-upload-session <descendant of $editor_session>", 'mcp_upload_cmd, #[[1, ['descendant, [$editor_session]]]]]]], ["@edit", [["@edit", "*", "@edit <any>", 'edit_cmd, #[[1, ['any, []]]]]]]];
catch any {
dblog("__upgrade_handle_var(1, local)");
local = .__upgrade_handle_var(1, "$editor_reference<$has_commands>,local", old, local, new);
} with {
dblog("ERROR: " + traceback()[1][2]);
}
};
object $editor_reference;
eval {
.__upgrade_set_var();
};
object $has_commands;
eval {
del_method('__upgrade_set_var);
};
// old public method $has_commands.__upgrade_set_var();
new method
Replacing protected method $editor_reference.reinvoke_editor()
protected method $editor_reference.reinvoke_editor() {
arg @session;
var i, t, name;
t = "";
[(session ?= active_editor), (name ?= "")] = session;
if (session == 0)
return "No session to resume.";
bg_sessions ?= [];
if (active_editor && ((active_editor != session) || (!(| session.is_resumable() |))))
t = (.store_editor()) + " ";
if ((!valid(session)) || (!(session in (bg_sessions + [active_editor])))) {
active_editor = 0;
return "Invalid session - editor cleared.";
}
if (!(| session.is_resumable() |))
return "The session is not resumable, you can use '@edit +clean' to remove it";
active_editor = session;
bg_sessions = bg_sessions.setremove(active_editor);
bg_sessions = filter i in (bg_sessions) where (valid(i));
.add_parser($editor_parser);
return [t, ("Resumed editing " + ((.active_editor()).session_name())) + ".", "Type 'help' to list available commands."];
};
new method
Replacing public method $editor_reference.cleanup_sessions()
public method $editor_reference.cleanup_sessions() {
arg @disregard;
var out, s;
(sender() == $housekeeper) || (> .perms(sender(), this()) <);
out = [];
for s in (bg_sessions || []) {
if (valid(s)) {
if (s.cleanup_session())
s.destroy();
else
out = setadd(out, s);
}
}
bg_sessions = out;
if (valid(active_editor) && (active_editor.cleanup_session())) {
active_editor.destroy();
clear_var('active_editor);
}
return "Clean and invalid sessions cleared.";
};
new method
Replacing public method $editor_reference.edit_cmd()
public method $editor_reference.edit_cmd() {
arg cmdstr, com, args;
var syn, num, sess, out, type, i, e, bg;
(> .perms(caller(), 'command) <);
syn = "@edit <object reference> [+type=...]";
args = args.trim();
if (!args) {
// list sessions
out = [];
e = .active_editor();
if (e) {
if ($editor_parser in (.parsers()))
out += ["** %0 " + (e.session_name())];
else
out += [" %0 " + (e.session_name())];
}
bg = .background_editor_sessions();
for sess in [1 .. listlen(bg)]
out += [((" %" + sess) + " ") + ((bg[sess]).session_name())];
if (out)
return ["Editor Sessions:"] + out;
return "No editor sessions.";
} else if ((args[1]) == "%") {
// resume session
args = substr(args, 2);
if ((!args) || ((args[1]) == " ")) {
num = 0;
} else {
catch ~nonum
num = (> args.to_number() <);
with
return (traceback()[1])[2];
}
if (!num) {
if (.active_editor())
return .reinvoke_editor(.active_editor(), "%0");
else if (.background_editor_sessions())
sess = (.background_editor_sessions())[1];
else
return "No sessions to resume.";
} else {
if ((listlen((.background_editor_sessions()) || []) < num) || (num < 0))
return ("There is not an editor session %" + num) + ".";
sess = (.background_editor_sessions())[num];
}
return .reinvoke_editor(sess, "%" + num);
} else {
args = (> $parse_lib.opt(args, "t?ype", "c?lean") <);
if ((i = "c?lean" in ((args[2]).slice(1))))
return .cleanup_sessions();
if ((i = "t?ype" in ((args[2]).slice(1))))
type = ((args[2])[i])[4];
type ?= "any";
catch ~objnf, ~namenf, ~ambig
args = replace(args, 1, (> $parse_lib.ref((args[1]).join()) <));
with
return (traceback()[1])[2];
return .edit(@args, type);
}
};
add objvar
Adding objvar $channel_ui<$command_cache>,shortcuts
object $channel_ui;
var $command_cache shortcuts = 0;
add objvar
Adding objvar $channel_ui<$command_cache>,commands
object $channel_ui;
var $command_cache commands = 0;
clear objvar
Clearing objvar $user_info<$command_cache>,shortcuts
object $user_info;
old var $command_cache shortcuts;
clear objvar
Clearing objvar $user_info<$command_cache>,commands
object $user_info;
old var $command_cache commands;
clear objvar
Clearing objvar $www_preferences<$command_cache>,shortcuts
object $www_preferences;
old var $command_cache shortcuts;
clear objvar
Clearing objvar $www_preferences<$command_cache>,commands
object $www_preferences;
old var $command_cache commands;
update objvar
Updating objvar $user<$has_commands>,local
public method $has_commands.__upgrade_set_var() {
var old, new;
old = #[["@quit", [["@quit", "", "@quit", 'quit_cmd, #[]]]], ["i?nventory", [["i?nventory", "", "i?nventory", 'inventory_cmd, #[]]]], ["@audit", [["@audit", "*", "@audit <any>", 'audit_cmd, #[[1, ['any, []]]]]]], ["@who", [["@who", "*", "@who <any>", 'who_cmd, #[[1, ['any, []]]]]]], ["@del-command-a?lias|@dca?lias", [["@del-command-a?lias|@dca?lias", "*", "@del-command-a?lias|@dca?lias <any>", 'del_command_alias_cmd, #[[1, ['any, []]]]]]], ["@command-a?liases|@ca?liases", [["@command-a?liases|@ca?liases", "*", "@command-a?liases|@ca?liases <any>", 'command_aliases_cmd, #[[1, ['any, []]]]]]], ["@add-command-a?lias|@aca?lias", [["@add-command-a?lias|@aca?lias", "*", "@add-command-a?lias|@aca?lias <any>", 'add_command_alias_cmd, #[[1, ['any, []]]]]]], ["@com?mands", [["@com?mands", "*", "@com?mands <any>", 'commands_cmd, #[[1, ['any, []]]]]]], ["@news", [["@news", "", "@news", 'news_cmd, #[]]]], ["@forget", [["@forget", "*", "@forget <any>", 'forget_cmd, #[[1, ['any, []]]]]]], ["@whereis|@where-is", [["@whereis|@where-is", "*", "@whereis|@where-is <any>", 'whereis_cmd, #[[1, ['any, []]]]]]], ["@password|@passwd", [["@password|@passwd", "*", "@password|@passwd <any>", 'password_cmd, #[[1, ['any, []]]]]]], ["@age", [["@age", "*", "@age <object>", 'age_cmd, #[[1, ['object, []]]]]]], ["@context", [["@context", "", "@context", 'context_cmd, #[]]]], ["@rename", [["@rename", "*", "@rename <any>", 'rename_cmd, #[[1, ['any, []]]]]]], ["@add-writer|@aw", [["@add-writer|@aw", "*", "@add-writer|@aw <any>", 'add_writer_cmd, #[[1, ['any, []]]]]]], ["@del-writer|@dw", [["@del-writer|@dw", "*", "@del-writer|@dw <any>", 'del_writer_cmd, #[[1, ['any, []]]]]]], ["@manage?d", [["@manage?d", "*", "@manage?d <any>", 'managed_cmd, #[[1, ['any, []]]]]]], ["@remember", [["@remember", "* as *", "@remember <object> as <any>", 'remember_cmd, #[[1, ['object, []]], [3, ['any, []]]]]]], ["@remembered", [["@remembered", "*", "@remembered <any>", 'remembered_cmd, #[[1, ['any, []]]]]]], ["discard", [["discard", "*", "discard <object>", 'discard_cmd, #[[1, ['object, []]]]]]], ["@writes", [["@writes", "*", "@writes <object>", 'writes_cmd, #[[1, ['object, []]]]]]], ["@trusted?-by", [["@trusted?-by", "*", "@trusted?-by <object>", 'trusted_by_cmd, #[[1, ['object, []]]]]]], ["@del-trust?ee|@dt", [["@del-trust?ee|@dt", "*", "@del-trust?ee|@dt <object:>", 'del_trustee_cmd, #[[1, ['object_opt, []]]]]]], ["@monitor", [["@monitor", "*", "@monitor <any>", 'monitor_cmd, #[[1, ['any, []]]]]]], ["@ex?amine", [["@ex?amine", "*", "@ex?amine <object:+c?hop>", 'examine_cmd, #[[1, ['object_opt, ["c?hop"]]]]]]], ["@map", [["@map", "", "@map", 'map_cmd, #[]]]], ["@finger|@ustat", [["@finger|@ustat", "*", "@finger|@ustat <user>", 'finger_cmd, #[[1, ['user, []]]]]]], ["@trusts|@trustee?s", [["@trusts|@trustee?s", "*", "@trusts|@trustee?s <object>", 'trusts_cmd, #[[1, ['object, []]]]]]], ["@writers", [["@writers", "*", "@writers <object>", 'writers_cmd, #[[1, ['object, []]]]]]], ["@manager", [["@manager", "*", "@manager <object>", 'manager_cmd, #[[1, ['object, []]]]]]], ["@desc?ribe|@prose", [["@desc?ribe|@prose", "*", "@desc?ribe|@prose <any>", 'description_cmd, #[[1, ['any, []]]]]]], ["l?ook|exam?ine", [["l?ook|exam?ine", "*", "l?ook|exam?ine <any>", 'look_cmd, #[[1, ['any, []]]]]]], ["walk|go", [["walk|go", "*", "walk|go <any>", 'go_cmd, #[[1, ['any, []]]]]]], ["@ant|@add-name-template", [["@ant|@add-name-template", "*", "@ant|@add-name-template <any>", 'add_name_template_cmd, #[[1, ['any, []]]]]]], ["@dnt|@del-name-template", [["@dnt|@del-name-template", "*", "@dnt|@del-name-template <any>", 'del_name_template_cmd, #[[1, ['any, []]]]]]], ["@name-template?s|@template?s", [["@name-template?s|@template?s", "*", "@name-template?s|@template?s <object>", 'name_templates_cmd, #[[1, ['object, []]]]]]], ["@register|@register-name", [["@register|@register-name", "*", "@register|@register-name <any>", 'register_name_cmd, #[[1, ['any, []]]]]]], ["@unregister|@unregister-name", [["@unregister|@unregister-name", "*", "@unregister|@unregister-name <any>", 'unregister_name_cmd, #[[1, ['any, []]]]]]], ["@registered", [["@registered", "", "@registered", 'registered_cmd, #[]]]], ["@page", [["@page", "* with *", "@page <any> with <any>", 'remote_cmd, #[[1, ['any, []]], [3, ['any, []]]]]]], ["@paste?-to", [["@paste?-to", "*", "@paste?-to <any>", 'paste_cmd, #[[1, ['any, []]]]]]], ["@new", [["@new", "*", "@new <any>", 'new_cmd, #[[1, ['any, []]]]]]], ["@status|@uptime", [["@status|@uptime", "*", "@status|@uptime <any>", 'status_cmd, #[[1, ['any, []]]]]]], ["@msg?s|@message?s", [["@msg?s|@message?s", "*", "@msg?s|@message?s <any>", 'msg_cmd, #[[1, ['any, []]]]]]], ["@date|@time", [["@date|@time", "*", "@date|@time <any>", 'date_cmd, #[[1, ['any, []]]]]]], ["@set", [["@set", "*", "@set <any>", 'set_cmd, #[[1, ['any, []]]]]]], ["PUEBLOCLIENT", [["PUEBLOCLIENT", "*", "PUEBLOCLIENT <any>", 'pueblo_cmd, #[[1, ['any, []]]]]]], ["@ways|@exits", [["@ways|@exits", "*", "@ways|@exits <any>", 'ways_cmd, #[[1, ['any, []]]]]]], ["@tut?orial", [["@tut?orial", "*", "@tut?orial <any>", 'tutorial_cmd, #[[1, ['any, []]]]]]], ["null", [["null", "*", "null <any>", 'null_cmd, #[[1, ['any, []]]]]]], ["@away", [["@away", "*", "@away <any>", 'away_cmd, #[[1, ['any, []]]]]]], ["@back", [["@back", "", "@back", 'back_cmd, #[]]]], ["@add-trust?ee|@at", [["@add-trust?ee|@at", "*", "@add-trust?ee|@at <object:>", 'add_trustee_cmd, #[[1, ['object_opt, []]]]]]]];
new = #[["@quit", [["@quit", "", "@quit", 'quit_cmd, #[]]]], ["i?nventory", [["i?nventory", "", "i?nventory", 'inventory_cmd, #[]]]], ["@audit", [["@audit", "*", "@audit <any>", 'audit_cmd, #[[1, ['any, []]]]]]], ["@who", [["@who", "*", "@who <any>", 'who_cmd, #[[1, ['any, []]]]]]], ["@del-command-a?lias|@dca?lias", [["@del-command-a?lias|@dca?lias", "*", "@del-command-a?lias|@dca?lias <any>", 'del_command_alias_cmd, #[[1, ['any, []]]]]]], ["@command-a?liases|@ca?liases", [["@command-a?liases|@ca?liases", "*", "@command-a?liases|@ca?liases <any>", 'command_aliases_cmd, #[[1, ['any, []]]]]]], ["@add-command-a?lias|@aca?lias", [["@add-command-a?lias|@aca?lias", "*", "@add-command-a?lias|@aca?lias <any>", 'add_command_alias_cmd, #[[1, ['any, []]]]]]], ["@com?mands", [["@com?mands", "*", "@com?mands <any>", 'commands_cmd, #[[1, ['any, []]]]]]], ["@news", [["@news", "", "@news", 'news_cmd, #[]]]], ["@forget", [["@forget", "*", "@forget <any>", 'forget_cmd, #[[1, ['any, []]]]]]], ["@whereis|@where-is", [["@whereis|@where-is", "*", "@whereis|@where-is <any>", 'whereis_cmd, #[[1, ['any, []]]]]]], ["@password|@passwd", [["@password|@passwd", "*", "@password|@passwd <any>", 'password_cmd, #[[1, ['any, []]]]]]], ["@age", [["@age", "*", "@age <object>", 'age_cmd, #[[1, ['object, []]]]]]], ["@context", [["@context", "", "@context", 'context_cmd, #[]]]], ["@rename", [["@rename", "*", "@rename <any>", 'rename_cmd, #[[1, ['any, []]]]]]], ["@add-writer|@aw", [["@add-writer|@aw", "*", "@add-writer|@aw <any>", 'add_writer_cmd, #[[1, ['any, []]]]]]], ["@del-writer|@dw", [["@del-writer|@dw", "*", "@del-writer|@dw <any>", 'del_writer_cmd, #[[1, ['any, []]]]]]], ["@manage?d", [["@manage?d", "*", "@manage?d <any>", 'managed_cmd, #[[1, ['any, []]]]]]], ["@remember", [["@remember", "* as *", "@remember <object> as <any>", 'remember_cmd, #[[1, ['object, []]], [3, ['any, []]]]]]], ["@remembeShowing the first 100 KB of 302.7 KB. Download the archive for the full file.