All pastes #70363 Raw Edit

Oww My Nose

public text v1 · immutable
#70363 ·published 2006-06-24 03:37 UTC
rendered paste body
on *:TEXT:?clans*:#:{
  .notice $nick I'm working on it, I'm working on it | halt
  if ($left($1,1) !isin @!.) halt
  else {
    set $+(%,clan.,%clanid,.name) $replace($2-,$chr(32),$chr(95))
    if ($len($+(%,clan.,%clanid,.name)) > 12) { 
      msg $chan Name cannot be longer than 12 characters 
      unset %clan.*
    }
    else { 
      inc %clanid
      set $+(%,clan.,%clanid,.display) $iif($left($1,1) == @,msg $+(%,clan.,%clanid,.chan),notice $+(%,clan.,%clanid,.nick))
      .notice $nick Processing request... please wait about 1 minute for the Runehead server to respond
      set $+(%,clan.,%clanid,.nick) $nick
      set $+(%,clan.,%clanid,.chan) $chan
      set $+(%,clan.,%clanid,.found) no
      clan.chk
    } 
  }
}
alias clans {
  set $+(%,clan.,%clanid,.name) $replace($1-,$chr(32),$chr(95))
  if ($len($+(%,clan.,%clanid,.name)) > 12) { 
    msg $chan Name cannot be longer than 12 characters 
    unset $+(%,clan.,%clanid,.name)
  }
  else { 
    msg $active !clans $1-
    inc %clanid
    set $+(%,clan.,%clanid,.display) msg $active
    echo -a Processing request... please wait about 1 minute for the Runehead server to respond
    set $+(%,clan.,%clanid,.nick) $me
    set $+(%,clan.,%clanid,.chan) $active
    set $+(%,clan.,%clanid,.found) no
    clan.chk
  } 
}

alias clan.chk {
  .sockopen $+(clanlookup.,%clanid) www.runehead.com 80
}

alias striphtml.clan {
  var %clan.txt = $gettok($1,3,62)
  %clan.txt = $gettok(%clan.txt,1,60)
  return %clan.txt
}
alias striphtml.site {
  var %clan.txt.s = $gettok($1,2,62)
  %clan.txt.s = $gettok(%clan.txt.s,1,60)
  %clan.txt.s = $gettok(%clan.txt.s,2,39)
  return $+(www.runehead.com/clans/,%clan.txt.s)
}
alias clan.output {
  var %clan.output = $+(12,$striphtml.clan($read($+(clanlookup,%clanid,.txt),1)),) 14( $+ $striphtml.site($read($+(clanlookup,%clanid,.txt),1)) $+ 14),%i = 2
  while ($read($+(clanlookup,%clanid,.txt),%i) != $null) {
    %clan.output = %clan.output $+ , $+(12,$striphtml.clan($read($+(clanlookup,%clanid,.txt),%i)),) 14( $+ $striphtml.site($read($+(clanlookup,%clanid,.txt),%i)) $+ 14)
    inc %i
  }
  $+(%,clan.,%clanid,.display) %clan.output %logo
  cleanup %clanid
}
alias cleanup {
  .sockclose clan.lookup. $+ $1
  unset $+(%,clan.,$1,.*)
  ;remove $+(clanlookup,$1,.txt)
}
on *:SOCKOPEN:clanlookup.*: {
  if ($sockerr) { echo -a $sock($sockname).wsmsg | return }
  .set $+(%,clan.,%clanid,.findings) no
  .sockwrite -n $sockname POST /clans/search.php?search= $+ $+(%,clan.,%clanid,.name) $+ &searchtype=exact HTTP/1.1
  .sockwrite -n $sockname Host: $+(www.runehead.com,$crlf,$crlf)
}
on *:SOCKREAD:clanlookup.*: {
  if ($sockerr) { echo -a $sock($sockname).wsmsg | return }
  .sockread %clan.find
  set %clan.output $null
  if (*<p><b>*</b> is currently on the Memberlist(s):</p>* iswm %clan.find) %clan.found = yes
  if (*<td style='width:90px; border-color:#404040;'><a href='ml.php?clan=*</a></td>* iswm %clan.find) {
    write $+(clanlookup,%clanid,.txt) %clan.find
  }
}
on *:SOCKCLOSE:clanlookup.*: {
  if (%clan.found == no) { msg $+(%,clan.,%clanid,.chan) $upper($left($+(%,clan.,%clanid,.name),1)) $+ $right($+(%,clan.,%clanid,.name),-1) is not in any clans on runehead.com | cleanup %clanid }
  cleanup %clanid
}