Changeset 46
- Timestamp:
- 02/11/11 14:38:05 (16 months ago)
- Location:
- QuoteEngine
- Files:
-
- 5 added
- 1 edited
- 4 moved
-
QuoteEngine-settings.sample.tcl (added)
-
QuoteEngine.tcl (modified) (7 diffs)
-
README (added)
-
sql (added)
-
sql/quotes.sql (added)
-
www (added)
-
www/index.php (moved) (moved from QuoteEngine/index.php)
-
www/ocean.css (moved) (moved from QuoteEngine/ocean.css)
-
www/settings.example.inc (moved) (moved from QuoteEngine/settings.example.inc)
-
www/styles.css (moved) (moved from QuoteEngine/styles.css)
Legend:
- Unmodified
- Added
- Removed
-
QuoteEngine/QuoteEngine.tcl
r43 r46 10 10 11 11 # load the extension 12 # CHANGE ME: My main bot's server has broken TCL, so I need the line below:13 #load /usr/local/lib/mysqltcl-2.12/libmysqltcl2.12.so14 #load /home/notopic/lib/mysqltcl-2.50/libmysqltcl2.50.so15 # BUT most people should get away with this if their server's setup right:16 12 package require mysqltcl 17 13 18 # Use only one or other of the above! 19 20 # connect to database 21 # CHANGE ME 22 proc 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 } 33 34 # url to site 35 # CHANGE ME (use blank if you're not using the PHP script) 36 set php_page "http://sakaki.jamesoff.net/~notopic/" 37 38 # automatically spew "relevant" quotes? 39 set quote_automatic 1 40 41 # minimum number of seconds between automatic quotes 42 set quote_automatic_minimum [expr 3 * 3600] 43 44 # bind commands CHANGE as needed 14 # Make sure you edit the sample settings file and save it as "QuoteEngine-settings.tcl" 15 # in the eggdrop scripts directory! 16 source "scripts/QuoteEngine-settings.tcl" 17 18 # bind commands CHANGE as needed to set who can use 45 19 # use ".chanset #channel [+/-]quoteengine" to enable/disable individual 46 20 # channels … … 60 34 bind pubm "-|ov" * quote_auto 61 35 62 # a user with this flag(s) can't use the script at all 63 set quote_noflags "Q|Q" 64 65 # maximum number of quotes to show in channel when searching before switching 66 # to /msg'ing the user 67 set quote_chanmax 5 68 69 # shrink multiple spaces to single spaces when fetching a quote? 70 set quote_shrinkspaces 1 71 72 ### code starts here (no need to edit stuff below currently) 73 #1.00 74 set quote_version "cvs" 36 ################################################################################ 37 #No need to edit beyond this point 38 ################################################################################ 39 40 set quote_version "1.3" 75 41 set quote_auto_last(blah) 0 76 42 … … 78 44 setudef flag quoteengine 79 45 80 ### procedures start here 46 # connect to database 47 proc quote_connect { } { 48 global db_handle quote_db 49 50 set db_handle [mysqlconnect -host $quote_db(host) -user $quote_db(user) -password $quote_db(password) -db $quote_db(database)] 51 52 if {$db_handle != ""} { 53 return 1 54 } else { 55 return 0 56 } 57 } 81 58 82 59 ################################################################################ … … 275 252 ################################################################################ 276 253 proc quote_search { nick host handle channel text } { 277 global db_handle php_page quote_noflags quote_chanmax254 global db_handle quote_webpage quote_noflags quote_chanmax 278 255 279 256 if {![channel get $channel quoteengine]} { … … 348 325 349 326 regsub "#" $channel "" chan 350 if {$ php_page != ""} {351 puthelp "${command}(Plus $remaining more matches: $ php_page?filter=${text}&channel=${chan}&search=search)"327 if {$quote_webpage != ""} { 328 puthelp "${command}(Plus $remaining more matches: $quote_webpage?filter=${text}&channel=${chan}&search=search)" 352 329 } else { 353 330 puthelp "${command}Plus $remaining other matches" … … 377 354 ################################################################################ 378 355 proc quote_url { nick host handle channel text } { 379 global php_page quote_noflags380 381 if {![channel get $channel quoteengine]} { 382 return 0 383 } 384 385 if [matchattr $handle $quote_noflags] { return 0 } 386 387 if {$ php_page != ""} {356 global quote_webpage quote_noflags 357 358 if {![channel get $channel quoteengine]} { 359 return 0 360 } 361 362 if [matchattr $handle $quote_noflags] { return 0 } 363 364 if {$quote_webpage != ""} { 388 365 # changed for better url by dubkat 389 puthelp "PRIVMSG $channel :${ php_page}?channel=[string range $channel 1 end]"366 puthelp "PRIVMSG $channel :${quote_webpage}?channel=[string range $channel 1 end]" 390 367 } else { 391 368 puthelp "PRIVMSG $channel :Not available." … … 615 592 } 616 593 617 putlog "RANDOM QUOTE: $quote ($id)"594 putloglev d * "RANDOM QUOTE: $quote ($id)" 618 595 puthelp "PRIVMSG $channel :\[\002$id\002\] $quote" 619 596 set quote_auto_last($channel) [clock seconds]
Note: See TracChangeset
for help on using the changeset viewer.
