home *** CD-ROM | disk | FTP | other *** search
/ Hackers Toolkit v2.0 / Hackers_Toolkit_v2.0.iso / HTML / archive / TCL / find1.1.1.tcl < prev    next >
Text File  |  1999-11-04  |  23KB  |  605 lines

  1. #########
  2. # @Find`r 1.1.1 by MC_8 for #warez4free <gregory@worldinter.net>
  3. # report bugs to gregory@worldinter.net
  4. # ######
  5. #  If you don't like the header, SUCK IT!
  6. # ######
  7. # Thanks to:
  8. #  BASS - helped me a bunch
  9. #  IsP  - if he will ever fuken look at the script, he migh modify it a lil more!!
  10. ########
  11. # What does this script do, hmm, well... lets say someone is looking for a star trek game,
  12. # well.. IF (and only if) soneone has inputed into the data base where they can get a 
  13. # star trek game at, then it will return it to them, eg:
  14. #
  15. # ADDING it:
  16. #-> *oCHANMAXo* addfind star trek the series, multimedia game, version 1.5, you can /msg MC_8 for it or ftp to 209.228.55.48
  17. #-oCHANMAXo- Adding {star trek the series, multimedia game, version 1.5, you can /msg MC_8 for it or ftp to 209.228.55.48}...
  18. #-oCHANMAXo- Done...
  19. #
  20. # FINDING it:
  21. #<MC_8> @find *star*trek*
  22. #-oCHANMAXo- I found 1 match to your search for '*star*trek*'...
  23. #-oCHANMAXo- 1) star trek the series, multimedia game, version 1.5, you can /msg mc_8 for it or ftp to 209.228.55.48
  24. #-oCHANMAXo- --to add something, do: /msg oCHANMAXo addfind <something>
  25. #
  26. # there, pretty simple eh? if you have any suggestions or comments or bad thoughts
  27. # about this script, e`mail me at gregory@worldinter.net .. I would like to hear!
  28. #
  29. # DO NOT ERASE ANYTHING ON THIS FILE, IF YOU MODIFY IT, PLEASE SEND A COPY TO ME AND ADD YOUR
  30. # NAME TO THE TITLE, AND ADD YOUR INFO STUFF TO THE VERSION CHANGES BELOW
  31. # BASICLY I OWN THIS NOT YOU, BUT GOOD SCRIPTS DON'T STEAL NOW DAYS.. DO THEY?
  32. #
  33. #########
  34. #  Version Changes:
  35. #
  36. # V. 1.1.1
  37. # - added a pub command of !<botnick> to dcc send the list. (also included !list, does same thing)
  38. # - fixed some wordings...
  39. # - removed the dllist MSG command that was only for ops, now it's pub.
  40. # - added "not found, request was recorded.." suggested by PRiMoGeN
  41. #
  42. # V. 1.1.0
  43. # - added the wildcards on search (should of done that first of all du!)
  44. # - added dcc command 'findstat'
  45. # - added flood protection, thanks to bseen1.4.0.tcl
  46. # - fixed the msg FINDADD...
  47. # - fixed it's dcc putloglev
  48. # - fixed bugs on the 'match_limit'
  49. # - added a not found list (to let ya know what your search`r is lacking)
  50. # - added database limit, over write older files on exceed limit  (suggested by Bass <=- dat f00l know's more dan you so shut up!)
  51. # - added a command so +o users can down load the search file, making it easier to see everything
  52. #
  53. # V. 1.0.0
  54. # - first release
  55. #
  56. #  To Do:
  57. #
  58. #########
  59. #  COMMANDS
  60. #
  61. # DCC
  62. #  (anyone)   : find <*what*ever*>      - finds stuff du
  63. #  (anyone)   : search <*what*ever*>    - finds stuff du
  64. #  (anyone)   : addfind <program name> [description or some keywords] <WHERE TO GET IT AT>
  65. #                                       - adds an entrie
  66. #  (anyone)   : findadd <program name> [description or some keywords] <WHERE TO GET IT AT>
  67. #                                       - adds an entrie
  68. #  (+o users) : dllist <to who>         - download the list
  69. #  (+o users) : delfind <number>        - deleate a line (the list will show number, or dcc's '.find *' will show you the number)
  70. #  (+o users) : finddel <number>        - deleate a line (the list will show number, or dcc's '.find *' will show you the number)
  71. #  (+o users) : findstat                - current stats (resets on rehash/restart/start-up)
  72. #  (+o users) : findstats               - current stats (resets on rehash/restart/start-up)
  73. # PUB
  74. #  (anyone)   : @find <*what*ever*>     - finds stuff du
  75. #  (anyone)   : @search <*what*ever*>   - finds stuff du
  76. #  (anyone)   : !<botnick>              - sends the list
  77. #  (anyone)   : !list                   - sends the list
  78. # MSG
  79. #  (anyone)   : addfind <program name> [description or some keywords] <WHERE TO GET IT AT>
  80. #                                       - adds an entrie
  81. #  (anyone)   : findadd <program name> [description or some keywords] <WHERE TO GET IT AT>
  82. #                                       - adds an entrie
  83. #  (+o users) : delfind <number>        - deleate a line (the list will show number, or dcc's '.find *' will show you the number)
  84. #  (+o users) : finddel <number>        - deleate a line (the list will show number, or dcc's '.find *' will show you the number)
  85. #
  86. #########
  87. #   Stuff You Need To Set (if you want to, it's set to default already, and default is 
  88. #                                                                 what I use on my bot)
  89. #
  90. # This is protection so you don't get flooded off, when searching for a something really
  91. # open, like *a*, this setting will only show the first (what ever # you put) (5 is default)
  92. # and then say you need to limit your search, and stop...
  93. set match_limit 6
  94. #
  95. # Set this to the maximum number of entries that will be able to exist in the database,
  96. # if a new entrie is inputed, and the database is already at "what you set", then it will
  97. # just over write the oldest entrie to make room (considering it was hard enought to 
  98. # find and input 75 entries, I think 4000 is VERY sufficent ;) )
  99. set databaselimit 4000
  100. #
  101. # Set this to what you want the data file to be named, default 'datafile'...
  102. set datafile "datafile"
  103. #
  104. # [0 = no/1 = yes] Do you want to record the searches not found? (#1 this could be good
  105. # if you wanna know what your find`r isn't finding, #2 this can use up alot of space if
  106. # you don't check it ever so often and deleate it (deleation/viewing has to be done via 
  107. # telnet or ftp to the shell) if I get any requests, I will update the script to allow 
  108. # remote deletion of the file, like in '.delfind #'...) anyhow, I threw it in for me, if 
  109. # you don't want it, just set it to 0
  110. set notfoundlist 1
  111. #
  112. # Set this to what you want the not found data file to be named, default 'notfoundfile'
  113. # if the above 'notfoundlist' is 0, then this variable should be left alone :)
  114. set notfoundfile "notfoundfile"
  115. #
  116. # [0 = no/1 = yes] Do you want to display an onjoin msg telling that @find is available?
  117. set onjoinmsg 1
  118. #
  119. # Set this to the channels you want it to on join msg to, if the above setting is turned
  120. # off, then don't worry about it... example:
  121. # set channels "#warez4free #channel2 #channel3"
  122. # you can put as many channel in as you want, jut put a space inbetween them...
  123. set channels "#warez4free"
  124. #
  125. #mc(flood) is used for flood protection, in the form x:y.  Any queries
  126. #  beyond x in y seconds is considered a flood and ignored.
  127. set mc(flood) 5:10
  128. #
  129. #mc(ignore) is used as a switch for ignoring flooders (1=on)
  130. set mc(ignore) 1
  131. #
  132. #mc(ignore_time) is used to define the amount of time a flooder is 
  133. #  ignored (minutes).  This is meaningless if bs(ignore) is 0.
  134. set mc(ignore_time) 1
  135. #
  136. ##############
  137. ### Do Not Edit Past This Part ###
  138. set find_ver "1.1.1"
  139. ## This section out of Bass's bseen1.4.0.tcl ##
  140. proc mc_flood_init {} {
  141.  global mc mc_flood_array find_ver
  142.  if {![string match *:* $mc(flood)]} {
  143.   putlog "9,1+@find`r $find_ver: var mc(flood) not set correctly!" 
  144.   return
  145.  }
  146.  set mc(flood_num) [lindex [split $mc(flood) :] 0] 
  147.  set mc(flood_time) [lindex [split $mc(flood) :] 1] 
  148.  set i [expr $mc(flood_num) - 1]
  149.  while {$i >= 0} {
  150.   set mc_flood_array($i) 0 
  151.   incr i -1 
  152.  }
  153.  putlog "9,1 @find`r's flood protection, initalized (WoW, big word)..."
  154. proc mc_flood {nick uhost} {
  155.  global mc mc_flood_array find_ver stat_flood
  156.  if {$mc(flood_num) == 0} {
  157.   return 0
  158.  }
  159.  set i [expr $mc(flood_num) - 1]
  160.  while {$i >= 1} {
  161.   set mc_flood_array($i) $mc_flood_array([expr $i - 1]) 
  162.   incr i -1
  163.  } 
  164.  set mc_flood_array(0) [unixtime]
  165.  if {[expr [unixtime] - $mc_flood_array([expr $mc(flood_num) - 1])] <= $mc(flood_time)} {
  166.   putlog "9,1 @find`r's $find_ver: Flood detected from $nick."
  167.   incr stat_flood 1
  168.   if {$mc(ignore)} {
  169.    newignore [maskhost *!*[string trimleft $uhost ~]] @find`r flood $mc(ignore_time)
  170.   } 
  171.   return 1
  172.  } {
  173.   return 0
  174.  }
  175. }
  176. ## End of the frood protection pulled from bseen1.4.0.tcl ((Bass you rule)) ##
  177. bind dcc o|o findstat mc:find
  178. bind dcc o|o findstats mc:find
  179. proc mc:find {hand idx args} {
  180.  global databaselimit notfoundlist stat_hits stat_found stat_not stat_notice stat_add stat_remove find_ver stat_flood number
  181.  putdcc $idx "9,1Current stats for @find`r v $find_ver are as follows:"
  182.  putdcc $idx "- Total @find hits =                12$stat_hits"
  183.  putdcc $idx "- Hits found =                      12$stat_found"
  184.  if {$notfoundlist == 1 } {
  185.   putdcc $idx "- Hits not found =                  13$stat_not -=- Recorded!"
  186.  } {
  187.   putdcc $idx "- Hits not found =                  13$stat_not"
  188.  }
  189.  if {[expr [expr $stat_hits - $stat_found] - $stat_not] == 0} {
  190.   putdcc $idx "- Total mismatched =                12OK"
  191.  } {
  192.   putdcc $idx "- Total mismatched =                13[expr [expr $stat_hits - $stat_found]]"
  193.  }
  194.  putdcc $idx "- Times noticed for onjoin =        12$stat_notice"
  195.  putdcc $idx "- Total erased =                    12$stat_remove"
  196.  putdcc $idx "- Total added =                     12$stat_add"
  197.  putdcc $idx "- # of ppl found flooding =         13$stat_flood"
  198.  if {$number < 6} {
  199.   putdcc $idx "- # of entries in database =        13$number/$databaselimit"
  200.  } {
  201.   putdcc $idx "- # of entries in database =        12$number/$databaselimit"
  202.  }
  203.  putdcc $idx "_____________________DONE_____________________"
  204. }
  205. proc find_filt {data} {
  206.   regsub -all -- \\\\ $data \\\\\\\\ data ; regsub -all -- \\\[ $data \\\\\[ data ; regsub -all -- \\\] $data \\\\\] data
  207.   regsub -all -- \\\} $data \\\\\} data ; regsub -all -- \\\{ $data \\\\\{ data ; regsub -all -- \\\" $data \\\\\" data ; return $data
  208. }
  209. if {$onjoinmsg == 1} { bind join -|- *!*@* mc:join }
  210. proc mc:join {nick uhost hand chan} {
  211.  global channels number find_ver botnick match_limit datafile stat_hits stat_found stat_not stat_notice stat_add stat_remove
  212.  if {$nick == $botnick} { return 0 }
  213.  foreach channels2 $channels {
  214.   if {[string tolower $channels2] == [string tolower $chan]} {
  215.    incr stat_notice 1
  216.    putserv "NOTICE $nick :Welcome to $chan, We have a @find`r (v. $find_ver) available for your use"
  217.    putserv "NOTICE $nick :just type '@find *what*ever*' in the channel, and I'll search my database for ya"
  218.    if {$number == 1} {
  219.     putserv "NOTICE $nick :-- I am currently tracking 1 entrie in my database, kinda low :("
  220.    }
  221.    if {$number <= 20 && $number != 1} {
  222.     putserv "NOTICE $nick :-- I am currently tracking $number entries in my database, kinda low :("
  223.    }
  224.    if {$number > 20} {
  225.     putserv "NOTICE $nick :-- I am currently tracking $number entries in my database"
  226.    }
  227.    putserv "NOTICE $nick :If you would like to add something, feel free, just type: /msg $botnick findadd <program name> \[description or some keywords\] <WHERE TO GET IT AT>"
  228.   }
  229.  }
  230. }
  231. bind dcc -|- find MC:find:dcc
  232. bind dcc -|- search MC:find:dcc
  233. proc MC:find:dcc {hand idx args} {
  234.  global notfoundlist number find_ver botnick match_limit datafile stat_hits 
  235.  global stat_not stat_notice stat_add stat_remove stat_found
  236.  if {![file exists $datafile]} {
  237.   putdcc $idx "The Search file hasn't been created yet, sorry..."
  238.   return 0
  239.  }
  240.  set matches 0
  241.  set match ""
  242.  if {[catch {exec grep "" $datafile}]} {
  243.   putdcc $idx "UNEXPECTED ERROR, TELL MC_8 AT ONCE! (error code 1)"
  244.   return 0
  245.  }
  246.  set mc_list [split [exec grep "" $datafile] \n]
  247.  set arg1 "*[string trimright [string trimleft [find_filt [string tolower [lindex $args 0]]] *] *]*"
  248.  incr stat_hits 1
  249.  foreach wind $mc_list {
  250.   if {[string match $arg1 $wind]} {
  251.    incr matches 1
  252.    set match "$match $wind"
  253.   }
  254.  }
  255.  if {$matches == 0} {
  256.   putdcc $idx "I'm sorry, I did not find any matches for '$arg1', make your search shorter maby?"
  257.   if {$notfoundlist == 1 } {
  258.    putdcc $idx "* Your request was recorded, and will be found and inputed asap"
  259.    notfoundlist "DCC: \[[date] [time]\] <$hand> $arg1"
  260.   }
  261. #  putdcc $idx "--This script brought to you by #warez4free"
  262.   putdcc $idx "--to add something, type: .addfind <program name> \[description or some keywords\] <WHERE TO GET IT AT>"
  263.   unset mc_list
  264.   incr stat_not 1
  265.   putcmdlog "#$hand# find $arg1"
  266.   return 0
  267.  }
  268.  if {$matches == 1} {
  269.   putdcc $idx "I found $matches match to your search for '$arg1'..."
  270.  } {
  271.   putdcc $idx "I found $matches matches to your search for '$arg1'..."
  272.  }
  273.  set i 1
  274.  foreach item $match {
  275.   putdcc $idx "$i) $item"
  276.   incr i
  277.  }
  278.  incr stat_found 1
  279. # putdcc $idx "--This script brought to you by #warez4free"
  280.  putdcc $idx "--to add something, type: .addfind <program name> \[description or some keywords\] <WHERE TO GET IT AT>"
  281.  unset mc_list
  282.  return 1
  283. }
  284. bind pub - @find MC:find:pub
  285. bind pub - @search MC:find:pub
  286. proc MC:find:pub {nick uhost hand chan args} {
  287.  if {[mc_flood $nick $uhost]} {return 0}
  288.  global number notfoundlist find_ver botnick match_limit datafile stat_hits stat_found stat_not stat_notice stat_add stat_remove
  289.  if {![file exists $datafile]} {
  290.   putserv "NOTICE $nick :The Search file hasn't been created yet, sorry..."
  291.   return 0
  292.  }
  293.  set matches 0
  294.  set match ""
  295.  if {[catch {exec grep "" $datafile}]} {
  296.   putserv "NOTICE $nick :UNEXPECTED ERROR, TELL MC_8 AT ONCE! (error code 1.2)"
  297.   return 0
  298.  }
  299.  set mc_list [split [exec grep "" $datafile] \n]
  300.  set arg1 "*[string trimright [string trimleft [find_filt [string tolower [lindex $args 0]]] *] *]*"
  301.  incr stat_hits 1
  302.  foreach wind $mc_list {
  303.   if {[string match $arg1 $wind]} {
  304.    incr matches 1
  305.    set match "$match $wind"
  306.   }
  307.  }
  308.  if {$matches == 0} {
  309.   putserv "NOTICE $nick :I'm sorry, I did not find any matches for '$arg1', make your search shorter maby?"
  310.   if {$notfoundlist == 1 } {
  311.    putserv "NOTICE $nick :* Your request was recorded, and will be found and inputed asap"
  312.    notfoundlist "$chan: \[[date] [time]\] <$nick> $arg1"
  313.   }
  314. #  if {"[string tolower $chan]" != "#warez4free"} {
  315. #   putserv "NOTICE $nick :--This script brought to you by #warez4free"
  316. #  }
  317.   putserv "NOTICE $nick :--to add something, Type: /msg $botnick addfind <program name> \[description or some keywords\] <WHERE TO GET IT AT>"
  318.   unset mc_list
  319.   incr stat_not 1
  320.   return 0
  321.  }
  322.  if {$matches == 1} {
  323.   putserv "NOTICE $nick :I found $matches match to your search for '$arg1'..."
  324.  } {
  325.   putserv "NOTICE $nick :I found $matches matches to your search for '$arg1'..."
  326.  }
  327.  set i 1
  328.  foreach item $match {
  329.   putserv "NOTICE $nick :$i) $item"
  330.   if {$i == $match_limit} {
  331.    if {$i != $matches} {
  332.     putserv "NOTICE $nick :To many matches, please make you search a lil more selective"
  333.     putserv "NOTICE $nick : \[$i of $matches displayed\]"
  334. #    if {"[string tolower $chan]" != "#warez4free"} {
  335. #     putserv "NOTICE $nick :--This script brought to you by #warez4free"
  336. #    }
  337.     putserv "NOTICE $nick :--to add something, type: /msg $botnick addfind <program name> \[description or some keywords\] <WHERE TO GET IT AT>"
  338.     incr stat_found 1
  339.     return 2
  340.    }
  341.   }
  342.   incr i
  343.  }
  344.  incr stat_found 1
  345. # if {"[string tolower $chan]" != "#warez4free"} {
  346. #  putserv "NOTICE $nick :--This script brought to you by #warez4free"
  347. # }
  348.  putserv "NOTICE $nick :--to add something, type: /msg $botnick addfind <program name> \[description or some keywords\] <WHERE TO GET IT AT>"
  349.  unset mc_list
  350.  return 2
  351. }
  352. bind dcc -|- addfind MC:addfind
  353. bind dcc -|- findadd MC:addfind
  354. proc MC:addfind {hand idx args} {
  355.  global databaselimit number datafile stat_add stat_remove
  356.  set arg1 "[concat [string tolower $args]]"
  357.  if {[lindex [lindex $arg1 0] 1] == ""} {
  358.   putdcc $idx "SYNTAX: .addfind <program name> \[description or some keywords\] <WHERE TO GET IT AT>"
  359.   return 0
  360.  }
  361.  if {![split [catch {exec grep $arg1 $datafile}] \n]} {
  362.   putdcc $idx "$arg1 already exists..."
  363.   return 0
  364.  }
  365.  if {$number >= $databaselimit} {
  366.   set row 0 
  367.   set oldfind [getfind $datafile]
  368.   if {[expr $row >= 0] && [expr $row < [llength $oldfind]]} {
  369.    set newfinds [lreplace $oldfind $row $row]
  370.    set fileio [open $datafile "w"]
  371.    foreach item $newfinds {
  372.     puts $fileio $item
  373.    }
  374.    flush $fileio
  375.    close $fileio
  376.    incr stat_remove 1
  377.   }
  378.   exec echo [string tolower $args] >> $datafile
  379.   putdcc $idx "I hope you added where to get it at, if you didnt, this will be deleated!"
  380.   putdcc $idx "Added..."
  381.   incr stat_add 1
  382.  } {
  383.   exec echo [string tolower $args] >> $datafile
  384.   putdcc $idx "I hope you added where to get it at, if you didnt, this will be deleated!"
  385.   putdcc $idx "Added..."
  386.   incr number 1
  387.   incr stat_add 1
  388.  }
  389. }
  390. bind msg - addfind MC:addfind:msg
  391. bind msg - findadd MC:addfind:msg
  392. proc MC:addfind:msg {nick uhost hand args} {
  393.  global number databaselimit find_ver botnick match_limit datafile stat_hits stat_found stat_not stat_notice stat_add stat_remove
  394.  if {[mc_flood $nick $uhost]} {return 0}
  395.  set arg1 "[concat [string tolower $args]]"
  396.  if {[lindex [lindex $arg1 0] 1] == ""} {
  397.   puthelp "PRIVMSG $nick :SYNTAX: /msg $botnick addfind <program name> \[description or some keywords\] <WHERE TO GET IT AT>"
  398.   return 0
  399.  }
  400.  if {![split [catch {exec grep $arg1 $datafile}] \n]} {
  401.   puthelp "NOTICE $nick :$arg1 already exists..."
  402.   return 0
  403.  }
  404.  if {$number >= $databaselimit} {
  405.   set row 0 
  406.   set oldfind [getfind $datafile]
  407.   if {[expr $row >= 0] && [expr $row < [llength $oldfind]]} {
  408.    set newfinds [lreplace $oldfind $row $row]
  409.    set fileio [open $datafile "w"]
  410.    foreach item $newfinds {
  411.     puts $fileio $item
  412.    }
  413.    flush $fileio
  414.    close $fileio
  415.    incr stat_remove 1
  416.   }
  417.   exec echo [string tolower $args] >> $datafile
  418.   puthelp "NOTICE $nick :Adding $args..."
  419.   puthelp "NOTICE $nick :I hope you added where to get it at, if you didnt, this will be deleated!"
  420.   puthelp "NOTICE $nick :Done..."
  421.   incr stat_add 1
  422.  } {
  423.   exec echo [string tolower $args] >> $datafile
  424.   puthelp "NOTICE $nick :Adding $args..."
  425.   puthelp "NOTICE $nick :I hope you added where to get it at, if you didnt, this will be deleated!"
  426.   puthelp "NOTICE $nick :Done..."
  427.   incr number 1
  428.   incr stat_add 1
  429.  }
  430. }
  431. bind dcc o|o delfind MC:delfind
  432. bind dcc o|o finddel MC:delfind
  433. proc MC:delfind {hand idx arg} {
  434.  global number find_ver botnick match_limit datafile stat_hits stat_found stat_not stat_notice stat_add stat_remove
  435.  if {[lindex $arg 0] == ""} {
  436.   putdcc $idx "SYNTAX: .delfind <number>"
  437.   putdcc $idx "To find the number, just type: '.find *'  this will give you the total list"
  438.   return 0
  439.  }
  440.  set row [expr $arg - 1]
  441.  set oldfind [getfind $datafile]
  442.  if {[expr $row >= 0] && [expr $row < [llength $oldfind]]} {
  443.   set newfinds [lreplace $oldfind $row $row]
  444.   set fileio [open $datafile "w"]
  445.   foreach item $newfinds {
  446.    puts $fileio $item
  447.   }
  448.   flush $fileio
  449.   close $fileio
  450.   putdcc $idx "Removed..."
  451.   incr number -1
  452.   incr stat_remove 1
  453.  }
  454. }
  455. bind msg o|o finddel MC:delfind:msg
  456. bind msg o|o delfind MC:delfind:msg
  457. proc MC:delfind:msg {nick uhost hand arg} {
  458.  global number find_ver botnick match_limit datafile stat_hits stat_found stat_not stat_notice stat_add stat_remove
  459.  if {[mc_flood $nick $uhost]} {return 0}
  460.  if {[lindex $arg 0] == ""} {
  461.   puthelp "NOTICE $nick :SYNTAX: /msg $botnick delfind <number>"
  462.   puthelp "NOTICE $nick :To find the number, you must be in dcc chat, and type: '.find *'  this will give you the total list"
  463.   return 0
  464.  }
  465.  set row [expr $arg - 1]
  466.  set oldfind [getfind $datafile]
  467.  if {[expr $row >= 0] && [expr $row < [llength $oldfind]]} {
  468.   set newfinds [lreplace $oldfind $row $row]
  469.   set fileio [open $datafile "w"]
  470.   foreach item $newfinds {
  471.    puts $fileio $item
  472.   }
  473.   flush $fileio
  474.   close $fileio
  475.   puthelp "NOTICE $nick :Done..."
  476.   incr number -1
  477.   incr stat_remove 1
  478.  }
  479. }
  480. proc getfind {file} {
  481.  set finds ""
  482.  set fileio [open $file "r"]
  483.  while {![eof $fileio]} {
  484.   set find [gets $fileio]
  485.   if {$find != ""} {
  486.    set finds [linsert $finds end $find]
  487.   }
  488.  }
  489.  close $fileio
  490.  return $finds
  491. }
  492. proc notfoundlist {arg1} {
  493.  global notfoundlist notfoundfile
  494.  if {$notfoundlist == 1} {
  495.   exec echo [string tolower $arg1] >> $notfoundfile
  496.  }
  497. }
  498. bind pub - !list mc:dllist:pub
  499. bind pub - !$botnick mc:dllist:pub
  500. proc mc:dllist:pub {nick uhost hand chan arg} {
  501.  global datafile botnick
  502.  if {[file exists $datafile.bak]} { 
  503.   exec rm -r $datafile.bak
  504.  }
  505.  set mc_list [split [exec grep "" $datafile] \n]
  506.  set i 1
  507.  exec echo "$botnick's search database, created at [time] on [date] for $nick" >> $datafile.bak
  508.  exec echo " -= enjoy =- " >> $datafile.bak
  509.  foreach wind $mc_list {
  510.   exec echo "$i) $wind " >> $datafile.bak
  511.   incr i 1
  512.  }
  513.  switch -- [dccsend $datafile.bak $nick] {
  514.   0 {
  515.     puthelp "NOTICE $nick :Sending $datafile.bak to you"
  516.     return 1
  517.   }
  518.   1 {
  519.     puthelp "NOTICE $nick :dcc table is full (too many connections)"
  520.     return 2
  521.   }
  522.   2 {
  523.     puthelp "NOTICE $nick :can't open a socket for the transfer"
  524.     return 3
  525.   }
  526.   3 {
  527.     puthelp "NOTICE $nick :file doesn't exist <Tell MC_8 he has a bug :P>"
  528.     return 4
  529.   }
  530.   4 {
  531.     puthelp "NOTICE $nick :$datafile.bak was queued for later transfer"
  532.     return 5
  533.   }
  534.  }
  535. }
  536. bind dcc o|o dllist mc:dllist
  537. proc mc:dllist {hand idx arg} {
  538.  global datafile 
  539.  if {[file exists $datafile.bak]} { 
  540.   exec rm -r $datafile.bak
  541.  }
  542.  set mc_list [split [exec grep "" $datafile] \n]
  543.  set i 1
  544.  set arg1 [lindex $arg 0]
  545.  if {$arg1 == ""} {
  546.   putdcc $idx "Send to who? syntax: .dllist <nick>"
  547.   return 0
  548.  }
  549.  exec echo "$botnick's search database, created at [time] on [date] for [lindex $arg 0] by $hand" >> $datafile.bak
  550.  exec echo " -= enjoy =- " >> $datafile.bak
  551.  foreach wind $mc_list {
  552.   exec echo "$i) $wind" >> $datafile.bak
  553.   incr i 1
  554.  }
  555.  switch -- [dccsend $datafile.bak $arg1] {
  556.   0 {
  557.    putdcc $idx "Sending $datafile.bak to '$arg1'"
  558.    return 1
  559.   }
  560.   1 {
  561.    putdcc $idx "dcc table is full (too many connections)"
  562.    return 2
  563.   }
  564.   2 {
  565.    putdcc $idx "can't open a socket for the transfer"
  566.    return 3
  567.   }
  568.   3 {
  569.    putdcc $idx "file doesn't exist <Tell MC_8 he has a bug :P>"
  570.    return 4
  571.   }
  572.   4 {
  573.    putdcc $idx "$datafile.bak was queued for later transfer"
  574.    return 5
  575.   }
  576.  }
  577. }
  578. putlog "***==-==***"
  579. if {[catch {exec grep "" $datafile}]} {
  580.  putlog "9,1ERROR loading datafile, Please e`mail gregory@worldinter.net at once! (error code e1)"
  581.  putlog "***==-==***"
  582.  return 0
  583. } {
  584.  set number 0
  585.  set mc_list [split [exec grep "" $datafile] \n]
  586.  foreach dummie $mc_list {
  587.   incr number 1
  588.  }
  589.  putlog "9,1 @find`r data-base loaded..."
  590.  putlog "9,1 --currently tracking $number/$databaselimit entries in the database"
  591.  set stat_hits 0
  592.  set stat_found 0
  593.  set stat_not 0
  594.  set stat_notice 0
  595.  set stat_add 0
  596.  set stat_remove 0
  597.  set stat_flood 0
  598.  putlog "9,1 @find`r's stats reset..."
  599.  mc_flood_init
  600.  unset mc_list
  601.  putlog "9,1Warez @find`r $find_ver loaded, by MC_8"
  602.  putlog "***==-==***"
  603. }