bind pubm - * url_pubm
bind pub -|- !web url_pub
set urllogfilename "urllog.data"
proc url_pubm {nick host handle channel text} {
global urllogfilename
foreach word [split $text] {
if {[string length $word] >= 5 && [regexp {^(f|ht)tp(s|)://} $word] && ![regexp {://([^/:]*:([^/]*@|\d+(/|$))|.*/\.)} $word]} {
set day [clock format [clock sec] -format %D]
regsub -all {/} $day "" day
set file [open $urllogfilename a]
puts $file "$day $word"
close $file
}
}
proc url_pub {nick host handle channel text} {
global urllogfilename
if {[file exists $urllogfilename]&& [file readable $urllogfilename]} {
set fp [open $urllogfilename r]
set data [read $fp]
close $fp
foreach line [split $data \n] {
if {$text == ""} {
set text [clock format [clock sec] -format %D]
regsub -all {/} $text "" text
}
if {[lindex [split $line] 0] == $text} {
putserv "PRIVMSG $channel :line"
}
}
}
}
Code: Select all
bind pubm - * url_pubm
bind pub -|- !web url_pub
set urllogfilename "urllog.data"
proc url_pubm {nick host handle channel text} {
global urllogfilename
foreach word [split $text] {
if {[string length $word] >= 5 && [regexp {^(f|ht)tp(s|)://} $word] && ![regexp {://([^/:]*:([^/]*@|\d+(/|$))|.*/\.)} $word]} {
set day [clock format [clock sec] -format %D]
regsub -all {/} $day "" day
set file [open $urllogfilename a]
puts $file "$day $word"
close $file
}
}
}
proc url_pub {nick host handle channel text} {
global urllogfilename
if {[file exists $urllogfilename]&& [file readable $urllogfilename]} {
set fp [open $urllogfilename r]
set data [read $fp]
close $fp
foreach line [split $data \n] {
if {$text == ""} {
set text [clock format [clock sec] -format %D]
regsub -all {/} $text "" text
}
if {[lindex [split $line] 0] == $text} {
putserv "PRIVMSG $nick :$line"
}
}
}
}Code: Select all
<Chasse> 01262010 http://www.youtube.com/watch?v=iyGBBIKS4f8Code: Select all
bind pubm - * url_pubm
bind pub -|- !web url_pub
set urllogfilename "urllog.data"
proc url_pubm {nick host handle channel text} {
global urllogfilename
  foreach word [split $text] {
    if {[string length $word] >= 5 && {[regexp {^(f|ht)tp(s|)://} $word] || [regexp {^www//} $word]}&& ![regexp {://([^/:]*:([^/]*@|\d+(/|$))|.*/\.)} $word]} {
      set day [clock format [clock sec] -format %D]
      regsub -all {/} $day "" day
      set file [open $urllogfilename a]
      puts $file "$day - $word - $nick - $host"
      close $file
    }
  }
}
proc url_pub {nick host handle channel text} {
global urllogfilename
  if {[file exists $urllogfilename]&& [file readable $urllogfilename]} {
    set fp [open $urllogfilename r]
    set data [read $fp]
    close $fp
    foreach line [split $data \n] {
      if {$text == ""} {
      set text [clock format [clock sec] -format %D]
      regsub -all {/} $text "" text
    }
    if {[lindex [split $line] 0] == $text} {
        putserv "PRIVMSG $nick :$line"
    }
    }
  }
}
Code: Select all
bind pubm - * url_pubm
bind pub -|- !web url_pub
set urllogfilename "urllog.data"
proc url_pubm {nick host handle channel text} {
global urllogfilename
  foreach word [split $text] {
    if {[string length $word] >= 5 && {[regexp {^(f|ht)tp(s|)://} $word] || [regexp {^www//} $word]}&& ![regexp {://([^/:]*:([^/]*@|\d+(/|$))|.*/\.)} $word]} {
      set day [clock format [clock sec] -format %D]
      regsub -all {/} $day "" day
    if {[url_existstitle "$word"] eq "1"} {
        putlog "$word already exists in $urllogfilename"
        return 0
    } else {
      set file [open $urllogfilename a]
      puts $file "$day - $word - $nick - $host"
      close $file
    }
    }
  }
}
proc url_pub {nick host handle channel text} {
global urllogfilename
  if {[file exists $urllogfilename]&& [file readable $urllogfilename]} {
    set fp [open $urllogfilename r]
    set data [read $fp]
    close $fp
    foreach line [split $data \n] {
      if {$text == ""} {
      set text [clock format [clock sec] -format %D]
      regsub -all {/} $text "" text
    }
    if {[lindex [split $line] 0] == $text} {
        putserv "PRIVMSG $nick :$line"
    }
    }
  }
}
    proc url_existstitle {query} {
global urllogfilename
    set file [open $urllogfilename r]
    set data [read $file]
    close $file
        foreach line [split $data \n] {
        if {![string match -nocase "*$query*" "*$line*"]} {
            continue
        }
        if {[string match -nocase "*$query*" "*$line*"]} {
            catch {unset data}
            return 1
        }
    }
    catch {unset data}
    return 0
    }Code: Select all
<Chasse> [14:18] Tcl error [url_pubm]: expected boolean value but got "[regexp {^(f|ht)tp(s|)://} $word] || [regexp {^www"
<\Nor7on> .set errorInfo
<Chasse> Currently: expected boolean value but got "[regexp {^(f|ht)tp(s|)://} $word] || [regexp {^www"
<Chasse> Currently:     while executing
<Chasse> Currently: "if {[string length $word] >= 5 && {[regexp {^(f|ht)tp(s|)://} $word] || [regexp {^www//} $word]}&& ![regexp {://([^/:]*:([^/]*@|\d+(/|$))|.*/\.)} $wor..."
<Chasse> Currently:     (procedure "url_pubm" line 5)
<Chasse> Currently:     invoked from within
<Chasse> Currently: "url_pubm $_pubm1 $_pubm2 $_pubm3 $_pubm4 $_pubm5"
bind pubm - * url_pubm
bind pub -|- !web url_pub
set urllogfilename "urllog.data"
proc url_pubm {nick host handle channel text} {
global urllogfilename
foreach word [split $text] {
if {[string length $word] >= 5 && ([regexp {^(f|ht)tp(s|)://} $word] || [regexp "www." $word]) && ![regexp {://([^/:]*:([^/]*@|\d+(/|$))|.*/\.)} $word]} {
set day [clock format [clock sec] -format %D]
regsub -all {/} $day "" day
if {[url_existstitle "$word"] eq "1"} {
putlog "$word already exists in $urllogfilename"
return 0
} else {
set file [open $urllogfilename a]
puts $file "$day - $word - $nick - $host"
close $file
}
}
}
}
proc url_pub {nick host handle channel text} {
global urllogfilename
if {[file exists $urllogfilename] && [file readable $urllogfilename]} {
set fp [open $urllogfilename r]
set data [read $fp]
close $fp
foreach line [split $data \n] {
if {$text == ""} {
set text [clock format [clock sec] -format %D]
regsub -all {/} $text "" text
}
if {[lindex [split $line] 0] == $text} {
putserv "PRIVMSG $nick :$line"
}
}
}
}
proc url_existstitle {query} {
global urllogfilename
set file [open $urllogfilename r]
set data [read $file]
close $file
foreach line [split $data \n] {
if {![string match -nocase "*$query*" "*$line*"]} {
continue
}
if {[string match -nocase "*$query*" "*$line*"]} {
catch {unset data}
return 1
}
}
catch {unset data}
return 0
}