Ignore:
Timestamp:
01/25/08 09:27:34 (4 years ago)
Author:
notopic
Message:

autoquote fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • QuoteEngine/QuoteEngine.tcl

    r37 r38  
    4040 
    4141# minimum number of seconds between automatic quotes 
    42 set quote_automatic_minimum 7200 
     42set quote_automatic_minimum [expr 3 * 3600] 
    4343 
    4444# bind commands CHANGE as needed 
     
    219219  if {[set row [mysqlnext $result]] != ""} { 
    220220    set id [lindex $row 0] 
    221     set quote [lindex $row 3] 
     221                set quote [lindex $row 3] 
     222                catch { 
     223                        set quote [stripcodes bcruag $quote] 
     224                } 
    222225    set by [lindex $row 1] 
    223226    set when [clock format [lindex $row 5] -format "%Y/%m/%d %H:%M"] 
     
    521524        } 
    522525 
    523         global quote_auto_last db_handle 
     526        global quote_auto_last db_handle quote_automatic_minimum 
     527 
    524528        if [info exists quote_auto_last($channel)] { 
    525529                set diff [expr [clock seconds] - $quote_auto_last($channel)] 
     530                putloglev 1 * "diff for $channel is $diff" 
    526531        } else { 
    527                 set diff 3601 
     532                set diff [expr $quote_automatic_minimum + 1] 
     533                putloglev d * "initialising diff for $channel" 
    528534                set quote_auto_last($channel) 0 
    529535        } 
    530536 
    531         if {$diff < 3600} { 
     537        if {$diff < $quote_automatic_minimum} { 
    532538                return 
    533539        } 
     
    537543 
    538544        foreach word $words { 
    539                 if [regexp -nocase {^[a-z0-9']+$} $word] { 
    540                         if {[lsearch [list "about" "their" "there"] $word] > -1} { 
     545                if [regexp -nocase {^[a-z0-9']{4,}$} $word] { 
     546                        if {[lsearch [list "yeah" "about" "hello" "their" "there" "that's" "can't" "morning" "won't"] $word] > -1} { 
    541547                                continue 
    542548                        } 
     
    546552                        } 
    547553 
    548                         if {[string length $word] > 4} { 
    549                                 lappend newwords [mysqlescape $word] 
    550                         } 
     554                        lappend newwords [mysqlescape $word] 
    551555                } 
    552556        } 
Note: See TracChangeset for help on using the changeset viewer.