Public feed #722170

Miscellany

public text v1 · immutable
Raw Edit
·published 2007-10-01 20:20 UTC
rendered paste body
dialog swiftirc {
  title "Swiftirc forum searcher."
  size -1 -1 341 252
  option dbu
  edit "", 1, 12 99 56 142, multi return autovs
  text "Forum:", 2, 12 87 25 8
  edit "", 3, 79 99 56 142, multi return autovs
  text "Topics:", 4, 79 87 25 8
  edit "", 5, 147 99 56 142, multi return autovs
  text "Author:", 6, 147 87 25 8
  edit "", 7, 214 99 56 142, multi return autovs
  text "last reply:", 8, 214 87 25 8
  edit "", 9, 278 99 21 142, multi return autovs
  text "Replies & views", 10, 278 87 36 8
  edit "", 11, 305 99 21 142, multi return autovs
  box "Results", 12, 5 80 330 168
  text "Search for Keywords:", 13, 8 18 57 8
  edit "", 15, 68 17 115 10
  text "Search for Author:", 14, 8 30 45 8
  edit "", 16, 68 29 115 10
  text "Forum:", 17, 8 44 25 8
  text "Category:", 18, 8 57 29 8
  combo 19, 68 43 115 50, size drop
  combo 20, 68 57 115 50, size drop
  box "Search options", 21, 3 6 193 70
  button "Search", 22, 203 10 37 12
  button "Exit", 23, 244 11 37 12, cancel
  button "Clear", 24, 288 11 37 12
  text "http://forum.swiftirc.net", 25, 230 44 65 8
}
alias swift dialog -m swiftirc swiftirc
on *:dialog:swiftirc:sclick:24: did -r swiftirc 1,3,5,9,7,11
on *:dialog:swiftirc:sclick:22:{ 
  did -r swiftirc 1,3,5,9,7,11
  sockopen swiftirc www.swiftirc.net 80
}
on *:sockopen:swiftirc:{ echo hello
  set %booba search_keywords= $+ $urlencode($did(swiftirc,15)) $+ &search_terms=any&search_author= $+ $urlencode($did(swiftirc,16)) $+ &search_forum= $+ $iif($urlencode($did(swiftirc,19)),$did(swiftirc,19).sel,-1) $+ &search_time=0&search_fields=all&search_cat= $+ $iif($urlencode($did(swiftirc,19)),$did(swiftirc,19).sel,-1) $+ &sort_by=0&sort_dir=DESC&show_results=topics&return_chars=200
  sockwrite -nt $sockname POST /forum/search.php HTTP/1.1
  sockwrite -nt $sockname Host: www.swiftirc.net
  sockwrite -nt $sockname Content-Length: $len(%swiftirc)
  sockwrite -nt $sockname Content-Type: application/x-www-form-urlencoded
  sockwrite -nt $sockname $crlf %swiftirc
} 
alias -l htmlfree {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&,$chr(9))
  return %x
}
alias urlencode {
  var %a = $regsubex($$1,/([^\w\s])/Sg,$+(%,$base($asc(\t),10,16,2)))
  return $replace(%a,$chr(32),$chr(43))
} 
on *:sockread:swiftirc:{
  if ($sockerr) sockclose $sockname
  else {
    var %hello
    sockread %hello
    echo 1 -t %hello
    if (<td class="row2" align="left"><a href="*" class="mainmenu"> iswm %hello) {
      did -a swiftirc 1 $htmlfree($v2)
      sockread %hello
      did -a swiftirc 3 $htmlfree(%hello)
      sockread %hello
      did -a swiftirc 5 $htmlfree(%hello)
      sockread %hello
      did -a swiftirc 9 $htmlfree(%hello)
      sockread %hello
      did -a swiftirc 11 $htmlfree(%hello)
      sockread %hello
      did -a swiftirc 7 $htmlfree(%hello)
      sockclose $sockname
    }
    if (no result isin %hello) did -a swiftirc 1,3,5,9,7,11 No results.
  }
}