Guest Log #12
Aliases: Guest Log
4 verbs · 6 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
enter | this none this | rxd | #12 | 7 |
last | this none this | rxd | #12 | 46 |
init_for_core | this none this | rxd | #12 | 4 |
find | this none this | rxd | #12 | 28 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
connections | #12 | | #2 | {} |
max_entries | #12 | | #2 | 199 |
key | #1 | c | #2 | <clear> |
aliases | #1 | rc | #2 | {"Guest Log"} |
description | #1 | rc | #2 | <clear> |
object_size | #1 | r | #36 | {3738, 1539462952} |
Ancestry
Ancestors (nearest first): #1 Root Class
Children: none
Call graph
Source
enter
Referenced by
- #31:confunc line 4:
$guest_log:enter - #31:log_disconnect line 5:
$guest_log:enter
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
Referenced by
- #57:@guests line 9:
$guest_log:last
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
Referenced by
none
Source
1if (caller_perms().wizard) 2pass(@args); 3this.connections = {}; 4endif
find
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