Advertisement
Guest User

NIBL script.

a guest
Feb 5th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 5.43 KB | None | 0 0
  1. ; NIBL - Bot search.
  2. ; This script pulls it's information from NIBL's website.
  3. ;          
  4. ;
  5. ; Usage:    /nibl [-b botname] [search terms]
  6. ;          
  7. ; Examples: Search for all packs on a bot:   /nibl -b bot
  8. ;           Use search term on all bots:     /nibl some show
  9. ;           Use search term on specific bot: /nibl -b bot some show
  10. ;            
  11. ; Creator:  Rand (@Rizon)
  12. ; Version:  0.2
  13. ;        
  14. ;         Changelog:
  15. ;           0.2 - Added a "Trust" bot option - auto accepts downloads from bots.
  16. ;           0.1 - Initial release.
  17.  
  18.  
  19. ; Quick Customization Section!
  20. ;
  21. ; Alternating Colors:
  22. ;     The two lines below control the 'alternating colors' of the text.
  23. ;     In my client 0 is white and 14 is a darker gray.
  24. ;     Change these two numbers to fit your needs.
  25.  
  26. alias -l _nibl.color.main { return 0 }
  27. alias -l _nibl.color.alt { return 14 }
  28.  
  29. ; Headers:
  30. ;    _nibl.headers.repeat
  31. ;      Controls how often you see
  32. ;      "Bot  Pack  Size  File" repeated.
  33. ;      0 = Disabled.   1 = Every other line.
  34. ;      2 = Every 2 lines.  so on and so forth.
  35. ;      Default is 10.
  36. ;    _nibl.headers.visible
  37. ;      Set to 0 to disable.
  38. ;      Set to 1 to always display repeat headers.
  39. ;      Set to 2 to only display repeat headers when searching a specific bot.
  40. ;      Default is 2 - so that it only shows when searching a specific bot. ie /nibl -b bot search.
  41.  
  42. alias -l _nibl.headers.repeat { return 0 }
  43. alias -l _nibl.headers.visible { return 0 }
  44.  
  45.  
  46. ; Bot name seperator:
  47. ;    This controls whether or not there will
  48. ;    be a seperator when moving on to the next bot.
  49. ;    1 for on, 0 for off. Default is 1.
  50.  
  51. alias -l _nibl.bot.name.seperator { return 0 }
  52.  
  53. ; Automatically "TRUST" the bots that you try to download from!
  54. ;    This will allow you to automatically add a bot to your 'trusted' list.
  55. ;    It will accept the file sends from the bots automatically.
  56. ;    Default option for this is 1, "on".  You can set this to 0 to disable.
  57. ;    ... If you want this feature to work:
  58. ;    Press ALT + O, Select "DCC"
  59. ;    Set "On Send request:" to:
  60. ;       [x] Auto-get file and [x] minize
  61. ;       If file exists:
  62. ;          [Resume]  [Trusted]
  63. ;
  64. ;    Set these options if you want
  65.  
  66. alias -l _add.bot.to.trusted { return 1 }
  67.  
  68.  
  69.  
  70. ;
  71. ; Don't change anything below here unless you know what you're doing!
  72. ; --------------------------------------------------------------------
  73. ;
  74.  
  75.  
  76. alias nibl {
  77.   var %n = nibl
  78.   if ($sock(%n)) return
  79.  
  80.   if ($$1 == -b) { var %botname = $$2 , %search = $3- }
  81.   else { var %botname = 0, %search = $$1- }
  82.  
  83.   sockopen %n nibl.co.uk 80
  84.   sockmark %n %botname %search
  85.   if (!$window(@nibl)) { window -aeh -t14,44,58,67,75 @nibl }
  86.   echo -act notice * Loading NIBL results for your search: $iif($1 == -b,$+([,%botname,])) %search
  87.   window -h @nibl
  88.   clear @nibl
  89.   aline @nibl 4>5 Searching $iif($1 == -b, bot: 7 $+ %botname) $iif(%search,5for:7 %search)
  90. }
  91.  
  92.  
  93.  
  94. on *:sockopen:nibl:{
  95.   tokenize 32 $sock(nibl).mark
  96.   var %s = sockwrite -n $sockname
  97.   var %botname = $1 , %search = $regsubex($2-,/([^A-Za-z0-9])/g,% $+ $base($asc(\t),10,16))
  98.  
  99.   if (%botname == 0) {
  100.     %s GET /bots.php?search= $+ %search HTTP/1.0
  101.   }
  102.   else {
  103.     %s GET /bots.php?bot= $+ %botname $+ &search= $+ %search HTTP/1.0
  104.   }
  105.   %s Host: nibl.co.uk
  106.   %s
  107. }
  108.  
  109. on *:sockread:nibl:{
  110.   var %botcheck = $gettok($sock(nibl).mark,1,32)
  111.   if ($sockerr) return
  112.   sockread %s
  113.   while ($sockbr) {
  114.     if ($regex(%s,/<tr class=\"botlistitem.*?\" botname=\"(.+?)\" botpack=\"(.+?)\"/)) {
  115.       set %nibl.bot $regml(1)
  116.       set %nibl.pack $regml(2)
  117.     }
  118.     if ($regex(%s,/<td class=\"filesize\">(.+?)<\/td>/)) {
  119.       set %nibl.size $regml(1)
  120.     }
  121.     if ($regex(%s,/<td class=\"filename\">(.+)/)) {
  122.       set %nibl.name $regml(1)
  123.       if ($_nibl.bot.name.seperator) {
  124.         if (%nibllastbot != %nibl.bot) {
  125.           aline @nibl 
  126.           aline @nibl 7 $chr(9) Bot $chr(9) Pack $chr(9) Size $chr(9) File
  127.           aline @nibl 9 $chr(9) %nibl.bot
  128.           unset %niblcount
  129.         }
  130.       }
  131.       inc %niblcount
  132.  
  133.       aline @nibl 4[NIBLGET]  $+ $iif(2 // %niblcount,$_nibl.color.alt,$_nibl.color.main) $chr(9) %nibl.bot $chr(9) $(#,0) $+ %nibl.pack $chr(9) %nibl.size $chr(9) %nibl.name
  134.       if ($_nibl.headers.visible == 1 || ($_nibl.headers.visible == 2 && %botcheck != 0)) {
  135.         if ($_nibl.headers.repeat // %niblcount) {
  136.           aline @nibl 7 $chr(9) Bot $chr(9) Pack $chr(9) Size $chr(9) File
  137.         }
  138.       }
  139.       set %nibllastbot %nibl.bot
  140.       unset %nibl.*
  141.     }
  142.     sockread %s
  143.   }
  144. }
  145.  
  146. on *:sockclose:nibl:{
  147.   window -aew3 @nibl
  148.   unset %nibl*
  149. }
  150.  
  151. on ^*:hotlink:[NIBLGET]:@nibl:{
  152.   if ($strip($1) == [NIBLGET]) return
  153.   halt
  154. }
  155. on *:hotlink:[NIBLGET]:@nibl:{
  156.   tokenize 32 $replace($hotline,$chr(9),$chr(32))
  157.   var %nick = $3 , %pack = $4 , %file = $6-
  158.   if (#nibl !ischan) { echo -a *** Error:  Try joining #NIBL first! Rizon network. | return }
  159.   if (%nick !ison #nibl && %nick !ison #horriblesubs) { echo -a *** Error:  Silly bastard!  The bot $qt(%nick) isn't even on #NIBL! (network : $network - current) | return }
  160.   _getPack %nick %pack %file
  161. }
  162.  
  163. alias -l _getPack {
  164.   var %nick = $1 , %pack = $2 , %file = $3-
  165.   if ($_add.bot.to.trusted == 1) {
  166.     .dcc trust $address(%nick,3)
  167.   }
  168.   echo -a 4> 5Fetching:4 %file     5From:4 %nick     5Pack:04 %pack
  169.   .msg %nick xdcc send %pack
  170. }
  171.  
  172. alias stripFluff { return $regsubex($1-,/\.|-|_/g,$chr(32)) }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement