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

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