All pastes #251880 Raw Edit

Unnamed

public text v1 · immutable
#251880 ·published 2006-11-18 19:40 UTC
rendered paste body
on *:TEXT:!song:#: up
set %chan $chan

alias up {
  sockopen up matt-henty.co.uk 80 
  set %chan $chan 
}
on *:SOCKOPEN:up: { 
  /sockwrite -nt $sockname GET /sam/playing.html HTTP/1.1
  /sockwrite -nt $sockname Host: matt-henty.co.uk
  /sockwrite -nt $sockname $crlf 
} 
on *:SOCKREAD:up: { 
  if ($sockerr) { 
    msg %chan Error while reading sock. ( $+ $sockerr $+ ) 
    halt 
  } 
  else { 
    set %read | sockread %read
    if (<td><font size="2" color="#003366"><small>*</small></font></td> iswm %read) {
      set %read $nohtml(%read)
      msg %chan $c1(12Current Song Playing:) %read
      unset %chan 
      sockclose up 
    }
  } 
}
alias nohtml { var %x,%y = $regsub($1-,/(<[^>]+>)/g,$null,%x) | return %x } 
alias c1 { return $+(,$1-,) } 
alias c2 { return $+(,,$1-,,) }