Registration Database #16

Parent #37Owner #36Flags Source QuestCore.db

Aliases: Registration Database

8 verbs · 13 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
find* _only* _every*this none thisrxd#161
addthis none thisrxd#1613
init_for_corethis none thisrxd#165
suspicious_addressthis none thisrxd#1646
suspicious_useridthis none thisrxd#169
describe_registrationthis none thisrxd#169
prunethis none thisrxd#1643
report_prune_progressthis none thisrxd#1624

Properties

PropertyDefinerFlagsOwnerValue
registrar#16rc#36#2
prune_progress#16rc#36"zzz"
prune_stop#16rc#36"zzz"
total_pruned_people#16rc#3622967
total_pruned_characters#16rc#36470
prune_task#16rc#361766597976
node_perms#37rc#36""
data#37r#36<clear>
#37#36{"", "", {}, {}}
key#1c#36<clear>
aliases#1rc#36{"Registration Database"}
description#1rc#36<clear>
object_size#1r#36{8728, -1090650497}

Ancestry

Ancestors (nearest first): #37 Generic Database#1 Root Class

Children: none

Call graph

calls n16_1 #16:add n37_1 #37:find_exact n16_1->n37_1 n37_6 #37:insert n16_1->n37_6 n55_18 #55:iassoc n16_1->n55_18 n16_2 #16:init_for_core n1_28 #1:init_for_core n16_2->n1_28 n37_12 #37:clearall n16_2->n37_12 n16_3 #16:suspicious_address n16_3->n37_1 n72_0 #72:parse_address n16_3->n72_0 n72_1 #72:local_domain n16_3->n72_1 n37_2 #37:find_all n16_3->n37_2 n52_0 #52:has_property n16_3->n52_0 n16_4 #16:suspicious_userid n16_4->n52_0 n16_6 #16:prune n16_6->n37_1 n16_6->n37_6 n16_6->n37_2 n56_8 #56:suspend_if_needed n16_6->n56_8 n37_7 #37:delete n16_6->n37_7 n20_69 #20:incr_alpha n16_6->n20_69 n56_7 #56:running_out_of_time n16_6->n56_7 n24_40 #24:random_wizard n16_6->n24_40 n6_18 #6:tell n16_6->n6_18 n16_7 #16:report_prune_progress n16_7->n6_18 n59_37 #59:task_valid n16_7->n59_37

Source

find* _only* _every*

Spec this none thisFlags rxdOwner #36Definer #16

Referenced by

none

Source

1return ((caller == this) || caller_perms().wizard) ? pass(@args) | E_PERM;

add

Spec this none thisFlags rxdOwner #36Definer #16

Referenced by

Source

1":add(player,email[,comment])";
2if (!caller_perms().wizard)
3return E_PERM;
4endif
5{who, email, @comment} = args;
6l = this:find_exact(email);
7if (l == $failed_match)
8this:insert(email, {{who, @comment}});
9elseif (i = $list_utils:iassoc(who, l))
10this:insert(email, listset(l, {who, @comment}, i));
11else
12this:insert(email, {@l, {who, @comment}});
13endif

init_for_core

Spec this none thisFlags rxdOwner #2Definer #16

Referenced by

none

Source

1if (caller_perms().wizard)
2pass();
3this:clearall();
4this.registrar = #2;
5endif

suspicious_address

Spec this none thisFlags rxdOwner #2Definer #16

Referenced by

Source

1"suspicious(address [,who])";
2"Determine whether an address appears to be another player in disguise.";
3"returns a list of similar addresses.";
4"If second argument given, then if all similar addresses are held by that";
5"person, let it pass---they're just switching departments at the same school";
6"or something.";
7"";
8"at the moment,";
9"  foo@bar.baz.bing.boo";
10"is considered 'similar' to anything matching";
11"  foo@*.bing.boo";
12if (!caller_perms().wizard)
13return E_PERM;
14endif
15{address, ?allowed = #-1} = args;
16{userid, site} = $network:parse_address(address);
17exact = (!site) && this:find_exact(address);
18if (!site)
19site = $network.site;
20endif
21site = $network:local_domain(site);
22sitelen = length(site);
23others = this:find_all_keys(userid + "@");
24for other in (others)
25if (other[max(1, ($ - sitelen) + 1)..$] != site)
26others = setremove(others, other);
27endif
28endfor
29if (exact)
30others = listinsert(others, address);
31endif
32for x in (others)
33allzapped = 1;
34for y in (this:find_exact(x))
35if ((((length(y) == 2) && ((y[2] == "zapped due to inactivity") || (y[2] == "toaded due to inactivity"))) || (y[1] == allowed)) || (($object_utils:has_property($local, "second_char_registry") && (typeof(them = $local.second_char_registry:other_chars(y[1])) == LIST)) && (allowed in them)))
36"let them change to the address if it is them, or if it is a registered char of theirs.";
37"Hrm. Need typeof==LIST check because returns E_INVARG for shared characters. bleah Ho_Yan 5/8/95";
38else
39allzapped = 0;
40endif
41endfor
42if (allzapped)
43others = setremove(others, x);
44endif
45endfor
46return others;

suspicious_userid

Spec this none thisFlags rxdOwner #2Definer #16

Referenced by

Source

1"suspicious_userid(userid)";
2"Return yes if userid is root or postmaster or something like that.";
3if ($object_utils:has_property(#0, "local") && $object_utils:has_property($local, "suspicious_userids"))
4extra = $local.suspicious_userids;
5else
6extra = {};
7endif
8return ((((args[1] in {@$network.suspicious_userids, @extra}) || match(args[1], "^guest")) || match(args[1], "^help")) || index(args[1], "-owner")) || index(args[1], "owner-");
9"Thinking about ruling out hyphenated names, on the grounds that they're probably mailing lists.";

describe_registration

Spec this none thisFlags rxdOwner #2Definer #16

Referenced by

Source

1"Returns a list of strings describing the registration data for an email address.  Args[1] should be the result of this:find.";
2set_task_perms(caller_perms());
3result = {};
4for x in (args[1])
5name = (valid(x[1]) && is_player(x[1])) ? x[1].name | "<recycled>";
6email = (valid(x[1]) && is_player(x[1])) ? x[1].email_address | "<???>";
7result = {@result, tostr("  ", name, " (", x[1], ") current email: ", email, (length(x) > 1) ? (" [" + x[2]) + "]" | "")};
8endfor
9return result;

prune

Spec this none thisFlags rxdOwner #2Definer #16

Referenced by

Source

1"Carefully loop through the db and delete items associated with reaped objects.  If that results in no objects remaining for a username, delete that username.";
2"Attempt to keep memory usage down by only asking for a small number of items at a time.  Should probably have some arguments to control this.";
3if (!caller_perms().wizard)
4raise(E_PERM);
5endif
6this.prune_task = task_id();
7probe = this.prune_progress;
8while (probe < this.prune_stop)
9for username in (this:find_all_keys(probe))
10items = this:find_exact(username);
11orig = items;
12for y in (items)
13{who, @whys} = y;
14if ((!valid(who)) || (!is_player(who)))
15nuke = 1;
16for why in (whys)
17if ((why && (why != "zapped due to inactivity")) && (why != "toaded due to inactivity"))
18nuke = 0;
19endif
20endfor
21if (nuke)
22items = setremove(items, y);
23endif
24endif
25$command_utils:suspend_if_needed(0);
26endfor
27if (!items)
28this:delete(username);
29this.total_pruned_people = this.total_pruned_people + 1;
30elseif (items != orig)
31this:insert(username, items);
32this.total_pruned_characters = (this.total_pruned_characters + length(orig)) - length(items);
33endif
34$command_utils:suspend_if_needed(0);
35endfor
36probe = $string_utils:incr_alpha(probe);
37this.prune_progress = probe;
38if ($command_utils:running_out_of_time())
39set_task_perms($wiz_utils:random_wizard());
40suspend(0);
41endif
42endwhile
43player:tell("Prune stopped at ", toliteral(this.prune_progress));

report_prune_progress

Spec this none thisFlags rxdOwner #2Definer #16

Referenced by

none

Source

1player:tell("Prune is up to ", toliteral(this.prune_progress), ".");
2mine = 0;
3if (typeof(this.prune_progress) == STR)
4total = (26 * 26) * 26;
5for x in [1..3]
6mine = ((mine * 26) + index($string_utils.alphabet, this.prune_progress[x])) - 1;
7endfor
8else
9total = 256 * 256;
10mine = (this.prune_progress[1] * 256) + this.prune_progress[2];
11endif
12percent = (100.0 * tofloat(mine)) / tofloat(total);
13player:tell("We have processed ", mine, " entries out of ", total, ", or ", toint(percent), ".", toint(10.0 * percent) % 10, "%.");
14player:tell("There were ", this.total_pruned_characters, " individual list entries removed, and ", this.total_pruned_people, " whole email addresses removed.");
15if ($code_utils:task_valid(this.prune_task))
16player:tell("Prune task is ", this.prune_task, ".  Stacktrace:");
17for x in (task_stack(this.prune_task, 1))
18if (valid(x[4]))
19player:tell(x[4], ":", x[2], " [", x[1], "]  ", x[3].name, "  (", x[6], ")");
20endif
21endfor
22else
23player:tell("The recorded task_id is no longer valid.");
24endif