Guest Log #12

Parent #1Owner #2Flags Source QuestCore.db

Aliases: Guest Log

4 verbs · 6 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
enterthis none thisrxd#127
lastthis none thisrxd#1246
init_for_corethis none thisrxd#124
findthis none thisrxd#1228

Properties

PropertyDefinerFlagsOwnerValue
connections#12#2{}
max_entries#12#2199
key#1c#2<clear>
aliases#1rc#2{"Guest Log"}
description#1rc#2<clear>
object_size#1r#36{3738, 1539462952}

Ancestry

Ancestors (nearest first): #1 Root Class

Children: none

Call graph

calls n12_0 #12:enter n52_5 #52:isa n12_0->n52_5 n12_1 #12:last n6_10 #6:notify n12_1->n6_10 n55_17 #55:assoc n12_1->n55_17 n52_16 #52:connected n12_1->n52_16 n55_18 #55:iassoc n12_1->n55_18 n56_8 #56:suspend_if_needed n12_1->n56_8 n20_71 #20:redirect_ansi n12_1->n20_71 n20_8 #20:from_seconds n12_1->n20_8 n12_2 #12:init_for_core n1_28 #1:init_for_core n12_2->n1_28 n12_3 #12:find n20_53 #20:connection_hostname n12_3->n20_53

Source

enter

Spec this none thisFlags rxdOwner #2Definer #12

Referenced by

Source

1":enter(who,islogin,time,site)";
2"adds an entry to the connection log for a given guest (caller).";
3if ($object_utils:isa(caller, $guest))
4$guest_log.connections = {{caller, @args}, @$guest_log.connections[1..min($guest_log.max_entries, $)]};
5else
6return E_PERM;
7endif

last

Spec this none thisFlags rxdOwner #2Definer #12

Referenced by

Source

1":last([n,[guest_list]])";
2"print list of the last n entries in the guest log";
3" (use n=0 if you want all entries)";
4" optional second arg limits listing to the specified guest(s)";
5set_task_perms(caller_perms());
6{?howmany = 0, ?which = 0} = args;
7howmany = min(howmany || $maxint, length($guest_log.connections));
8if (!caller_perms().wizard)
9player:notify("Sorry.");
10else
11current = {};
12listing = {};
13last = 0;
14for c in ($guest_log.connections[1..howmany])
15if (which && (!(c[1] in which)))
16elseif (c[2])
17"...login...";
18if (a = $list_utils:assoc(c[1], current))
19listing[a[2]][3] = c[3];
20current = setremove(current, a);
21else
22listing = {@listing, {c[1], c[4], c[3], $object_utils:connected(c[1]) ? -idle_seconds(c[1]) | 1}};
23last = last + 1;
24endif
25else
26"...logout...";
27listing = {@listing, {c[1], c[4], 0, c[3]}};
28last = last + 1;
29if (i = $list_utils:iassoc(c[1], current))
30current[i][2] = last;
31else
32current = {@current, {c[1], last}};
33endif
34endif
35$command_utils:suspend_if_needed(2);
36endfor
37su = $string_utils;
38player:notify(su:left(su:left(su:left("Guest", 20) + "Connected", 36) + "Idle/Disconn.", 52) + "From");
39player:notify(su:left(su:left(su:left("-----", 20) + "---------", 36) + "-------------", 52) + "----");
40for l in (listing)
41on = l[3] ? (ct = ctime(l[3]))[1..3] + ct[9..19] | "earlier";
42off = (l[4] > 0) ? (ct = ctime(l[4]))[1..3] + ct[9..19] | ("  " + $string_utils:from_seconds(-l[4]));
43player:notify(su:left(su:left(su:right(tostr(strsub(l[1].name, "uest", "."), " (", l[1], ")  "), -20) + on, 36) + off, 52) + l[2]);
44$command_utils:suspend_if_needed(2);
45endfor
46endif

init_for_core

Spec this none thisFlags rxdOwner #2Definer #12

Referenced by

none

Source

1if (caller_perms().wizard)
2pass(@args);
3this.connections = {};
4endif

find

Spec this none thisFlags rxdOwner #2Definer #12

Referenced by

none

Source

1":find(guest_id,time)";
2" => site name of guest logged in at that time";
3" => 0 if not logged in";
4" => E_NACC if this is earlier than the earliest guest recorded";
5set_task_perms(caller_perms());
6{who, when} = args;
7if (!caller_perms().wizard)
8raise(E_PERM);
9else
10found = (who in connected_players()) ? $string_utils:connection_hostname(who.last_connect_place) | 0;
11for c in ($guest_log.connections)
12if (c[3] < when)
13return found;
14elseif (c[1] != who)
15"... different guest...";
16elseif (c[2])
17"...login...";
18if (c[3] == when)
19return found;
20endif
21found = 0;
22else
23"...logout...";
24found = c[4];
25endif
26endfor
27return E_NACC;
28endif