@paranoid database #81

Parent #1Owner #36Flags readSource QuestCore.db

Aliases: @paranoid database, paranoid

10 verbs · 4 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
ensure_props_existthis none thisrxd#8115
init_for_corethis none thisrxd#818
add_datathis none thisrxd#8114
get_datathis none thisrxd#8111
erase_datathis none thisrxd#818
set_kept_linesthis none thisrxd#819
gcthis none thisrxd#8125
help_msgthis none thisrxd#811
weeklythis none thisrxd#819
is_paranoidthis none thisrxd#812

Properties

PropertyDefinerFlagsOwnerValue
key#1c#360
aliases#1rc#36{"@paranoid database", "paranoid"}
description#1rc#36
list of 19{"", "This object stores the @paranoid data from :tell. Normally it is not necessary to access these things directly. All verbs are controlled by a caller_perms() check. All data is stored in the old .responsible format.", "", ":add_data(who,data) adds one line's worth of data to the collection, trimming from the front as necessary.", "", ":get_data(who) retrieves the entire batch of data.", "", ":erase_data(who) sets the data to {}", "", ":set_kept_lines(who,number) Changes the number of kept lines. Maximum is 20.", "", "Core verbs that call the above are this are $player:tell, @check, @paranoid, and :erase_paranoid_data.", "", "Internal: ", " Properties used are", " tostr(player)+\"lines\"", " tostr(player)+\"pdata\"", " :ensure_props_exist(who,linesname,dataname): creates the above", " :GC() --- loops over all data and verifies they're for players."}
object_size#1r#36{6362, -1090650497}

Ancestry

Ancestors (nearest first): #1 Root Class

Children: none

Call graph

calls n81_1 #81:init_for_core n56_8 #56:suspend_if_needed n81_1->n56_8 n81_2 #81:add_data n42_0 #42:controls n81_2->n42_0 n81_0 #81:ensure_props_exist n81_2->n81_0 n81_3 #81:get_data n81_3->n42_0 n81_4 #81:erase_data n81_4->n42_0 n81_5 #81:set_kept_lines n81_5->n42_0 n81_5->n81_0 n81_6 #81:gc n69_0 #69:raise n81_6->n69_0 n81_9 #81:is_paranoid n81_6->n81_9 n81_7 #81:help_msg n1_9 #1:description n81_7->n1_9 n81_8 #81:weekly n81_8->n81_6 n81_8->n81_8

Source

ensure_props_exist

Spec this none thisFlags rxdOwner #36Definer #81

Referenced by

Source

1"*Must* be called with PDATA first, and LINES second.";
2if ((caller != this) && (!caller_perms().wizard))
3return E_PERM;
4else
5try
6this.(args[2]);
7except (E_PROPNF)
8add_property(this, args[2], {}, {$hacker, ""});
9endtry
10try
11this.(args[3]);
12except (E_PROPNF)
13add_property(this, args[3], 5, {$hacker, ""});
14endtry
15endif

init_for_core

Spec this none thisFlags rxdOwner #2Definer #81

Referenced by

none

Source

1if (!caller_perms().wizard)
2return;
3else
4for x in (properties(this))
5delete_property(this, x);
6$command_utils:suspend_if_needed(0);
7endfor
8endif

add_data

Spec this none thisFlags rxdOwner #36Definer #81

Referenced by

Source

1{who, newdata} = args;
2if ($perm_utils:controls(caller_perms(), who))
3d = tostr(who, "pdata");
4l = tostr(who, "lines");
5this:ensure_props_exist(who, d, l);
6data = this.(d);
7lines = this.(l);
8"Icky G7 code copied straight out of $player:tell.";
9if (((len = length(this.(d) = {@data, newdata})) * 2) > (lines * 3))
10this.(d) = this.(d)[(len - lines) + 1..len];
11endif
12else
13return E_PERM;
14endif

get_data

Spec this none thisFlags rxdOwner #36Definer #81

Referenced by

Source

1who = args[1];
2if ($perm_utils:controls(caller_perms(), who))
3d = tostr(who, "pdata");
4if (typeof(`this.(d) ! ANY') == LIST)
5return this.(d);
6else
7return {};
8endif
9else
10return E_PERM;
11endif

erase_data

Spec this none thisFlags rxdOwner #36Definer #81

Referenced by

Source

1who = args[1];
2if ($perm_utils:controls(caller_perms(), who))
3d = tostr(who, "pdata");
4"OK if this would toss its cookies if no prop, no damage.";
5`this.(d) = {} ! ANY';
6else
7return E_PERM;
8endif

set_kept_lines

Spec this none thisFlags rxdOwner #36Definer #81

Referenced by

Source

1maximum = 20;
2who = args[1];
3if ($perm_utils:controls(caller_perms(), who))
4l = tostr(who, "lines");
5this:ensure_props_exist(who, l, l);
6this.(l) = min(args[2], maximum);
7else
8return E_PERM;
9endif

gc

Spec this none thisFlags rxdOwner #36Definer #81

Referenced by

Source

1if (((caller_perms() != #-1) && (caller_perms() != player)) || (!player.wizard))
2$error:raise(E_PERM);
3endif
4threshold = ((60 * 60) * 24) * 3;
5for x in (properties(this))
6l = length(x);
7who = toobj(x[1..l - 5]);
8if (((!valid(who)) || (!is_player(who))) || (!this:is_paranoid(who)))
9delete_property(this, x);
10else
11if (index(x, "lines"))
12if (typeof(this.(x)) != INT)
13this.(x) = 10;
14endif
15elseif (index(x, "pdata"))
16if ((who.last_disconnect_time < (time() - threshold)) && (who.last_connect_time < (time() - threshold)))
17this.(x) = {};
18endif
19if (typeof(this.(x)) != LIST)
20this.(x) = {};
21endif
22endif
23endif
24(ticks_left() < 4000) && suspend(0);
25endfor

help_msg

Spec this none thisFlags rxdOwner #2Definer #81

Referenced by

none

Source

1return this:description();

weekly

Spec this none thisFlags rxdOwner #2Definer #81

Referenced by

Source

1if (!caller_perms().wizard)
2return E_PERM;
3else
4week = (7 * 24) * 3600;
5fork ((((7 * 60) * 60) + week) - (time() % week))
6this:weekly();
7endfork
8this:gc();
9endif

is_paranoid

Spec this none thisFlags rxdOwner #2Definer #81

Referenced by

Source

1"Some people make their .paranoid !r.  Wizardly verb to retrieve value.";
2return `args[1].paranoid ! ANY';