# delquote.tcl v0.0001b synapze
# Removes quotes from quote.txt
# Using a bash backend

set delquote /home/synapze/benzos/scripts/delquote.sh
set qfile /home/synapze/benzos/scripts/quote.txt
set tmpfile /home/synapze/benzos/scripts/quote.txt.tmp
set qlog /home/synapze/benzos/scripts/quote.log

bind pub m !delquote quote:pub:delquote

proc quote:pub:delquote {nick uhost hand chan arg} {
 global tmpfile
 global delquote
 global qlog
 global qfile

 if { $arg == "" } {
  putnotc $nick "Usage: !delquote <quote>"
  return 0
 }
 while {![eof [open $qfile r]]} {
 set line [gets [open $qfile r]]
 if {![string match $line $arg]} {
  puts [open $tmpfile w] $line
  }
 close $qfile
 close $tmpfile
 file copy $tmpfile $qfile
 file delete $tmpfile
 putnotc $nick "Chi Chinga..."
 set filea [open $qlog w]
 puts $filea "$nick ($uhost) of $chan Deleted: $arg"
 close $filea
 close $qlog
 return 1
}

putlog "delquote.tcl v0.0001b by synapze loaded.."

 }