Извиняюсь, перепутал. Это сторонний скрипт.
Искал вот все равно и не могу найти...
Может быть, подскажете? часть скрипта вот выложу.
Code
#script begin#
set qot(vershort) "1.00 by lmrvsk@RusNet"
set qot(script) "scripts/lcquote-1.00.tcl"
set qot(package) "scripts/lcquote-1.00.zip"
proc check_string {text} {
regsub -all ">" $text "" text
regsub -all "<" $text "" text
regsub -all "|" $text "" text
regsub -all "&" $text "" text
return $text
}
proc qot_flood_init {} {
global qot qot_flood_array ; if {![string match *:* $qot(flood)]} {putlog "Quotes - var qot(flood) not set correctly." ; return}
set qot(flood_num) [lindex [split $qot(flood) :] 0] ; set qot(flood_time) [lindex [split $qot(flood) :] 1] ; set i [expr $qot(flood_num) - 1]
while {$i >= 0} {set qot_flood_array($i) 0 ; incr i -1 ; }
} ; qot_flood_init
proc qot_flood {nick uhost chan} {
if {[matchattr [nick2hand $nick] o $chan] || [matchattr [nick2hand $nick] o] || [matchattr [nick2hand $nick] f]} {return 0}
global qot qot_flood_array ; if {$qot(flood_num) == 0} {return 0} ; set i [expr $qot(flood_num) - 1]
while {$i >= 1} {set qot_flood_array($i) $qot_flood_array([expr $i - 1]) ; incr i -1} ; set qot_flood_array(0) [unixtime]
if {[expr [unixtime] - $qot_flood_array([expr $qot(flood_num) - 1])] <= $qot(flood_time)} {putlog "Quotes - Flood detected from $nick. Ignoring for $qot(ignore_time) minutes." ; if {$qot(ignore)} {newignore [maskhost [getchanhost $nick]] Quote-TCL "$nick flooded the quote script." $qot(ignore_time)} ; return 1
} {return 0}
}
# moretools stuff. reason why they're here is to make the script easier for people to load. from mc.moretools1.2.tcl by MC_8
proc strip:color {ar} {
set argument ""
if {![string match *\003* $ar]} {return $ar} ; set i -1 ; set length [string length $ar]
while {$i < $length} {
if {[string index $ar $i] == "\003"} {
set wind 1 ; set pos [expr $i+1]
while {$wind < 3} {
if {[string index $ar $pos] <= 9 && [string index $ar $pos] >= 0} {
incr wind 1 ; incr pos 1} {set wind 3
}
}
if {[string index $ar $pos] == "," && [string index $ar [expr $pos + 1]] <= 9 &&
[string index $ar [expr $pos + 1]] >= 0} {
set wind 1 ; incr pos 1
while {$wind < 3} {
if {[string index $ar $pos] <= 9 && [string index $ar $pos] >= 0} {
incr wind 1 ; incr pos 1} {set wind 3
}
}
}
if {$i == 0} {
set ar [string range $ar $pos end]
set length [string length $ar]
} {
set ar "[string range $ar 0 [expr $i - 1]][string range $ar $pos end]"
set length [string length $ar]
}
set argument "$argument[string index $ar $i]"
} {incr i 1}
}
set argument $ar
return $argument
}
proc strip:bold {ar} {
set argument ""
if {[string match *\002* $ar]} {
set i 0
while {$i <= [string length $ar]} {
if {![string match \002 [string index $ar $i]]} {
set argument "$argument[string index $ar $i]"
} ; incr i 1
}
} {set argument $ar}
return $argument
}
proc strip:uline {ar} {
set argument ""
if {[string match *\037* $ar]} {
set i 0
while {$i <= [string length $ar]} {
if {![string match \037 [string index $ar $i]]} {
set argument "$argument[string index $ar $i]"
} ; incr i 1
}
} {set argument $ar}
return $argument
}
proc strip:reverse {ar} {
set argument ""
if {[string match *\026* $ar]} {
set i 0
while {$i <= [string length $ar]} {
if {![string match \026 [string index $ar $i]]} {
set argument "$argument[string index $ar $i]"
} ; incr i 1
}
} {set argument $ar}
return $argument
}
proc strip:all {ar} {
# return [strip:reverse [strip:uline [strip:bold [strip:color $ar]]]]
return [strip:reverse [strip:uline [strip:color $ar]]]
}
proc bold {} {return \002}
proc reverse {} {return \026}
proc color {} {return \003}
proc underline {} {return \037}
#moretools stuff end#
proc qot_help {nick uhost hand chan rest} {
global qot
putmsg $nick "LCQuote $qot(vershort)."
putmsg $nick "Все команды используются только на канале."
putmsg $nick "!ц <номер> - Показывает произвольную цитату или с заданным номером."
putmsg $nick "!+ц <текст> - Добавляет цитату в базу. Доступ: глобал/канал +o."
putmsg $nick "!-ц <номер> - Удаляет цитату с заданным номером. Доступ: глобал/канал +o."
putmsg $nick "!findquote <слово> - Ищет цитаты с заданным словом, и высылает результат по DCC."
putmsg $nick "!цитата - Показывает последнюю добавленную цитату."
putmsg $nick "!getquotes - Высылает пользователю базу цитат канала."
putmsg $nick "!getlqscript - Высылает пользователю tcl скрипт."
putlog "Quotes: $chan - $nick запросил помощь."
}
proc qot_random {nick uhost hand chan rest} {
global qot
if {[qot_flood $nick $uhost $chan]} {return 0}
if {[qot_fi $chan]} {return 0}
set qot_fd [open $qot(file)$chan.txt r]
for {set qot_cnt 0} { ![eof $qot_fd] } { incr qot_cnt 1 } {
gets $qot_fd qot_list($qot_cnt)
}
close $qot_fd
if {$rest==""} {
set qot_cnt [expr $qot_cnt - 1]
if {$qot_cnt == 0} {
putmsg $chan "$qot(noqn)"
return
}
putmsg $chan "\[[bold][expr $qot_cur + 1]\/[expr $qot_cnt][bold]\]: $qot_list([set qot_cur [rand [expr $qot_cnt]]])"
} else {
if {[string is integer $rest]} {
set qot_cnt [expr $qot_cnt - 1]
unset qot_list([expr $qot_cnt])
if {![info exists qot_list([expr {$rest} - 1])]} {
putmsg $chan "$qot(noqn)"
return
} else {
putmsg $chan "\[[bold]$rest\/[expr $qot_cnt][bold]\]: $qot_list([expr {$rest} - 1])"
return }}}
putlog "Quotes: $chan - $nick запросил цитату."
}
proc qot_fi {chan} { global qot ; if {![file exists $qot(file)$chan.txt]} { putmsg $chan "$qot(qfn)" ; return 1 } else { return 0 } }
proc qot_src {nick uhost hand chan rest} {
global qot
set checked [check_string $rest]
if {[qot_flood $nick $uhost $chan]} {return 0}
set qot_src(file) "quotesearch-results.txt"
catch { exec grep -i -n "$checked" $qot(file)$chan.txt > $qot_src(file) }
if {[file size $qot_src(file)] == 0} {
putmsg $chan "$nick, ничего не найдено."
exec rm $qot_src(file)
return
}
putmsg $nick "Результаты поиска отправлены по DCC."
dccsend $qot_src(file) $nick
exec rm $qot_src(file)
putlog "Quotes: $chan - $nick получает цитаты с $rest."
return
}
proc qot_addquote {nick uhost hand chan rest} {
global qot
set stripped [strip:all $rest]
if {$hand == "*"} { set hn \[$nick\] } else { set hn \[$hand\] }
set i 0
set boldz 0
while {$i <= [string length $stripped]} {
if {[string match \002 [string index $stripped $i]]} {incr boldz 1}
incr i 1
}
if {[expr $boldz%2] == 0} {} else { set hn "[bold]$hn" }
set stripped "$stripped $hn"
if {[string length $stripped] < 1} { return 0 }
set qot_fd [open $qot(file)$chan.txt a+]
puts $qot_fd $stripped
close $qot_fd
putnotc $nick "Цитата с $chan добавлена в базу."
putlog "Quotes: $chan - $nick добавил цитату."
return
}
proc qot_del {nick uhost hand chan rest} {
global qot
if {[qot_fi $chan]} {return 0}
set delnum $rest
set type [lindex $rest 0]
set rest [lrange $rest 1 end]
set qot_fd [open $qot(file)$chan.txt r]
for {set qot_cnt 0} { ![eof $qot_fd] } { incr qot_cnt 1 } {
gets $qot_fd qot_list($qot_cnt)
}
close $qot_fd
set qot_cnt [expr $qot_cnt - 2]
if {[string is integer $delnum]} {
set qot_fd [open $qot(file)$chan.txt w]
for { set i 0 } { $i <= $qot_cnt } { incr i 1 } {
if {($qot_list($i) == "") || ($i == [expr $delnum - 1])} {
putmsg $chan "Цитата [expr $i + 1] удалена."
putlog "Quotes: $chan - $nick удалил цитату $delnum."
continue
} else {
puts $qot_fd $qot_list($i)
}
}
close $qot_fd
}
return
}
proc qot_get {nick uhost hand chan args} {
global qot
if {[qot_flood $nick $uhost $chan]} {return 0}
if {[string length $args] > 0} { set gc $args } else { set gc $chan }
putlog "Quotes: $chan - $nick запросил базу с цитатами $gc."
putnotc $nick "База послана по DCC"
dccsend $qot(file)$gc.txt $nick
return
}
proc qot_script {nick uhost hand chan args} {
global qot
if {[qot_flood $nick $uhost $chan]} {return 0}
putlog "Quotes: $chan - $nick запросил скрипт."
putnotc $nick "Скрипт выслан по DCC."
dccsend $qot(package) $nick
return
}
proc qot_last {nick uhost hand chan arg} {
global qot
if {[qot_flood $nick $uhost $chan]} {return 0}
if {[qot_fi $chan]} {return 0}
set qot_fd [open $qot(file)$chan.txt r]
for {set qot_cnt 0} { ![eof $qot_fd] } { incr qot_cnt } {
gets $qot_fd qot_list($qot_cnt)
}
close $qot_fd
set qot_cnt [expr $qot_cnt - 2]
set qot(last) $qot_list([expr $qot_cnt])
putmsg $chan "Последняя цитата ([bold][expr $qot_cnt + 1][bold]): $qot(last)"
return
}
putlog "LCQuote 1.00 by lmrvsk@RusNet succesfully loaded."
Вроде бы последняя строка выводит...