forked from fuzzball-muck/fuzzball-muf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd-@bansite.muf
103 lines (98 loc) · 2.53 KB
/
cmd-@bansite.muf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
@prog cmd-@bansite
1 9999 d
1 i
$def BannedPropdir "@banned/"
$def BannedPropdirLoc #0
: site-is-banned? (iDescr -- iTrue?)
conhost BannedPropdir swap strcat
BannedPropdirLoc BannedPropdir
begin
over swap nextprop dup
while
3 pick over smatch if
pop pop pop 1 exit
then
repeat
pop pop pop 0
;
: boot-banned-connects ( -- )
me @ descriptors
begin
dup
while
1 - swap descrcon dup
site-is-banned? if
dup "Sorry, but connections from that site are not allowed."
connotify conboot
else pop
then
repeat
;
: list-banned-sites ( -- )
me @ "Banned sites:" notify
BannedPropdirLoc BannedPropdir
begin
over swap nextprop dup
while
" " over strcat
me @ swap notify
repeat
pop pop
me @ "Done." notify
;
$def .tell me @ swap notify
: show-help ( -- )
"@bansite v1.0 Written 11/11/93 by Foxen" .tell
"----------------------------------------------------------------" .tell
"@bansite SITENAME Prevents logins from the given site." .tell
"@bansite !SITENAME Re-allows logins from the given site." .tell
"@bansite #list Lists all the sites that are banned." .tell
"@bansite #help Displays this screen." .tell
"----------------------------------------------------------------" .tell
"NOTE: Sitenames can be wildcard patterns. ie: *.uloser.edu" .tell
;
: main
preempt
command @ "Queued event." stringcmp not if
pop boot-banned-connects exit
then
me @ "wizard" flag? not if
me @ "Permission denied." notify
pop exit
then
strip
dup "#list" stringcmp not if
pop list-banned-sites exit
then
dup "#help" stringcmp not if
pop show-help exit
then
dup "!" 1 strncmp not if
1 strcut swap pop
BannedPropdirLoc BannedPropdir rot strcat
over over getpropstr if
remove_prop "Site unbanned."
else
pop pop "That site was not banned."
then
me @ swap notify
else
BannedPropdirLoc BannedPropdir rot strcat
over over getpropstr if
pop pop "That site is already banned."
else
"banned" 0 addprop "Site banned."
then
me @ swap notify
then
;
.
c
q
@register #me cmd-@bansite=tmp/prog1
@register #prop #0:_connect/ cmd-@bansite=bansite
@set $tmp/prog1=W
@set $tmp/prog1=L
@set $tmp/prog1=3
@action @bansite=#0=tmp/exit1
@link $tmp/exit1=$tmp/prog1