Guest User

mIRC #Omnimaga SpyBot45 Source

a guest
Apr 14th, 2010
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 23.11 KB | None | 0 0
  1. on *:op:#: {
  2.   if ( $me == $opnick ) {
  3.     mode $chan -o $me
  4.     notice $nick Do not op me, I do not need it.
  5.   }
  6. }
  7.  
  8.  
  9. alias ReDoOmnimagaRSS {
  10.   set %lastrss
  11.   OmnimagaRSS
  12. }
  13. alias OmnimagaRSS {
  14.   echo Checking Omnimaga
  15.   rssfeed http://www.omnimaga.org/index.php?www;action=.xml;type=rss;sa=recent;limit=1
  16.   if ( %lastrss != $hget(rssfeed,4).item.data ) {
  17.     set %lastrss $hget(rssfeed,4).item.data
  18.     set %linkpath $mid( $hget(rssfeed,4).item.data , 24 )
  19.     set %site www.omnimaga.org
  20.     if ( $sock(get_title) == get_title ) {
  21.       sockclose get_title
  22.     }
  23.     /write -c log New Request
  24.     sockopen get_title omnimaga.org 80
  25.     set %page
  26.   }
  27. }
  28.  
  29. on *:sockopen:get_title:{
  30.   if ($sockerr > 0) {
  31.     echo -a Error: $sock(get_title).wsmsg
  32.   }
  33.   else {
  34.     sockwrite -tn $sockname GET %linkpath HTTP/1.1    
  35.     sockwrite -n $sockname Accept: */*
  36.     sockwrite -tn $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12 $+ $crlf
  37.     sockwrite -n $sockname Host: omnimaga.org
  38.     sockwrite -n $sockname Connection: close
  39.     sockwrite -n $sockname $crlf $+ $crlf
  40.   }
  41. }
  42. on *:sockread:get_title:{
  43.   if ($sockerr > 0) return
  44.   sockread &get_titling
  45.   if ($sockbr == 0) return -
  46.   else {
  47.     write log $bvar( &get_titling , 1 , 9999999999999).text
  48.   }
  49. }
  50.  
  51. on *:sockclose:get_title: {
  52.   set %threadName $read( log , w , *<title>* ) $+ $read( log , $calc( $readn + 1 ) )
  53.   echo %threadName
  54.   set %threadName $mid( %threadName, $calc( $pos( %threadName, <title>) + 7))
  55.   echo %threadName
  56.   set %threadName $mid( %threadName, 0, $calc( $pos( %threadName, </title>) - 1 ))
  57.   echo %threadName
  58.   set %now_this_is_title %threadName
  59.   set %userName $read( log, w, * $+ $mid(%linkPath, $pos(%linkPath,topic)) $+ * )
  60.   set %userName $read( log, w , *View the profile of* , $calc( $readn - 30 )) $+ $read( log, $calc( $readn + 1) )
  61.   echo %userName
  62.   set %userName $mid( %userName, $calc( $pos( %userName, View the profile of) + 20))
  63.   set %userName $mid( %userName, 0, $calc( $pos( %userName, ">) - 1 ))
  64.   set %now_this_is_author %userName
  65.   msg #omnimaga 10New post by 3 $+ %now_this_is_author $+ 10 in4 $iif( $len( %now_this_is_title ) > 31 , $iif( $right( $mid( %now_this_is_title , 1 , 27 ) , 1 ) != $chr(32) ,$mid( %now_this_is_title , 1 , 27 ) $+ ..., $mid( %now_this_is_title , 1 , 26 ) $+ ...  ) , %now_this_is_title ) $+ 12 $mid( $hget(rssfeed,4).item.data , 1 , $calc( $pos( $hget(rssfeed,4).item.data , $chr(35) , 1) - 1 ) )
  66.   echo New post by ( $+ 10 $+ %now_this_is_author $+  $+ ) in4 $iif( $len( %now_this_is_title ) > 31 , $iif( $right( $mid( %now_this_is_title , 1 , 27 ) , 1 ) != $chr(32) ,$mid( %now_this_is_title , 1 , 27 ) $+ ..., $mid( %now_this_is_title , 1 , 26 ) $+ ...  ) , %now_this_is_title ) $+ 12 $mid( $hget(rssfeed,4).item.data , 1 , $calc( $pos( $hget(rssfeed,4).item.data , $chr(35) , 1) - 1 ) )
  67.   sockclose get_title
  68. }
  69.  
  70. alias CemetechRSS {
  71.   echo -s Checking Cemetech
  72.   rssfeed2 http://www.cemetech.net/forum/rss.php
  73.   if ( %lastCrss != $hget(rssfeed2,<link>3) && %lastCrss != $null ) {
  74.     set %lastCrss $hget(rssfeed2,<link>3)
  75.     set %curtopic $mid( $hget(rssfeed2,<title>3) , $calc( $pos( $hget(rssfeed2,<title>3) , ::) + 3 ))
  76.     if ( $pos( %curtopic, RE: ) ) {
  77.       set %curtopic $mid( %curtopic, 5)
  78.     }
  79.     set %curtopic $mid( %curtopic, 0, 30)
  80.     msg #omnimaga 10New Post by3 $hget(rssfeed2,<dc:creator>1) 10in4 %curtopic 5 $+ $hget(rssfeed2,<link>3)
  81.   }
  82. }
  83.  
  84. alias get_UTI {
  85.   echo Checking UTI
  86.   remove UTI.txt
  87.   if ( $sock(get_UTI) == get_UTI ) {
  88.     sockclose get_UTI
  89.   }
  90.   sockopen get_UTI www.UnitedTI.org 80
  91. }
  92.  
  93. on *:sockopen:get_UTI:{
  94.   if ($sockerr > 0) {
  95.     echo -a Error: $sock(get_UTI).wsmsg
  96.   }
  97.   else {
  98.     sockwrite -tn $sockname GET /forum/index.php?app=core&module=search&do=active&search_filter_app[forums]=1 HTTP/1.1
  99.     sockwrite -n $sockname Accept: */*
  100.     sockwrite -tn $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12 $+ $crlf
  101.     sockwrite -n $sockname Host: www.unitedti.org
  102.     sockwrite -n $sockname Connection: close
  103.     sockwrite -n $sockname $crlf $+ $crlf
  104.   }
  105. }
  106.  
  107. on *:sockread:get_UTI:{
  108.   if ($sockerr > 0) return
  109.   sockread &get_UTIposts
  110.  
  111.   if ($sockbr == 0) return -
  112.   else {
  113.     write UTI.txt $bvar( &get_UTIposts , 1 , 9999999999999).text
  114.   }
  115. }
  116. on *:sockclose:get_UTI:{
  117.   set %threadLink $read(UTI.txt,w, *Go to first unread post*)
  118.   set %threadName $read(UTI.txt, $calc( $readn + 3 ))
  119.   set %threadName $mid( %threadName , $calc( $pos( %threadName, View result ) + 13 ) )
  120.   set %threadName $mid( %threadName , 1 , $calc( $pos( %threadName, 1 , </a> ) - 4 ) )
  121.   set %threadName $mid( %threadName , 1 , 30)
  122.   set %threadLink $mid( %threadLink, 12)
  123.   set %threadLink http://www.unitedti.org/forum/index.php? $+ $mid( %threadLink, $pos( %threadLink , showtopic ) )
  124.   set %threadLink $mid( %threadLink , 0 , $calc( $pos( %threadLink, &) - 1))
  125.   set %posterName $read(UTI.txt,w,*<li>By:*, $readn )
  126.   set %posterName $mid( %posterName, $calc( $pos( %posterName , '>) + 2))
  127.   set %posterName $mid( %posterName , 1 , $calc( $pos( %posterName ,</a>) - 1))
  128.   if ( %LastUTIrss = $null ) {
  129.     set %LastUTIrss None
  130.   }
  131.   if ( %threadLink != %LastUTIrss )  {
  132.     set %LastUTIrss %threadLink
  133.     msg #omnimaga 10New Post by3 %posterName 10in4 %threadName 14 $+ %threadLink
  134.   }
  135. }
  136.  
  137. alias get_TIFW {
  138.   echo Checking TIFW
  139.   remove TIFW.txt
  140.   if ( $sock(get_TIFW) == get_TIFW ) {
  141.     sockclose get_TIFW
  142.   }
  143.   sockopen get_TIFW tifreakware.ath.cx 80
  144. }
  145.  
  146. on *:sockopen:get_TIFW:{
  147.   if ($sockerr > 0) {
  148.     echo -a Error: $sock(get_TIFW).wsmsg
  149.   }
  150.   else {
  151.     sockwrite -t $sockname GET /index.php?act=Search&CODE=getactive HTTP/1.1 $+ $crlf
  152.     sockwrite  $sockname Accept: text/html $+ $crlf
  153.     sockwrite -t $sockname User-Agent: mIRC $+ $crlf
  154.     sockwrite  $sockname Host: tifreakware.ath.cx $+ $crlf
  155.     sockwrite  $sockname Connection: Close $+ $crlf
  156.     sockwrite $sockname $crlf $+ $crlf $+ $crlf
  157.   }
  158. }
  159.  
  160.  
  161. on *:sockread:get_TIFW:{
  162.   if ($sockerr > 0) return
  163.   sockread &get_TIFWposts
  164.  
  165.   if ($sockbr == 0) return -
  166.   else {
  167.     write TIFW.txt $bvar( &get_TIFWposts , 1 , 9999999999999).text
  168.   }
  169. }
  170. on *:sockclose:get_TIFW:{
  171.   set %threadLink $read(TIFW.txt,w, *<!-- Begin Topic Entry*)
  172.   set %threadName $read(TIFW.txt, $calc( $readn + 8 )) $+ $read(TIFW.txt, $calc( $readn + 1 ))
  173.   set %threadLink %threadName
  174.   set %threadLink $mid( %threadLink, $pos( %threadLink, showtop ) )
  175.   set %threadName %threadLink
  176.   set %threadLink $mid( %threadLink, 0 , $calc( $pos( %threadLink, &) - 1 ))
  177.   set %threadLink http://tifreakware.ath.cx/index.php? $+ %threadLink
  178.   set %threadName $mid( %threadName, $calc( $pos( %threadName, '>) + 2))
  179.   set %threadName $mid( %threadName , 1 , $calc( $pos( %threadName ,</a>) - 1))
  180.   set %posterName $read(TIFW.txt,w,*Last Post by:*, $readn ) $+ $read(TIFW.txt, $calc( $readn + 1 ) )
  181.  
  182.   set %posterName $mid( %posterName , $pos( %posterName, showuser ) )
  183.   set %posterName $mid( %posterName, $calc( $pos( %posterName , '>) + 2))
  184.   set %posterName $mid( %posterName , 1 , $calc( $pos( %posterName , </a> ) - 1) )
  185.   if ( %LastTIFWrss = $null ) {
  186.     set %LastTIFWrss None
  187.   }
  188.   if ( %threadLink != %LastTIFWrss )  {
  189.     set %LastTIFWrss %threadLink
  190.     echo 10New Post by3 %posterName 10in4 %threadName 3 $+ %threadLink
  191.     msg #omnimaga 10New Post by3 %posterName 10in4 %threadName 3 $+ %threadLink
  192.   }
  193. }
  194.  
  195. alias get_MC {
  196.   echo Checking MC
  197.   remove MC.txt
  198.   if ( $sock(get_MC) == get_MC ) {
  199.     sockclose get_MC
  200.   }
  201.   sockopen get_MC junemann.nl 80
  202. }
  203.  
  204. on *:sockopen:get_MC:{
  205.   if ($sockerr > 0) {
  206.     echo -a Error: $sock(get_MC).wsmsg
  207.   }
  208.   else {
  209.     sockwrite -t $sockname GET /maxcoderz/search.php?search_id=newposts HTTP/1.1 $+ $crlf
  210.     sockwrite  $sockname Accept: text/html $+ $crlf
  211.     sockwrite -t $sockname User-Agent: mIRC $+ $crlf
  212.     sockwrite  $sockname Host: junemann.nl $+ $crlf
  213.     sockwrite  $sockname Connection: Close $+ $crlf
  214.     sockwrite $sockname $crlf $+ $crlf $+ $crlf
  215.   }
  216. }
  217.  
  218.  
  219. on *:sockread:get_MC:{
  220.   if ($sockerr > 0) return
  221.   sockread &get_MCposts
  222.  
  223.   if ($sockbr == 0) return -
  224.   else {
  225.     write MC.txt $bvar( &get_MCposts , 1 , 9999999999999).text
  226.   }
  227. }
  228. on *:sockclose:get_MC:{
  229.   set %threadLink $read(MC.txt,w, *viewtopic.php*)
  230.   set %threadName %threadLink
  231.   set %threadLink $mid( %threadLink, $pos( %threadLink, viewtopic.php ) )
  232.   set %threadName %threadLink
  233.   set %threadLink $mid( %threadLink, 0 , $calc( $pos( %threadLink, &) - 1 )) $+ & $+ $mid( %threadLink, $pos( %threadLink, t=) )
  234.   set %threadLink $mid( %threadLink, 0 , $calc( $pos( %threadLink, &amp) - 1))
  235.   set %threadLink http://junemann.nl/maxcoderz/ $+ %threadLink
  236.   set %threadName $mid( %threadName, $calc( $pos( %threadName, ">) + 2))
  237.   set %threadName $mid( %threadName , 1 , $calc( $pos( %threadName ,</a>) - 1))
  238.   set %posterName $read(MC.txt,w,*username-coloured*, $readn ) $+ $read(MC.txt, $calc( $readn + 1 ) )
  239.  
  240.   set %posterName $mid( %posterName , $calc( $pos( %posterName, coloured"> ) + 10) )
  241.   set %posterName $mid( %posterName , 1 , $calc( $pos( %posterName , </a> ) - 1) )
  242.   if ( %LastMCrss = $null ) {
  243.     set %LastMCrss None
  244.   }
  245.   if ( %threadLink != %LastMCrss && %threadName != 500 Internal Server Erro )  {
  246.     set %LastMCrss %threadLink
  247.     echo 10New Post by3 %posterName 10in4 %threadName 3 $+ %threadLink
  248.     msg #omnimaga 10New Post by3 %posterName 10in4 %threadName 7 $+ %threadLink
  249.   }
  250. }
  251.  
  252. alias -l grabdata { if ($regex($1-,(<([^>]+)>)(.+)</\2>)) return $regml(1) $+ $chr(255) $+ $regml(3) }
  253.  
  254. alias rssfeed {
  255.   if ($1 == $null) return
  256.   else {
  257.     if ($left($1,7) != http://) echo $color(text) -a Incorrect URL format, please include http:// at the beginning.
  258.     else {
  259.       if ($sock(rssfeed)) sockclose rssfeed
  260.       ; grab the host from $1 and connect to it
  261.       sockopen rssfeed $gettok($1,2,47) 80
  262.       ; store $1 in a sockmark of the rssfeed socket
  263.       sockmark rssfeed $1
  264.     }
  265.   }
  266. }
  267.  
  268. on *:sockopen:rssfeed:{
  269.   if ($sockerr > 0) {
  270.     return
  271.   }
  272.   ; if the hash table rssfeed exists from a previous execution, clear it
  273.   if ($hget(rssfeed)) hfree rssfeed
  274.   ; GET the page using the path after the host in the sockmark
  275.   sockwrite -n $sockname GET / $+ $gettok($sock($sockname).mark,3-,47) HTTP/1.1
  276.   ; specify the host as well from the sockmark
  277.   sockwrite -n $sockname Host: $gettok($sock($sockname).mark,2,47)
  278.   sockwrite -n $sockname Connection: keep-alive
  279.   sockwrite -n $sockname
  280. }
  281.  
  282. on *:sockread:rssfeed:{
  283.   if ($sockerr > 0) return
  284.   :nextread
  285.   sockread %temp
  286.   if (%temp == $null) var %temp = -
  287.   if ($sockbr == 0) {
  288.     return
  289.   }
  290.   if ((</rdf:RDF> isin %temp) || (</rss> isin %temp)) {
  291.     ; if the end of an RSS file is found, end it
  292.     sockclose $sockname
  293.     if (%temp) unset %temp
  294.     return
  295.   }
  296.   if ($grabdata(%temp)) {
  297.     ; if it matches an RSS item type (see the grabdata alias above) store the tag in %item
  298.     var %item = $gettok($grabdata(%temp),1,255)
  299.     ; if there is no item in the hash table that matches that tag, make it the first
  300.     ; -> e.g. <title>1
  301.     if (!$hfind(rssfeed,%item $+ *,0,w)) hadd -m rssfeed %item $+ 1 $gettok($grabdata(%temp),2,255)
  302.     ; if not, loop through it items in the hash table and find the highest matching tag
  303.     ; then save it as an item with a number of one higher than the highest
  304.     ; -> e.g. there's a <title>1 so store it as <title>2
  305.     ; and break out of the loop by setting the looping var higher than the while condition
  306.     else {
  307.       var %x = 1
  308.       while (%x <= $hget(rssfeed,0).item) {
  309.         if ($hfind(rssfeed,%item $+ *,0,w)) {
  310.           var %item = %item $+ $calc($ifmatch + 1)
  311.           hadd -m rssfeed %item $gettok($grabdata(%temp),2,255)
  312.           var %x = $hget(rssfeed,0).item
  313.         }
  314.         inc %x
  315.       }
  316.     }
  317.   }
  318.   goto nextread
  319. }
  320.  
  321. on *:sockclose:rssfeed:{
  322.   ; if the socket is closed by the remote host say so
  323. }
  324. alias rssfeed2 {
  325.   if ($1 == $null) return
  326.   else {
  327.     if ($left($1,7) != http://) echo $color(text) -a Incorrect URL format, please include http:// at the beginning.
  328.     else {
  329.       if ($sock(rssfeed2)) sockclose rssfeed2
  330.       ; grab the host from $1 and connect to it
  331.       sockopen rssfeed2 $gettok($1,2,47) 80
  332.       ; store $1 in a sockmark of the rssfeed2 socket
  333.       sockmark rssfeed2 $1
  334.     }
  335.   }
  336. }
  337.  
  338. on *:sockopen:rssfeed2:{
  339.   if ($sockerr > 0) {
  340.     return
  341.   }
  342.   ; if the hash table rssfeed2 exists from a previous execution, clear it
  343.   if ($hget(rssfeed2)) hfree rssfeed2
  344.   ; GET the page using the path after the host in the sockmark
  345.   sockwrite -n $sockname GET / $+ $gettok($sock($sockname).mark,3-,47) HTTP/1.1
  346.   ; specify the host as well from the sockmark
  347.   sockwrite -n $sockname Host: $gettok($sock($sockname).mark,2,47)
  348.   sockwrite -n $sockname Connection: keep-alive
  349.   sockwrite -n $sockname
  350. }
  351.  
  352. on *:sockread:rssfeed2:{
  353.   if ($sockerr > 0) return
  354.   :nextread
  355.   sockread %temp
  356.   if (%temp == $null) var %temp = -
  357.   if ($sockbr == 0) {
  358.     return
  359.   }
  360.   if ((</rdf:RDF> isin %temp) || (</rss> isin %temp)) {
  361.     ; if the end of an RSS file is found, end it
  362.     sockclose $sockname
  363.     if (%temp) unset %temp
  364.     return
  365.   }
  366.   if ($grabdata(%temp)) {
  367.     ; if it matches an RSS item type (see the grabdata alias above) store the tag in %item
  368.     var %item = $gettok($grabdata(%temp),1,255)
  369.     ; if there is no item in the hash table that matches that tag, make it the first
  370.     ; -> e.g. <title>1
  371.     if (!$hfind(rssfeed2,%item $+ *,0,w)) hadd -m rssfeed2 %item $+ 1 $gettok($grabdata(%temp),2,255)
  372.     ; if not, loop through it items in the hash table and find the highest matching tag
  373.     ; then save it as an item with a number of one higher than the highest
  374.     ; -> e.g. there's a <title>1 so store it as <title>2
  375.     ; and break out of the loop by setting the looping var higher than the while condition
  376.     else {
  377.       var %x = 1
  378.       while (%x <= $hget(rssfeed2,0).item) {
  379.         if ($hfind(rssfeed2,%item $+ *,0,w)) {
  380.           var %item = %item $+ $calc($ifmatch + 1)
  381.           hadd -m rssfeed2 %item $gettok($grabdata(%temp),2,255)
  382.           var %x = $hget(rssfeed2,0).item
  383.         }
  384.         inc %x
  385.       }
  386.     }
  387.   }
  388.   goto nextread
  389. }
  390.  
  391. on *:sockclose:rssfeed2:{
  392.   ; if the socket is closed by the remote host say so
  393. }
  394. menu status,channel,query {
  395.   Hash Table Editor:hedit
  396. }
  397. alias hedit { dialog -m hedit hedit }
  398. dialog hedit {
  399.   title Hash Table Editor
  400.   size -1 -1 260 142
  401.   option dbu
  402.  
  403.   edit "Coded By: Imrac", 1, 0 131 260 11, read right autohs
  404.  
  405.   box "Tables", 2, 2 3 75 125
  406.   list 3, 7 13 65 94, vsbar sort
  407.   button "Add", 4, 7 101 32 11
  408.   button "Remove", 5, 40 101 32 11
  409.   button "Rename", 6, 7 113 32 11
  410.   button "Clear", 7, 40 113 32 11
  411.  
  412.   box "Items", 8, 80 3 178 125
  413.   list 9, 85 13 65 102, vsbar sort
  414.  
  415.   button "Add", 10, 85 113 32 11
  416.   button "Remove", 11, 118 113 32 11
  417.  
  418.   box "Data", 12, 155 9 98 63
  419.   text "Item", 13, 158 17 50 9
  420.   edit "",14, 158 25 92 11, autohs
  421.   text "Data", 15, 158 37 50 9
  422.   edit "", 16, 158 45 92 11, autohs
  423.   button "Update", 17, 189 58 30 11
  424.  
  425.   box "Search", 18, 155 74 98 51
  426.   check "Data", 19, 179 83 24 9
  427.   check "Table", 20, 207 83 24 9
  428.   edit "", 21, 158 95 92 11, autohs
  429.   check "Regular Ex.", 22, 158 111 35 9
  430.   button "Clear", 23, 215 109 35 11
  431. }
  432.  
  433. on *:Dialog:hedit:*:*:{
  434.   if ($devent == init) {
  435.     var %x = $hget(0)
  436.     did -o $dname 2 1 Tables $+($chr(40),%x,$chr(41))
  437.     did -b $dname 5-23
  438.     while (%x) {
  439.       did -a $dname 3 $hget(%x)
  440.       dec %x
  441.     }
  442.     did -f $dname 3
  443.   }
  444.   if ($devent == sclick) {
  445.     var %tb = $did($dname,3).seltext
  446.     var %it = $did($dname,9).seltext
  447.  
  448.     If ($did == 1) { did -j $dname 3 }
  449.  
  450.     ; // Click On Table List //
  451.     If ($did == 3) && (%tb) {
  452.       did -e $dname 5-10
  453.       did -u $dname 9
  454.       iu
  455.       If ($did($dname,21).text) { itemsearch }
  456.       did -o $dname 1 1 Table: ' $+ %tb $+ ' Items: $hget(%tb,0).item Size: $hget(%tb).size
  457.     }
  458.  
  459.     ; // Click On Item List //
  460.     If ($did == 9) && ($did($dname,$did).seltext) {
  461.       did -e $dname 11-17
  462.       var %t = $did($dname,3).seltext
  463.       var %i = $did($dname,9).seltext
  464.       did -o $dname 14 1 %i
  465.       did -o $dname 16 1 $hget(%t,%i)
  466.     }
  467.  
  468.     ; // ADD NEW HASH TABLE BUTTON //
  469.     If ($did == 4) {
  470.       var %n = $input(Hash Table Name:,equd,New Hash Table)
  471.       If (%n == $null) { derror -c No Name Given }
  472.       ElseIf ($regex(%n,/ /)) {  derror -c Hash Table Name Can Not Contain Spaces }
  473.       ElseIf ($hget(%n)) {  derror -c Hash Table Name Already Exists }
  474.       Else {
  475.         var %s = $input(Hash Table Size:,equd,New Hash Table,100)
  476.         If (%s == $null) {  derror -c No Size Specified }
  477.         ElseIf (%s !isnum 1-) || (%s != $int(%s)) {  derror -c Invalid Size Specified }
  478.         Else {
  479.           hmake %n %s
  480.           did -o $dname 1 1 Success: Made Hash Table.
  481.           did -a $dname 3 %n
  482.           did -o $dname 2 1 Tables $+($chr(40),$hget(0),$chr(41))
  483.         }
  484.       }
  485.     }
  486.  
  487.     ; // Remove Hash table //
  488.     If ($did == 5) {
  489.       If ($input(Are You Sure You Want To Remove Hash Table ' $+ %tb $+ ', wudy, Remove Table)) {
  490.         hfree %tb
  491.         did -o $dname 1 1 Success: Removed Hash Table.
  492.         did -d $dname 3 $did($dname,3).sel
  493.         did -r $dname 14,16,9,21
  494.         did -b $dname 5-23
  495.         did -o $dname 2 1 Tables $+($chr(40),$hget(0),$chr(41))
  496.         did -o $dname 8 1 Items
  497.       }
  498.     }
  499.  
  500.     ; // Rename Hash Table
  501.     If ($did == 6) {
  502.       var %n = $input(Hash Table's New Name:,equd,Rename Hash Table)
  503.       If (%n == $null) { derror -r No New Name Specified }
  504.       ElseIf ($regex(%n,/ /)) { derror -r Hash Table Name Can Not Contain Spaces }
  505.       Else {
  506.         did -o $dname 1 1 Success: Renamed Hash Table.
  507.         hrename %tb %n
  508.         did -d $dname 3 $did($dname,3).sel
  509.         did -ac $dname 3 %n
  510.       }
  511.     }
  512.  
  513.     ; // Clear Hash Table //
  514.     If ($did == 7) {
  515.       var %c = $input(Are You Sure You Want To Clear All Items From ' $+ %tb $+ '?, wudy, Clear Table)
  516.       If (%c) { hdel -w %tb * | iu | did -o $dname 1 1 Success: Removed Hash Table. }
  517.     }
  518.  
  519.     ; // Add item to table //
  520.     If ($did = 10) {
  521.       var %ni = $input(New Item Name:,equd,Add Item)
  522.       If (%ni == $null) { derror -a No Item Name Specified }
  523.       ElseIf ($regex(%ni,/ /)) { derror -a Item Name Can Not Contain Spaces }
  524.       ElseIf ($hget(%tb,%ni)) { derror -a Item Already Exists }
  525.       Else {
  526.         var %nd = $input(New Item Data:,equdv,Add Item)
  527.         If (%nd == $cancel) { derror -a Cancelled }
  528.         Else {
  529.           hadd %tb %ni %nd
  530.           did -o $dname 1 1 Success: Added Item.
  531.           itemsearch
  532.         }
  533.       }
  534.     }
  535.  
  536.     ; // Remove an item from the table //
  537.     If ($did = 11) {
  538.       var %yn = $input(Are You Sure You Want To Delete ' $+ %it $+ '.,wdyu,Remove Item)
  539.       if (%yn) {
  540.         hdel %tb %it
  541.         itemsearch
  542.         did -o $dname 1 1 Success: Removed Item.
  543.       }
  544.     }
  545.  
  546.     ; // Update an item //
  547.     If ($did == 17) {
  548.       var %ni = $did($dname,14).text
  549.       If (%ni == $null) { derror -u No Item Name Given }
  550.       ElseIf ($regex(%ni,/ /)) { derror -u Item Name Can Not Contain Spaces }
  551.       Else {
  552.         did -o $dname 1 1 Success: Updated Item.
  553.         hdel %tb %it
  554.         hadd %tb %ni $did($dname,16).text
  555.         did -d $dname 9 $did($dname,9).sel
  556.         did -ac $dname 9 %ni
  557.         If ($did($dname,21).text) { itemsearch }
  558.       }
  559.     }
  560.     If ($did == 19) { if ($did($dname,21).text) { itemsearch  } }
  561.     If ($did == 20) { if ($did($dname,21).text) { itemsearch  } }
  562.     If ($did == 22) { if ($did($dname,21).text) { itemsearch  } }
  563.     If ($did == 23) { did -r $dname 21 | did -u $dname 19,20,22 | itemsearch }
  564.   }
  565.  
  566.   If ($devent == edit) {
  567.     If ($did = 21) { itemsearch | did -f $dname 21 }  
  568.   }
  569. }
  570.  
  571.  
  572. alias -l itemsearch {
  573.   If ($did($dname,21).text) {
  574.     var %t = $did($dname,3).seltext
  575.     var %sel = $did($dname,9).seltext
  576.     var %f = $iif($did($dname,22).state,r,w)
  577.     var %f = $iif($did($dname,20).state,$upper(%f),$lower(%f))
  578.     var %d = $iif($did($dname,19).state,.$true,)
  579.     var %s = $did($dname,21).text
  580.     var %x = $iif(%d,$hfind(%t,%s,0,%f).data,$hfind(%t,%s,0,%f))
  581.     did -o $dname 8 1 Items $+($chr(40),%x,/,$hget(%t,0).item,$chr(41))
  582.     did -r $dname 9
  583.     while (%x) {
  584.       if (%d) var %st = $hfind(%t,%s,%x,%f).data
  585.       else var %st = $hfind(%t,%s,%x,%f)
  586.       did -a $dname 9 %st
  587.       dec %x
  588.     }
  589.     If (%sel) && ($didreg($dname,9,/^ $+ %sel $+ $/)) { did -c $dname 9 $v1 }
  590.     Else {
  591.       did -r $dname 14,16
  592.       did -b $dname 11-17
  593.     }
  594.   }
  595.   Else {
  596.     iu
  597.   }
  598. }
  599.  
  600. alias -l iu {
  601.   var %tb = $did($dname,3).seltext
  602.   var %it = $did($dname,9).seltext
  603.   var %x = $hget(%tb,0).item
  604.   did -r $dname 9
  605.   did -o $dname 8 1 Items $+($chr(40),%x,$chr(41))
  606.   did -e $dname 18-23
  607.   while (%x) { did -a $dname 9 $hget(%tb,%x).item | dec %x }
  608.   If (%it) && ($didreg($dname,9,/^ $+ %it $+ $/)) { did -c $dname 9 $v1 }
  609.   Else {
  610.     did -r $dname 14,16
  611.     did -b $dname 11-17
  612.   }
  613. }
  614.  
  615.  
  616.  
  617. alias hrename {
  618.   var %t1 = $1, %t2 = $2
  619.   hmake %t2 $hget(%t1).size
  620.   var %x = $hget(%t1,0).item
  621.   while (%x) {
  622.     hadd %t2 $hget(%t1,%x).item $hget(%t1,%x).data
  623.     dec %x
  624.   }
  625.   hfree %t1
  626. }
  627.  
  628. alias -l derror {
  629.   If ($1 == -c) { did -o $dname 1 1 Error: Unable To Create Hash Table. ( $+ $2- $+ ) }
  630.   ElseIf ($1 == -r) { did -o $dname 1 1 Error: Unable To Rename Hash Table. ( $+ $2- $+ ) }
  631.   ElseIf ($1 == -a) { did -o $dname 1 1 Error: Unable To Add Item. ( $+ $2- $+ ) }
  632.   ElseIf ($1 == -u) { did -o $dname 1 1 Error: Unable To Update Item. ( $+ $2- $+ ) }
  633. }
  634. alias tinyurl {
  635.   var %c $iif($isid,return,echo -a)
  636.   if ($1) && (!$com(u)) && (!$sock(tinyurl)) {
  637.     if ($regex($1,/^(?:(?:f|ht)tps?:\/\/|[^<>\/:\s])+[^<>.:\/\s]+(?:\.[^\/:<>.\s]{2,6})+(?:\/.*?)?$/i)) {
  638.       sockopen tinyurl www.tinyurl.com 80
  639.       sockmark tinyurl /create.php?url= $+ $remove($1-,$chr(32))
  640.       .comopen u Wscript.Shell
  641.       .comclose u $com(u,run,1,bstr*,$(%comspec%,) /c ping.exe -n 2 127.0.0.1 >nul,uint,0,bool,true)
  642.       %c $iif(%tinyurl,$v1,No result.)
  643.     }
  644.     else %c Invalid URL!
  645.   }
  646.   else %c $iif($1,Please be patient...,Input a URL!)
  647. }
  648. on *:sockopen:tinyurl: {
  649.   if ($sockerr) {
  650.     set -u3 %tinyurl Error connecting: $sock($sockname).wsmsg
  651.     sockclose $sockname
  652.   }
  653.   else {
  654.     sockwrite -n $sockname GET $sock($sockname).mark HTTP/1.1
  655.     sockwrite -n $sockname Host: tinyurl.com
  656.     sockwrite -n $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8)
  657.     sockwrite -n $sockname $crlf
  658.   }
  659. }
  660. on *:sockread:tinyurl: {
  661.   if ($sockerr) {
  662.     set -u3 %tinyurl Error connecting: $sock($sockname).wsmsg
  663.     sockclose $sockname
  664.   }
  665.   else {
  666.     var %x
  667.     sockread %x
  668.     if ($regex(%x,/<blockquote><b>(.*?)<\/b><br>/)) {
  669.       set -u3 %tinyurl $regml(1)
  670.       sockclose $sockname
  671.     }
  672.   }
  673. }
  674. on $*:TEXT:/^[.!@]tiny(url)? .*?$/Si:#: {
  675.   if (!%tinyurl. [ $+ [ $2 ] ]) {
  676.     var %c = $tinyurl($2)
  677.     msg $chan $iif(error !isin %c && invalid !isin %c,TinyURL converted: %c $+([,From $len($2) to $len(%c) chars,]),%c)
  678.     set -u5 %tinyurl. $+ $2 1
  679.   }
  680. }
Add Comment
Please, Sign In to add comment