All pastes #638040 Raw Edit

Anonymous

public text v1 · immutable
#638040 ·published 2007-07-29 14:11 UTC
rendered paste body
On $*:TEXT:/^[!@](price(check)?|gold)/Si:#:{ if ($chan == #pc) { halt }
  If ($chan == #rsmarket) { halt }
  If (!$2) { notice $nick [Price Guide]: You must supply a item - !price <item> }
  Else {
    Inc %id
    Set $+(%,price.item.,%id) $replace($2-,$chr(32),$chr(37) $+ 20)
    Set $+(%,price.style.,%id) $iif($left($1,1) == @,msg $chan,notice $nick)
    Sockopen $+(price.,%id) zybez.net 80
  }
}
On *:SOCKOPEN:price.*:{
  Var %id = $gettok($sockname,2,46)
  Sockwrite -nt $sockname GET /priceguide.php?search_terms= $+ $($+(%,price.item.,%id),2) $+ &search_area=1&price_low=&price_high=&member=1 HTTP/1.1
  Sockwrite -nt $sockname Host: www.zybez.net
  Sockwrite -nt $sockname $+($crlf,$crlf)
}
On *:SOCKREAD:price.*:{
  Var %id = $gettok($sockname,2,46)
  Var %style = $($+(%,price.style.,%id),2), $&
    %item = $replace($($+(%,price.item.,%id),2),$chr(37) $+ 20,$chr(32))
  If ($sockerr) {
    %style An error occured while connecting
    Unset $+(%,price.*)
    Sockclose $+(price.,%id)
  }
  Else {
    Var %read
    Sockread %read
    If (*<td class="tablebottom" colspan="5">Your search did not return any results. Please make sure your spelling is correct and that you are typing full words.</td>* iswm %read) {
      %style  11,4Geen resultaten gevonden voor: " $+ %item $+ "
      Unset $+(%,price.*.,%id)
      Sockclose $+(price.,%id)
    }
    If (*<!--name--><td class='tablebottom'>*</td>* iswm %read) {
      Tokenize 32 $nohtml(%read)
      Set $+(%,price.name.,%id) $1-
    }
    If (*<!--price--><td class="tablebottom">*</td>* iswm %read) {
      Tokenize 32 $nohtml(%read)
      Set $+(%,price.price.,%id) $1-
    }
    If (*<td class="tablebottom"><a href="/priceguide.php?category=*">*</a></td>* iswm %read) {
      Tokenize 32 $nohtml(%read)
      Inc $+(%,price.times.,%id)
      If ($($+(%,price.times.,%id),2) == 6) {
        %style Max results of 5 allowed. Try making your search for " $+ %item $+ " more specific.
        Unset $+(%,price.*.,%id)
        Sockclose $+(price.,%id)
      }
      Elseif ($($+(%,price.times.,%id),2) <= 5) {
        %style 4[3Item4]3 $($+(%,price.name.,%id),2) 4Price :3 $($+(%,price.price.,%id),2) 4Category : 3 $1-
        Unset $+(%,price.name.,%id)
        Unset $+(%,price.price.,%id)
      }
    }
    If (*</html>* iswm %read) {
      Unset $+(%,price.*.,%id)
      Sockclose $+(price.,%id)
    }
  }
}
Alias -l nohtml {
  Var %x,%i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x)
  %x = $replace(%x,&nbsp;,$null)
  Return  %x
}