/[cvs]/eggdrop1.6/scripts/weed
ViewVC logotype

Annotation of /eggdrop1.6/scripts/weed

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (hide annotations) (download)
Tue Dec 21 17:35:08 1999 UTC (19 years, 10 months ago) by fabian
Branch: MAIN
CVS Tags: eggdrop105020, eggdrop10503, eggdrop10403, eggdrop105040
Changes since 1.4: +2 -0 lines
Tothwolf's id-header

1 fabian 1.3 #! /bin/sh
2     # ^-- little trick to restart using tclsh \
3     exec tclsh "$0" "$@"
4 segfault 1.1 #
5 fabian 1.5 # $Id$
6     #
7 segfault 1.1 # weed out certain undesirables from an eggdrop userlist
8     # try just typing 'tclsh weed' to find out the options
9     # Robey Pointer, november 1994
10     #
11     # <cmwagner@gate.net>:
12     # I did a few bug fixes to the original weed script, things changed...
13     #
14     # when specifying other weed options they would unset the User() field and
15     # a maxlast weed would try and weed again and cause the script to stop due
16     # to User() being already unset (array nonexistant)
17     #
18     # when loadUserFile encountered an xtra field it would try and use the $info
19     # variable, which was supposed to be $xtra (something overlooked when the
20     # line was cut and pasted -- I hate it when that happens)
21     #
22     # changed the formatting of the saved weed file to match more closely to
23     # eggdrop 0.9tp (so this may cause incompatibilities), but when a hostmask
24     # field exactly matched 40 characters it would save it with no spaces after
25     # it and eggdrop would reject the user record. I know I could have easily
26     # changed one character, but I couldn't help myself. <grin>
27 fabian 1.4 # 5 march 1996
28 segfault 1.1 #
29 fabian 1.4 # <robey, 23jul1996>:
30 segfault 1.1 # upgrade for v2 userfiles
31 fabian 1.4 # <bruce s, 04sep1996>:
32 segfault 1.1 # fixed xtra field from getting truncated
33 fabian 1.4 # <robey, 20sep1996>:
34 segfault 1.1 # stopped it from mangling channel ban lists
35 fabian 1.4 # <Ec|ipse & dtM, 10jun1997>:
36 segfault 1.1 # upgrade for v3 userfiles
37 fabian 1.4 # <Ec|ipse 18jun1997>:
38 segfault 1.1 # added an option to remove users from unwanted channels
39 fabian 1.4 # <Ec|ipse 28oct1997>:
40 segfault 1.1 # upgrade for v4 userfiles, with v3 converter
41 fabian 1.4 # <Ernst 8mar1998>:
42 segfault 1.1 # fixed bug "list element in braces followed by X instead of space"
43     # (the use of "lrange" where you aren't sure if it's a list is bad)
44     # fixed --CONSOLE item not being included, creating "user" --CONSOLE
45 fabian 1.4 # <Ernst 1apr1998>:
46 segfault 1.1 # two more improper ocurrences of "lrange" removed
47 fabian 1.2 # <rtc 20sep1999>:
48     # removed ancient way of determining the current time.
49 fabian 1.4 # <Tothwolf 21oct1999
50     # [clock] isn't in all versions of Tcl...
51 segfault 1.1 #
52    
53     set exempt {*ban *ignore}
54     set exemptops 0 ; set exemptmasters 0 ; set exemptfriends 0
55     set exemptparty 0 ; set exemptfile 0 ; set exemptchanm 0
56     set exemptbotm 0 ; set exemptchann 0 ; set exemptchanf 0
57     set exemptchano 0
58     set maxlast 0 ; set maxban 0 ; set maxignore 0
59     set weedops 0 ; set weedmasters 0 ; set weednopw 0
60     set stripops 0 ; set stripmasters 0 ; set weedlurkers 0
61     set chanrem {}
62     set convert 0
63    
64 fabian 1.4 if {![string compare "" [info commands clock]]} then {
65     set fd [open "/tmp/egg.timer." w]
66     close $fd
67     set CURRENT [file atime "/tmp/egg.timer."]
68     exec rm -f /tmp/egg.timer.
69     } else {
70     set CURRENT [clock seconds]
71     }
72 segfault 1.1
73     if {$argc < 1} {
74     puts stdout "\nUsage: weed <userfile> \[options\]"
75     puts stdout " (weeds out users from an eggdrop userlist)"
76     puts stdout "Output goes to <userfile>.weed"
77     puts stdout "Possible options:"
78     puts stdout " -<nick> exempt this user from weeding"
79     puts stdout " ^o ^m ^f exempt ops or masters or friends"
80     puts stdout " ^co ^cm ^cf exempt chanops or chanmasters or chanfriends"
81     puts stdout " ^cn exempt chanowner"
82     puts stdout " ^p ^x exempt party-line or file-area users"
83     puts stdout " ^b exempt botnet master"
84     puts stdout " +<days> weed: haven't been seen in N days"
85     puts stdout " :n weed: haven't EVER been seen"
86     puts stdout " :o :m weed: ops or masters with no password set"
87     puts stdout " :a weed: anyone with no pasword set"
88     puts stdout " o m unop/unmaster: ops or masters with no pass."
89     puts stdout " b<days> weed: bans not used in N days"
90     puts stdout " i<days> weed: ignores created over N days ago"
91     puts stdout " =<chan> weed: channels nolonger supported"
92     puts stdout " c convert v3 eggdrop userfile"
93     puts stdout ""
94     exit
95     }
96     puts stdout "\nWEED 18jun97, robey\n"
97    
98     set filename [lindex $argv 0]
99     for {set i 1} {$i < $argc} {incr i} {
100     set carg [lindex $argv $i]
101     if {$carg == ":n"} {
102     set weedlurkers 1
103     } elseif {$carg == ":o"} {
104     set weedops 1 ; set stripops 0 ; set weednopw 0
105     } elseif {$carg == ":m"} {
106     set weedmasters 1 ; set stripmasters 0 ; set weednopw 0
107     } elseif {$carg == ":a"} {
108     set weednopw 1 ; set weedops 0 ; set weedmasters 0
109     set stripops 0 ; set stripmasters 0
110     } elseif {$carg == "o"} {
111     set stripops 1 ; set weedops 0 ; set weednopw 0
112     } elseif {$carg == "m"} {
113     set stripmasters 1 ; set weedmasters 0 ; set weednopw 0
114     } elseif {$carg == "^m"} {
115     set exemptmasters 1
116     } elseif {$carg == "^o"} {
117     set exemptops 1
118     } elseif {$carg == "^f"} {
119     set exemptfriends 1
120     } elseif {$carg == "^p"} {
121     set exemptparty 1
122     } elseif {$carg == "^x"} {
123     set exemptfile 1
124     } elseif {$carg == "^cf"} {
125     set exemptchanf 1
126     } elseif {$carg == "^cm"} {
127     set exemptchanm 1
128     } elseif {$carg == "^cn"} {
129     set exemptchann 1
130     } elseif {$carg == "^b"} {
131     set exemptbotm 1
132     } elseif {$carg == "^co"} {
133     set exemptchano 1
134     } elseif {$carg == "c"} {
135     set convert 1
136     } elseif {[string index $carg 0] == "-"} {
137     lappend exempt [string range $carg 1 end]
138     } elseif {[string index $carg 0] == "+"} {
139     set maxlast [expr 60*60*24* [string range $carg 1 end]]
140     } elseif {[string index $carg 0] == "b"} {
141     set maxban [expr 60*60*24* [string range $carg 1 end]]
142     } elseif {[string index $carg 0] == "i"} {
143     set maxignore [expr 60*60*24* [string range $carg 1 end]]
144     } elseif {[string index $carg 0] == "="} {
145     lappend chanrem [string tolower [string range $carg 1 end]]
146     } else {
147     puts stderr "UNKNOWN OPTION: '$carg'\n"
148     exit
149     }
150     }
151    
152     if {(!$weedlurkers) && (!$weedops) && (!$weedmasters) && (!$weednopw) &&
153     (!$stripops) && (!$stripmasters) && ($maxlast == 0) && ($convert == 0) &&
154     ($maxban == 0) && ($maxignore == 0) && ($chanrem == {})} {
155     puts stderr "PROBLEM: You didn't specify anything to weed out.\n"
156     exit
157     }
158    
159     set weeding { } ; set strip { } ; set exempting { }
160     if {$weedlurkers} { lappend weeding "lurkers" }
161     if {$weedops} { lappend weeding "pwdless-ops" }
162     if {$weedmasters} { lappend weeding "pwdless-masters" }
163     if {$weednopw} { lappend weeding "pwdless-users" }
164     if {$chanrem != {}} { lappend weeding "unwanted-channel" }
165     if {$maxlast > 0} { lappend weeding ">[expr $maxlast /(60*60*24)]-days" }
166     if {$maxban > 0} { lappend weeding "bans>[expr $maxban /(60*60*24)]-days" }
167     if {$maxignore > 0} { lappend weeding "ign>[expr $maxignore /(60*60*24)]-days" }
168     if {$weeding != { }} { puts stdout "Weeding:$weeding" }
169    
170     if {$stripops} { lappend strip "pwdless-ops" }
171     if {$stripmasters} { lappend strip "pwdless-masters" }
172     if {$strip != { }} { puts stdout "Stripping:$strip" }
173    
174     if {$exemptops} { lappend exempting "(ops)" }
175     if {$exemptmasters} { lappend exempting "(masters)" }
176     if {$exemptfriends} { lappend exempting "(friends)" }
177     if {$exemptparty} { lappend exempting "(party-line)" }
178     if {$exemptfile} { lappend exempting "(file-area)" }
179     if {$exemptchann} { lappend exempting "(channel-owners)" }
180     if {$exemptchanm} { lappend exempting "(channel-masters)" }
181     if {$exemptchano} { lappend exempting "(channel-ops)" }
182     if {$exemptchanf} { lappend exempting "(channel-friends)" }
183     if {$exemptbotm} { lappend exempting "(botnet masters)" }
184     if {[llength $exempt]>2} { lappend exempting "[lrange $exempt 2 end]" }
185     if {$exempting != { }} { puts stdout "Exempt:$exempting" }
186    
187     puts stdout "\nReading $filename ..."
188    
189     proc convertUserFile {fname} {
190     global User Hostmask Channel Botflag LastOn BotAddr Xtra convert
191     puts stdout "\nRunning Converter on $fname"
192     set oldhandle {}
193     if {[catch {set fd [open $fname r]}] != 0} { return 0 }
194     set line [string trim [gets $fd]]
195     if {[string range $line 1 2] == "3v"} {
196     set convert 1
197     } elseif {[string range $line 1 2] == "4v"} {
198     return 0
199     }
200     while {![eof $fd]} {
201     set line [string trim [gets $fd]]
202     if {([string index $line 0] != "#") && ([string length $line] > 0)} {
203     scan $line "%s" handle
204     if {$handle == "-"} {
205     # hostmask
206     set hmList [split [string range $line 2 end] ,]
207     for {set i 0} {$i < [llength $hmList]} {incr i} {
208     lappend Hostmask($oldhandle) [string trim [lindex $hmList $i]]
209     }
210     } elseif {$handle == "!"} {
211     # channel
212     set chList [string trim [string range $line 1 end]]
213     lappend Channel($oldhandle) "[lrange $chList 0 1] [string trim [lindex $chList end] 0123456789]"
214     } elseif {$handle == "*"} {
215     # dccdir
216     set dccdir [string trim [string range $line 2 end]]
217     set User($oldhandle) [lreplace $User($oldhandle) 2 2 $dccdir]
218     } elseif {$handle == "+"} {
219     # email
220     set email [string trim [string range $line 2 end]]
221     set User($oldhandle) [lreplace $User($oldhandle) 3 3 $email]
222     } elseif {$handle == "="} {
223     # comment
224     set comment [string trim [string range $line 2 end]]
225     set User($oldhandle) [lreplace $User($oldhandle) 4 4 $comment]
226     } elseif {$handle == ":"} {
227     # user info line / bot addresses
228     if {[lsearch [split [lindex $User($oldhandle) 0] ""] b] == -1} {
229     set info [string trim [string range $line 1 end]]
230     set User($oldhandle) [lreplace $User($oldhandle) 5 5 $info]
231     } else {
232     set BotAddr($oldhandle) [string trim [string range $line 1 end]]
233     }
234     } elseif {$handle == "."} {
235     # xtra field start
236     if {![info exists xtraList($oldhandle)]} {
237     set xtraList($oldhandle) [string trim [string range $line 1 end]]
238     } {
239     set xtraList($oldhandle) "$xtraList($oldhandle) [string trim [string range $line 1 end]]"
240     }
241     } elseif {$handle == "!!"} {
242     # laston
243     set LastOn($oldhandle) [lindex $line 1]
244     } else {
245     # finish up xtra field first
246     if {[info exists xtraList($oldhandle)]} {
247     for {set i 0} {$i < [llength $xtraList($oldhandle)]} {incr i} {
248     lappend Xtra($oldhandle) [string trim [lindex $xtraList($oldhandle) $i] \{]
249     }
250     }
251     # begin of new user
252     scan $line "%s %s %s %s" handle pass attr ts
253     if {$convert == 1 && $attr != ""} {
254     regsub -all {B} $attr {t} attr
255     set botflags "s h a l r" ; set Botflag($handle) ""
256     set nattr [split [string trim $attr 0123456789] ""] ; set attr ""
257     foreach flag $botflags {
258     if {[lsearch -exact $nattr $flag] != -1} {append Botflag($handle) $flag}
259     }
260     foreach flag $nattr {
261     if {[lsearch -exact $botflags $flag] == -1} {append attr $flag}
262     }
263     }
264     set User($handle) [list $attr $pass {} {} {} {}]
265     set Hostmask($handle) {}
266     set Channel($handle) {}
267     set oldhandle $handle
268     }
269     }
270     }
271     return 1
272     }
273    
274     proc loadUserFile {fname} {
275     global User Hostmask Channel Botflag LastOn BotAddr Xtra
276     set oldhandle {}
277     if {[catch {set fd [open $fname r]}] != 0} { return 0 }
278     set line [string trim [gets $fd]]
279     if {[string range $line 1 2] != "4v"} {
280     if {[string range $line 1 2] == "3v"} {
281     convertUserFile $fname
282     return 1
283     } else {
284     puts stderr "Unknown userfile version! (not v4)\n"
285     exit
286     }
287     }
288     while {![eof $fd]} {
289     set line [string trim [gets $fd]]
290     if {([string index $line 0] != "#") && ([string length $line] > 0)} {
291     scan $line "%s" handle
292     if {$handle == "--HOSTS"} {
293     # hostmask
294     set hmList [lindex $line 1]
295     lappend Hostmask($oldhandle) [string trim $hmList]
296     } elseif {$handle == "-"} {
297     # hostmask
298     set hmList [lindex $line 1]
299     lappend Hostmask($oldhandle) [string trim $hmList]
300     } elseif {$handle == "!"} {
301     # channel
302     set chList [string trim [string range $line 1 end]]
303     lappend Channel($oldhandle) $chList
304     } elseif {$handle == "--BOTADDR"} {
305     # botaddr
306     set BotAddr($oldhandle) [lindex $line 1]
307     } elseif {$handle == "--PASS"} {
308     # pass
309     set pass [string trim [string range $line [expr [string first " " $line] + 1] end]]
310     set User($oldhandle) [lreplace $User($oldhandle) 1 1 $pass]
311     } elseif {$handle == "--DCCDIR"} {
312     # dccdir
313     set first [string first " " $line]
314     if {$first != -1} {
315     set dccdir [string trim [string range $line [expr $first + 1] end]]
316     } {
317     set dccdir ""
318     }
319     set User($oldhandle) [lreplace $User($oldhandle) 2 2 $dccdir]
320     } elseif {$handle == "--COMMENT"} {
321     # comment
322     set first [string first " " $line]
323     if {$first != -1} {
324     set comment [string trim [string range $line [expr $first + 1] end]]
325     } {
326     set comment ""
327     }
328     set User($oldhandle) [lreplace $User($oldhandle) 4 4 $comment]
329     } elseif {$handle == "--INFO"} {
330     # user info line
331     set first [string first " " $line]
332     if {$first != -1} {
333     set info [string trim [string range $line [expr $first + 1] end]]
334     } {
335     set info ""
336     }
337     set User($oldhandle) [lreplace $User($oldhandle) 5 5 $info]
338     } elseif {$handle == "--CONSOLE"} {
339     # console
340     set first [string first " " $line]
341     if {$first != -1} {
342     set console [string trim [string range $line [expr $first + 1] end]]
343     } {
344     set console ""
345     }
346     set User($oldhandle) [lreplace $User($oldhandle) 6 6 $console]
347     } elseif {$handle == "--XTRA"} {
348     # xtra field
349     set first [string first " " $line]
350     if {$first != -1} {
351     set xtraList [string trim [string range $line [expr $first + 1] end]]
352     } {
353     set xtraList ""
354     }
355     lappend Xtra($oldhandle) $xtraList
356     } elseif {$handle == "--LASTON"} {
357     # laston
358     set LastOn($oldhandle) [lindex $line 1]
359     } elseif {$handle == "--BOTFL"} {
360     # botflags
361     set Botflag($oldhandle) [string trim [string range $line 1 end]]
362     } else {
363     # begin of new user
364     scan $line "%s %s %s" handle dash attr
365     set User($handle) [list $attr {} {} {} {} {} {}]
366     set Hostmask($handle) {}
367     set Channel($handle) {}
368     set oldhandle $handle
369     }
370     }
371     }
372     return 1
373     }
374    
375     proc saveUserFile fname {
376     global User Hostmask Channel Botflag LastOn BotAddr Xtra
377     if {[catch {set fd [open $fname w]}] != 0} { return 0 }
378     puts $fd "#4v: weed! now go away."
379     foreach i [array names User] {
380     set hmask "none"
381     set hmloop 0 ; set chloop 0 ; set loloop 0 ; set xloop 0 ; set aloop 0
382     if {[lindex $User($i) 1] == "bans"} {set plug "bans"} {set plug "-"}
383     set attr [lindex $User($i) 0]
384     set ts [lindex $User($i) 2]
385     puts $fd [format "%-9s %-20s %-24s" $i $plug $attr]
386     for {} {$hmloop < [llength $Hostmask($i)]} {incr hmloop} {
387     if {[string index $i 0] == "*" || [string range $i 0 1] == "::"} {
388     set hmask [lindex $Hostmask($i) $hmloop]
389     regsub -all {~} $hmask { } hmask
390     puts $fd "- $hmask"
391     } else {
392     puts $fd "--HOSTS [lindex $Hostmask($i) $hmloop]"
393     }
394     }
395     if {[info exists BotAddr($i)]} {
396     puts $fd "--BOTADDR [lindex $BotAddr($i) 0]"
397     }
398     if {[info exists Xtra($i)]} {
399     for {} {$xloop < [llength $Xtra($i)]} {incr xloop} {
400     puts $fd "--XTRA [lindex $Xtra($i) $xloop]"
401     }
402     }
403     if {[info exists Channel($i)]} {
404     for {} {$chloop < [llength $Channel($i)]} {incr chloop} {
405     puts $fd "! [lindex $Channel($i) $chloop]"
406     }
407     }
408     if {[info exists Botflag($i)]} {
409     if {$Botflag($i) != ""} { puts $fd "--BOTFL [lindex $Botflag($i) 0]" }
410     }
411     if {[string index $i 0] == "*" || [string range $i 0 1] == "::"} {
412     set User($i) [lreplace $User($i) 1 1 {}]
413     }
414     if {[lindex $User($i) 1] != {}} { puts $fd "--PASS [lindex $User($i) 1]" }
415     if {[lindex $User($i) 2] != {}} { puts $fd "--DCCDIR [lindex $User($i) 2]" }
416     if {[lindex $User($i) 3] != {}} { puts $fd "--XTRA EMAIL [lindex $User($i) 3]" }
417     if {[lindex $User($i) 4] != {}} { puts $fd "--COMMENT [lindex $User($i) 4]" }
418     if {[lindex $User($i) 5] != {}} { puts $fd "--INFO [lindex $User($i) 5]" }
419     if {[lindex $User($i) 6] != {}} { puts $fd "--CONSOLE [lindex $User($i) 6]" }
420     if {[info exists LastOn($i)]} {
421     puts $fd "--LASTON [lindex $LastOn($i) 0]"
422     }
423     }
424     close $fd
425     return 1
426     }
427    
428     if {![loadUserFile $filename]} {
429     puts stdout "* Couldn't load userfile!\n"
430     exit
431     }
432    
433     if {$convert == 0} {
434     puts stdout "Loaded. Weeding..."
435     puts stdout "(pwd = no pass, -o/-m = removed op/master, lrk = never seen, exp = expired)"
436     puts stdout "(uwc = unwanted channel)\n"
437     } else {
438     puts stdout "Loaded. Converting..."
439     }
440    
441     set total 0
442     set weeded 0
443     foreach i [array names User] {
444     incr total
445     set attr [lindex $User($i) 0]
446     set chanattr [lindex [lindex $Channel($i) 0] 2]
447     if {([lsearch -exact $exempt $i] == -1) &&
448     ([string range $i 0 1] != "::") &&
449     ([string range $i 0 1] != "--") &&
450     (([string first o $attr] == -1) || (!$exemptops)) &&
451     (([string first m $attr] == -1) || (!$exemptmasters)) &&
452     (([string first f $attr] == -1) || (!$exemptfriends)) &&
453     (([string first p $attr] == -1) || (!$exemptparty)) &&
454     (([string first x $attr] == -1) || (!$exemptfile)) &&
455     (([string first t $attr] == -1) || (!$exemptbotm)) &&
456     (([string first f $chanattr] == -1) || (!$exemptchanf)) &&
457     (([string first m $chanattr] == -1) || (!$exemptchanm)) &&
458     (([string first n $chanattr] == -1) || (!$exemptchann)) &&
459     (([string first o $chanattr] == -1) || (!$exemptchano))} {
460     set pass [lindex $User($i) 1]
461     if {[info exists LastOn($i)]} { set ts [lindex $LastOn($i) 0] } { set ts 0 }
462     if {([string compare $pass "-"] == 0) && ([string first b $attr] == -1)} {
463     if {$weednopw == 1} {
464     unset User($i) ; incr weeded
465     puts -nonewline stdout "[format "pwd: %-10s " $i]"
466     } elseif {([string first o $attr] != -1) && ($weedops == 1)} {
467     unset User($i) ; incr weeded
468     puts -nonewline stdout "[format "pwd: %-10s " $i]"
469     } elseif {([string first m $attr] != -1) && ($weedmasters == 1)} {
470     unset User($i) ; incr weeded
471     puts -nonewline stdout "[format "pwd: %-10s " $i]"
472     }
473     if {([string first o $attr] != -1) && ($stripops == 1)} {
474     set nattr {}
475     for {set x 0} {$x < [string length $attr]} {incr x} {
476     if {[string index $attr $x] != "o"} {
477     set nattr [format "%s%s" $nattr [string index $attr $x]]
478     }
479     }
480     if {$nattr == {}} { set nattr "-" }
481     set User($i) [lreplace $User($i) 0 0 $nattr]
482     puts -nonewline stdout "[format " -o: %-10s " $i]"
483     }
484     if {([string first m $attr] != -1) && ($stripmasters == 1)} {
485     set nattr {}
486     for {set x 0} {$x < [string length $attr]} {incr x} {
487     if {[string index $attr $x] != "m"} {
488     set nattr [format "%s%s" $nattr [string index $attr $x]]
489     }
490     }
491     if {$nattr == {}} { set nattr "-" }
492     set User($i) [lreplace $User($i) 0 0 $nattr]
493     puts -nonewline stdout "[format " -m: %-10s " $i]"
494     }
495     }
496     if {($ts==0) && ($weedlurkers==1) && ([string first b $attr] == -1) && [info exists User($i)]} {
497     unset User($i) ; incr weeded
498     puts -nonewline stdout "[format "lrk: %-10s " $i]"
499     }
500     if {($ts > 0) && ($maxlast > 0) && ($CURRENT-$ts > $maxlast && [info exists User($i)])} {
501     unset User($i) ; incr weeded
502     puts -nonewline stdout "[format "exp: %-10s " $i]"
503     }
504     if {$chanrem != {} && [info exists Channel($i)]} {
505     foreach unchan $chanrem {
506     set id [lsearch [string tolower $Channel($i)] *$unchan*]
507     if {$id != -1} {
508     set Channel($i) [lreplace $Channel($i) $id $id] ; incr weeded
509     puts -nonewline stdout "[format "uwc: %-10s " $i]"
510     }
511     }
512     }
513     }
514     flush stdout
515     }
516     if {$weeded == 0 && $convert == 0} { puts -nonewline stdout "uNF... Nothing to weed!" }
517     puts stdout "\n"
518    
519     foreach i [array names User] {
520     if {([string range $i 0 1] == "::") || ($i == "*ban")} {
521     for {set j 0} {$j < [llength $Hostmask($i)]} {incr j} {
522     set ban [split [lindex $Hostmask($i) $j] :]
523     if {[string range [lindex $ban 2] 0 0] == "+"} {
524     set lastused [lindex $ban 3]
525     if {($maxban > 0) && ($CURRENT-$lastused > $maxban)} {
526     if {$i == "*ban"} {
527     puts stdout "Expired ban: [lindex $ban 0]"
528     } {
529     puts stdout "Expired ban on [string range $i 2 end]: [lindex $ban 0]"
530     }
531     set Hostmask($i) [lreplace $Hostmask($i) $j $j]
532     incr j -1
533     }
534     }
535     }
536     }
537     if {$i == "*ignore"} {
538     for {set j 0} {$j < [llength $Hostmask($i)]} {incr j} {
539     set ign [split [lindex $Hostmask($i) $j] :]
540     set lastused [lindex $ign 3]
541     if {($maxignore > 0) && ($CURRENT-$lastused > $maxignore)} {
542     puts stdout "Expired ignore: [lindex $ign 0]"
543     set Hostmask($i) [lreplace $Hostmask($i) $j $j]
544     incr j -1
545     }
546     }
547     }
548     }
549    
550     puts stdout "\nFinished scan."
551     puts stdout "Original total ($total), new total ([expr $total-$weeded]), zapped ($weeded)"
552    
553     if {![saveUserFile $filename.weed]} {
554     puts stdout "* uNF... Couldn't save new userfile!\n"
555     exit
556     }
557     puts stdout "Wrote $filename.weed"

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23