Changeset 16


Ignore:
Timestamp:
10/04/06 18:17:48 (5 years ago)
Author:
notopic
Message:

direct search results correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • QuoteEngine/QuoteEngine.tcl

    r15 r16  
    2020# connect to database 
    2121# CHANGE ME 
    22 set db_handle [mysqlconnect -host localhost -user notopic -password moo -db quotes] 
     22proc quote_connect { } { 
     23        global db_handle 
     24                 
     25        set db_handle [mysqlconnect -host localhost -user notopic -password moo -db quotes] 
     26 
     27        if {$db_handle != ""} { 
     28                return 1 
     29        } else { 
     30                return 0 
     31        } 
     32} 
    2333 
    2434# url to site 
     
    4858# maximum number of quotes to show in channel when searching before switching 
    4959# to /msg'ing the user 
    50 set quote_chanmax 0 
     60set quote_chanmax 5 
    5161 
    5262### code starts here (no need to edit stuff below currently) 
     
    6979                return 1 
    7080        } else { 
    71                 return 0 
     81                return [quote_connect] 
    7282        } 
    7383} 
     
    291301      } 
    292302 
    293       if {$count < 5} { 
     303      if {$count < $quote_chanmax} { 
    294304        puthelp "PRIVMSG $channel :\[\002$id\002\] $quote" 
    295305      } else { 
     
    301311    set remaining [mysqlresult $db_handle rows?] 
    302312    if {$remaining > 0} { 
     313                        if {$count < $quote_chanmax} { 
     314                                set command "PRIVMSG $channel :" 
     315                        } else { 
     316                                set command "PRIVMSG $nick :" 
     317                        } 
     318 
    303319      regsub "#" $channel "" chan 
    304320      if {$php_page != ""} { 
    305         puthelp "PRIVMSG $channel :(Plus $remaining more matches: $php_page?filter=${text}&channel=${chan}&search=search)" 
     321        puthelp "${command}(Plus $remaining more matches: $php_page?filter=${text}&channel=${chan}&search=search)" 
    306322      } else { 
    307         puthelp "PRIVMSG $channel :Plus $remaining other matches" 
     323        puthelp "${command}Plus $remaining other matches" 
    308324      } 
    309325    } else { 
    310326      if {$count == 1} { 
    311         puthelp "PRIVMSG $channel :(All of 1 match)" 
     327        puthelp "${command}(All of 1 match)" 
    312328      } else { 
    313         puthelp "PRIVMSG $channel :(All of $count matches)" 
     329        puthelp "${command}(All of $count matches)" 
    314330      } 
    315331    } 
     
    487503} 
    488504 
     505quote_connect 
    489506putlog "QuoteEngine $quote_version loaded" 
Note: See TracChangeset for help on using the changeset viewer.