All pastes #789274 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-11-20 00:44 UTC
rendered paste body
alias -l auth.autoretrieve {
  return 1
}
alias auth {
  if $isid && $status == connected {
    if $1 == $null {
      return
    }
    var %table = auth.cache. $+ $cid
    if $hget(%table,$1) {
      return $ifmatch
    }
    elseif *.users.gamesurge.net iswm $address($1,2) {
      hadd -m %table $nick $gettok($remove($address($1,2),*!*@),1,46)
    }
    if $istok(95 98 ME,$os,32) {
      var %type = s, %pause = 1, %count = 5
    }
    else {
      var %type = ms, %pause = 200, %count = 3500
    }
    hadd -m %table $1 $false
    inc %auth.who
    !.quote WHO $1 n%nat,666
    while %count > 0 {
      if $hget(%table,$1) || $hget(%table,$1) == 0 {
        break
      }
      dec %count %pause
      pause %type %pause
    }
    if $hget(%table,$1) == :null: {
      hdel -w %table $1
    }
    var %result = $hget(%table,$1)
    if !$comchan($1,0) || %result == $false || %result == 0 {
      hdel -w %table $1
    }
    !.timerauth.cleanup 1 3 auth.cleanup
    return $iif(%result != 0,$ifmatch,$iif(%result == 0,$false,$null))
  }
}
alias -l auth.timers {
  var %index = 1, %count = 0
  while %index <= $timer(0) {
    if auth.* iswm $timer(%index) {
      inc %count
    }
    inc %index
  }
  return %count
}
alias -l auth.checknet {
  if *.quakenet.org !iswm $server {
    halt
  }
}
alias -l auth.cleanup {
  var %table = auth.cache. $+ $cid
  while $hfind(%table,0,1).data {
    hdel -w %table $ifmatch
  }
  while $hfind(%table,$false,1).data {
    hdel -w %table $ifmatch
  }
  while $hfind(%table,:null:,1).data {
    hdel -w %table $ifmatch
  }
}
alias -l auth.remove {
  var %table = auth.cache. $+ $cid, %index = 1, %nick
  while $hget(%table,%index).item {
    %nick = $hget(%table,%index).item
    if $comchan(%nick,0) == 1 && $comchan(%nick,1) == $chan {
      hdel -w %table %nick
    }
    else {
      inc %index
    }
  }
}
alias -l auth.get {
  var %table = auth.cache. $+ $cid
  if $auth.autoretrieve && !$hget(%table,$nick) {
    if *.users.quakenet.org iswm $site {
      hadd -m %table $nick $gettok($site,1,46)
    }
    else {
      if !$hget(%table $+ .tmp,$nick) {
        var %timers = $auth.timers, %delay = $calc((%timers + 1) * 1500)
        !.timerauth. $+ %timers -m 1 %delay !.echo -q $!auth( $nick )
      }
      if $istok(action text,$event,32) {
        hadd -mu600 %table $+ .tmp $nick $true
      }
    }
  }
}
raw 354:* 666 * *:{
  var %table = auth.cache. $+ $cid
  hadd -m %table $3 $4
  haltdef
}
raw 315:*:{
  if %auth.who {
    var %table = auth.cache. $+ $cid
    if !$hget(%table,$2) && $hget(%table,$2) != 0 {
      hadd -m %table $2 :null:
    }
    dec %auth.who
    if !%auth.who {
      unset %auth.who
    }
    haltdef
  }
}
on !*:JOIN:#:{
  auth.checknet
  auth.get
}
on *:ACTION:*:#:{
  auth.checknet
  auth.get
}
on *:TEXT:*:#:{
  auth.checknet
  auth.get
}
on *:TOPIC:#:{
  auth.checknet
  auth.get
}
on *:RAWMODE:#:{
  auth.checknet
  auth.get
}
on *:NICK:{
  auth.checknet
  auth.get
  var %table = auth.cache. $+ $cid
  if $hget(%table,$nick) {
    hdel -w %table $nick
    hadd -m %table $newnick $ifmatch
  }
}
on *:PART:#:{
  auth.checknet
  var %table = auth.cache. $+ $cid
  if $hget(%table) {
    if $nick == $me {
      auth.remove
    }
    elseif $comchan($nick,0) == 1 {
      hdel -w %table $nick
    }
  }
}
on *:QUIT:{
  auth.checknet
  var %table = auth.cache. $+ $cid
  if $hget(%table) {
    hdel -w %table $nick
  }
}
on *:KICK:#:{
  auth.checknet
  auth.get
  var %table = auth.cache. $+ $cid
  if $hget(%table) {
    if $knick == $me {
      auth.remove
    }
    elseif $comchan($knick,0) == 1 {
      hdel -w %table $knick
    }
  }
}
on *:DISCONNECT:{
  auth.checknet
  hfree -w auth.cache. $+ $cid
  hfree -w auth.cache. $+ $cid $+ .tmp
}

;  /pause by FiberOPtics - http://www.mircscripts.org/comments.php?cid=2924
;  Note: I butchered the code to cut down the filesize.

alias pause {
  var %wsh = wsh $+ $ticks, %cmd
  if ($1 == s) %cmd = ping.exe -n $int($calc($2 + 1)) 127.0.0.1
  else %cmd = pathping.exe -n -w 1 -q 1 -h 1 -p $iif($2 > 40,$calc($2 - 40),$2) 127.0.0.1
  .comopen %wsh wscript.shell
  .comclose %wsh $com(%wsh,run,1,bstr*,% $+ comspec% /c %cmd >nul,uint,0,bool,true)