Advertisement
Guest User

Quaker

a guest
Jan 6th, 2019
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 8.14 KB | None | 0 0
  1. ;;;;Script Usage: Command: "/get.quake "
  2. ;;;;Options are not required but should be seperated by space...
  3. ;;;;Options Are: count help nocheck html lessthanday lessthanweek
  4. ;;;;(1) count (Displays count of match on display)
  5. ;;;;(2) help (Displays Help Info|Cannot Be Used With count)
  6. ;;;;(3) nocheck (Stops it checking if page has changed in list for depth, magnitude or location)
  7. ;;;;(4) html (Get Data With HTML Included)
  8. ;;;;(5) lessthanday (Displays only matches listed in last day)
  9. ;;;;(6) lessthanweek (Display all matches listed in last week)
  10.  
  11. ;;;;Your Server DNS/Hostname You Use To Access Your Website...
  12.  
  13. on ^*:text:*:#:{
  14.   if (!quakes day isin $strip($stripstyle($1-))) && ($istok(@ . ',$left($nick(#,$me).pnick,1),32))  {
  15.     set %quakechan #
  16.     inc -u100 %quakeflood. [ $+ [ $+($address($nick,1),#) ] ] 1
  17.     privmsg %quakechan GeoNet.org.nz Quake info for New Zealand
  18.     get.quake nocheck keepalive lessthanday
  19.   }
  20.   if (!quakes week isin $strip($stripstyle($1-))) && ($istok(@ . ',$left($nick(#,$me).pnick,1),32)) && (!%quakeflood. [ $+ [ $+($address($nick,1),#) ] ] >= 3) {
  21.     inc -u100 %quakeflood. [ $+ [ $+($address($nick,1),#) ] ] 1  
  22.     set %quakechan #
  23.     privmsg %quakechan GeoNet.org.nz Quake info for New Zealand
  24.     get.quake nocheck keepalive lessthanweek
  25.   }
  26.   if (!quakes all isin $strip($stripstyle($1-))) && ($istok(@ . ',$left($nick(#,$me).pnick,1),32)) && (!%quakeflood. [ $+ [ $+($address($nick,1),#) ] ] >= 3) {
  27.     inc -u100 %quakeflood. [ $+ [ $+($address($nick,1),#) ] ] 1
  28.     set %quakechan #
  29.     privmsg %quakechan GeoNet.org.nz Quake info for New Zealand
  30.     get.quake nocheck keepalive
  31.   }
  32. }
  33.  
  34.  
  35. alias testq {
  36.   get.quake nocheck lessthanweek
  37. }
  38. alias quake.dns { return localhost }
  39.  
  40. ;;;;Folder & File Name On Your Server....
  41. alias quake.dir { return $+(/EQ/nz.php,$1) }
  42. alias quake.window {
  43.   var %window, %l
  44.   %window = @QuakeInfo
  45.   if (!$window(%window)) {
  46.     .window -blMk0ezsS -t40,80,110,130,150,180 +benstx %window ariel 16
  47.     aline -ln %window $chr(1) 15 $+(7Location,15|,7Distance) $chr(9) 3Strength 15(3Magnitude15|3Quake Status15) 15@4 Depth (Km) 2URL
  48.     aline -ln %window $chr(1) 16 $+ $str($chr(160),20)
  49.   }
  50.   return %window
  51. }
  52. alias get.quake { .window -c $quake.window | .noop $quake.window | var %sock, %opts, %l | %sock = $+(quakage123,.,$md5($r(11111111,9999999999999999))) | .sockclose %sock | .sockopen %sock $quake.dns 80 | %opts = $q.opts(%sock,$1-) | if (%opts) sockmark %sock $+(?,$v1) | if ($+(keepalive,$chr(61),true) isin %opts) .timerkp $+ %sock -cmo 0 7500 q.keep %sock %opts | return }
  53.  
  54. on *:SOCKOPEN:quakage123.*: { if (!$hget($md5($sockname))) .hmake $md5($sockname) | var %sw, %l | .unset %quakereader. [ $+ [ $sockname ] ] | %sw = .sockwrite -n $sockname | %sw GET $quake.dir($sock($sockname).mark) HTTP/1.0 | %sw HOST: $quake.dns | %sw $str($crlf, 2) }
  55. on *:SOCKREAD:quakage123.*: {
  56.   var %read, %list, %display, %a, %l | sockread %read | %read = $replace(%read,$+(<,/,a,>),$null) | tokenize 32 %read | %list = %quakereader. [ $+ [ $sockname ] ] | %display = %timedisplay. [ $+ [ $sockname ] ]
  57.   if ($gettok(%read,1,58) == Url Control) { .set -u10 %nodis. [ $+ [ $sockname ] ] 1 }
  58.   if ($gettok(%read,1,58) == Starting) { .set -u60 %quakereader. [ $+ [ $sockname ] ] 1 | echo @quakefetch 7Quakeinfo - Starting Lister: Requesting Page: $+(http,:,/,/,$quake.dns,$quake.dir($sock($sockname).mark)) }
  59.   elseif ($gettok(%read,1,58) == Completed) { echo @quakefetch 3Quakeinfo - Completed Task: $gettok(%read,2-,58) | .unset %quakereader. [ $+ [ $sockname ] ] | .sockclose $sockname }
  60.   elseif ($gettok(%read,1,58) == None) { if (!%nodis. [ $+ [ $sockname ] ]) { echo @quakefetch 4Quakeinfo - No Change To Page... } | .unset %quakereader. [ $+ [ $sockname ] ] | .sockclose $sockname }
  61.   elseif (%list == 1) && ($len(%read) > 10) && ($displaycheck(%display, %read) == List) { if ($hget($md5($sockname),$md5($gettok(%read,4,9)))) halt | if ($hget($md5($sockname))) .hadd $md5($sockname) $md5($gettok(%read,4,9)) 1 | %a = $quake.sortlist(%read)  | .aline -ln $quake.window 2 $+ %a | privmsg %quakechan $replace(%read,$chr(9),$chr(124)) }
  62. }
  63. alias qecho return echo
  64. alias q.keep {
  65.   if (!$sock($1)) {
  66.     .sockopen $1 $quake.dns 80
  67.     .sockmark $2 $2
  68.   }
  69.   return
  70. }
  71. alias strstart {
  72.   var %a, %b, %c, %d, %l
  73.   %a = $1-
  74.   tokenize 32 %a
  75.   %a = $1-
  76.   tokenize 160 %a
  77.   return $replace($1-,$chr(32),$chr(160))
  78. }
  79. alias sortkm {
  80.   var %a, %b, %c, %d, %e, %l
  81.   %a = $1-
  82.   %b = $replace(%a,$+(of),$chr(9))
  83.   %c = $gettok(%b,2,9) $gettok(%b,1,9)
  84.   %c = %c Of Local
  85.   return $replace(%c,$chr(32),$chr(160))
  86. }
  87. alias quake.sortlist {
  88.   var %in, %match, %out, %bit, %bits, %sout, %data, %l
  89.   %data = $replace($1-,$chr(124),$chr(9))
  90.   %data = $+($gettok(%data,1,9),$chr(9),$gettok(%data,4,9),$chr(9),$gettok(%data,2,9),$chr(9),$gettok(%data,3,9),$chr(9),$gettok(%data,5,9))
  91.   return %data
  92. }
  93. alias displaycheck {
  94.   if ($1 == week) && ($numtok($replace($2-,week,$chr(9)),9) > 1) return None
  95.   elseif ($1 == day) && ($numtok($replace($2-,day,$chr(9)),9) > 1) return None
  96.   elseif ($1 == day) && ($numtok($replace($2-,week,$chr(9)),9) > 1) return None
  97.   return List
  98. }
  99. alias q.opts { var %opts, %out, %in, %l | %in = $1- | tokenize 32 %in
  100.   if ($istok($2-,html,32)) %opts = html=True | else %opts = html=False
  101.   if ($istok($2-,count,32)) %opts = %opts $+ &info=count | elseif ($istok($2-,help,32)) %opts = %opts $+ &info=help | else %opts = %opts $+ &info=non
  102.   if ($istok($2-,nocheck,32)) %opts = %opts $+ &type=default | else %opts = %opts $+ &type=update
  103.   if ($istok($2-,lessthanday,32)) .set %timedisplay. [ $+ [ $1 ] ] day
  104.   elseif ($istok($2-,lessthanweek,32)) .set %timedisplay. [ $+ [ $1 ] ] week
  105.   else .set %timedisplay. [ $+ [ $1 ] ] none
  106.   if ($istok($2-,keepalive,32)) {
  107.     if ($hget($md5($1))) .hfree $md5($1)
  108.     .hmake $md5($1)
  109.     %opts = %opts $+ &keepalive=True
  110.   }
  111.   else %opts = %opts $+ &keepalive=False
  112.   return %opts
  113. }
  114. alias Quaket {
  115.   %a = $1-
  116.   %b = $asctime(%a,d)
  117.   %c = $asctime(%a,m)
  118.   if (%b == $asctime($ctime,d)) && (%c == $asctime($ctime,m)) return Today@ $+ $asctime(%a,h:nntt)
  119.   dec %b
  120.   if (%b == $asctime($ctime,d)) && (%c == $asctime($ctime,m)) return Yesterday@ $+ $asctime(%a,h:nntt)
  121.   %d = 1
  122.   while (%b > 0) {
  123.     inc %d
  124.     dec %b
  125.     if (%c < $asctime($ctime,m)) && (%b == 0) {
  126.       dec %c
  127.       if (%c < 1) goto end
  128.       %b = $asctime(%a,d)
  129.     }
  130.   }
  131.   :end
  132.   return $asctime(%a,ddoo mm yyy|h:nntt)
  133. }
  134. menu @Quakeinfo {
  135.   =Clear Screen=:.clear $active
  136.   -
  137.   $$iif($sock(quakage123.*,0), Active Server Connections $+ $chr(58) $v1): .timerkp* off | sockclose quakage123.*
  138.   .-
  139.   $$iif(%keepalive != on, $$iif($sock(quakage123.*, 0) == 0, List Earthquakes [Less Than A Day Old])): get.quake nocheck lessthanday
  140.   $$iif(%keepalive != on, $$iif($sock(quakage123.*, 0) == 0, List Earthquakes [Less Than A Week Old])): get.quake nocheck lessthanweek
  141.   $$iif(%keepalive != on, $$iif($sock(quakage123.*, 0) == 0, List Earthquakes [List All])): get.quake nocheck
  142.   -
  143.   $$iif(%keepalive == on, Stop $+ $Chr(58) Keep Alive, $$iif($sock(quakage123.*, 0) == 0, Start $+ $Chr(58) Keep Alive)): {
  144.     .timerkp* off
  145.     if (!%keepalive) goto on
  146.     if (%keepalive == off) goto on
  147.     .set %keepalive off
  148.     var %sock, %count, %match, %a, %b, %l
  149.     %sock = quakage123.*
  150.     %count = $sock(%sock,0)
  151.     %b = 0
  152.     while (%count > 0) && ($sock(%sock,%count)) {
  153.       %a = $v1
  154.       %match = $md5(%a)
  155.       if ($hget(%match)) {
  156.         inc %b
  157.         .timerkp $+ %a off
  158.         .hfree %match
  159.       }
  160.       .sockclose %a
  161.       dec %count
  162.     }
  163.     halt
  164.     :on
  165.     .set %keepalive on
  166.     get.quake nocheck keepalive lessthanday
  167.   }
  168.   $$iif(%keepalive == on, $$iif($sock(quakage123.*,0) > 0, Restart $+ $chr(58) Keep Alive)): {
  169.     var %sock, %count, %match, %a, %b, %l
  170.     %sock = quakage123.*
  171.     %count = $sock(%sock,0)
  172.     %b = 0
  173.     while (%count > 0) && ($sock(%sock,%count)) {
  174.       %a = $v1
  175.       %match = $md5(%a)
  176.       if ($hget(%match)) {
  177.         inc %b
  178.         .hfree %match
  179.       }
  180.       .sockclose %a
  181.       dec %count
  182.     }
  183.   var %a, %b, %c, %d, %e, %l
  184.     .set %keepalive on
  185.     get.quake nocheck keepalive lessthanday
  186.   }
  187. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement