Code: Select all
lsearch -regexp -all -inline {1 11 111 22 2 222} {^(1|2).*}
Code: Select all
join [split $word] "\n"
Code: Select all
set readbw [open [string trimleft $chan #]_badwords.txt r]
while { ![eof $readbw] } {
putlog "i do something"
gets $readbw line
set helpwanted [string range $line 0 [expr [string first # $line]-1]]
set message [string range $line [expr [string first # $line]+1] [expr [string first ź $line]-1]]
set typeof [string range $line [expr [string first ź $line]+1] end]
if { ([string match -nocase "* $helpwanted *" $input] == 1 && $helpwanted != "") || ([string match -nocase "$helpwanted" $input] == 1 && $helpwanted != "") } {
if { $typeof == 3 } {
putquick "PRivmsg $chan : cos znalazlem! :D"
set Excepts(File) [open excepts_[string trimleft $chan #]_badwords.txt r]
while { ![eof $Excepts(File)] } {
gets $Excepts(File) line
set Excepts(list) [string range $line 0 [expr [string first # $line]-1]]
close $Excepts(File)
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set count 0
## At Least one Badword to chek
set bw "http:// www. ftp:/"
set bw *[join [split $bw] "*\n*"]*
set bwfound [lsearch -regexp -all -inline $arg {(http://|www.|ftp://)}]
putquick "privmsg $chan : $bwfound"
foreach bwb $bw {
while {$count < [llength $bwfound]} {
if { [string match -nocase "$bwb" [lindex $bwfound $count]] == 1 } {
putquick "PRIVMSG $chan : Wypierdalam cie bo podałeś badword."
#putquick "PRIVMSG $chan : $Excepts(list)"
if { [string match -nocase "$Excepts(list)" [lindex $bwfound $count]] == 1 } {
putquick "PRIVMSG $chan : Ale jest wyjatek to mash spokój bo spokoje. :p"
} else {
putquick "PRIVMSG $chan : Wyjątku tez brak to wypad."
return 0
}
}
incr count 1
}
}
}
}
Code: Select all
if { [string match -nocase "$bwb" [lindex $bwfound $count]] == 1 } {
putquick "PRIVMSG $chan : Wypierdalam cie bo podałeś badword."
#putquick "PRIVMSG $chan : $Excepts(list)"
if { [string match -nocase "$Excepts(list)" [lindex $bwfound $count]] == 1 } {
putquick "PRIVMSG $chan : Ale jest wyjatek to mash spokój bo spokoje. :p"
} else {
putquick "PRIVMSG $chan : Wyjątku tez brak to wypad."
return 0
}
}
Code: Select all
while { ![eof $Excepts(File)] } {
gets $Excepts(File) line
set Excepts(list) [string range $line 0 [expr [string first # $line]-1]]
close $Excepts(File)
Code: Select all
while {$count < [llength $bwfound]} {
if { [string match -nocase "$bw" [lindex $bwfound $count]] == 1 } {
putquick "PRIVMSG $chan : Wypierdalam cie bo podałeś badword."
#putquick "PRIVMSG $chan : $Excepts(list)"
if { [string match -nocase "$Excepts(list)" [lindex $bwfound $count]] == 1 } {
putquick "PRIVMSG $chan : Ale jest wyjatek to mash spokój bo spokoje. :p"
} else {
putquick "PRIVMSG $chan : Wyjątku tez brak to wypad."
return 0
}
}
incr count 1
}
Code: Select all
set bw "http:// www. ftp:/"
set bw *[join [split $bw] "*\n*"]*
I doubt any of the list-items within $bwfound would match that pattern, however I would need further information on $arg to effectively say wether it would actually have a chance of matching anything...
Code: Select all
bind pubm - "* *" badword:pubm:check
proc badword:pubm:check {nick uhost handle chan arg} {
global triggerchar
## if { [isop $nick $chan] || [ishalfop $nick $chan] || [isvoice $nick $chan] } {
## putlog "used isop/hop/vop"
## return 0
## }
if {[string match "*@..." $uhost]} {
putlog "is hosted"
return 0
}
if { ![file exists [string trimleft $chan #]_badwords.txt] } {
return 0
}
set input [swear:filter2 $arg]
set readbw [open [string trimleft $chan #]_badwords.txt r]
while { ![eof $readbw] } {
putlog "i do something"
gets $readbw line
set helpwanted [string range $line 0 [expr [string first # $line]-1]]
set message [string range $line [expr [string first # $line]+1] [expr [string first ź $line]-1]]
set typeof [string range $line [expr [string first ź $line]+1] end]
if { ([string match -nocase "* $helpwanted *" $input] == 1 && $helpwanted != "") || ([string match -nocase "$helpwanted" $input] == 1 && $helpwanted != "") } {
if { $typeof == 4 } {
BadWordKick $nick $uhost $chan $arg $helpwanted $message $typeof $input
return 0
}
if { $typeof == 3 } {
putquick "PRivmsg $chan : cos znalazlem! :D"
set Excepts(File) [open excepts_[string trimleft $chan #]_badwords.txt r]
while { ![eof $Excepts(File)] } {
gets $Excepts(File) line
set Excepts(list) [string range $line 0 [expr [string first # $line]-1]]
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set count 0
## At Least one Badword to chek
set bw "http:// www. ftp:/"
set bw *[join [split $bw] "*\n*"]*
set bwfound [lsearch -regexp -all -inline $arg {(http://|www.|ftp://)}]
putquick "privmsg $chan : $bwfound"
putquick "privmsg $chan : $bw"
putquick "privmsg $chan : $Excepts(list)"
while {$count < [llength $bwfound]} {
if { [string match -nocase "$bw" [lindex $bwfound $count]] == 1 } {
putquick "PRIVMSG $chan : Wypierdalam cie bo podałeś badword."
#putquick "PRIVMSG $chan : $Excepts(list)"
if { [string match -nocase "$Excepts(list)" [lindex $bwfound $count]] == 1 } {
putquick "PRIVMSG $chan : Ale jest wyjatek to mash spokój bo spokoje. :p"
} else {
putquick "PRIVMSG $chan : Wyjątku tez brak to wypad."
return 0
}
}
incr count 1
}
}
}
Quite obviously, bw cannot match this pattern:http://