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

Contents of /eggdrop1.6/scripts/weed

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


Revision 1.9 - (show annotations) (download)
Wed Jun 18 10:12:22 2008 UTC (11 years, 2 months ago) by tothwolf
Branch: MAIN
CVS Tags: HEAD
Changes since 1.8: +10 -3 lines
Updated exec magic tricks in the autobotchk and weed scripts.

Check for a working 'grep -E' before resorting to 'egrep'.

Use "$0" ${1+"$@"} in place of "$0" "$@" to avoid problems with broken sh implementations that expand "$@" into a single empty argument when there are no other arguments.

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

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23