All pastes #573251 Raw Edit

Qc

public text v1 · immutable
·published 2007-06-18 01:57 UTC
rendered paste body
menu nicklist {
  Pm Control
  .Allow PMs From $1:PmControl add $$1
  .Disallow PMs From $1:PmControl Del $$1
}
alias PmControl {
  if ( $1 == add ) {
    if ( $address($2,0) != $null ) {
      hadd -m PmControl $right($address($2,0),-2)
      echo 3 -a Added $right($address($2,0),-2) to PmAccept List
    }
    else {
      .enable #userhostadd
      userhost $2
    }
  }
  if ( $1 == del ) {
    if ( $address($2,0) != $null ) {
      hdel PmControl $right($address($2,0),-2)
      echo 3 -a Removed $right($address($2,0),-2) From the PmAccept List
    }
    else {
      .enable #userhostdel
      userhost $2
    }
  }
}
#userhostadd off
raw 302:*: {
  hadd -m PmControl $right($gettok($1-,2,61),-1)
  echo 3 -a Added $right($address($2,0),-2) to PmAccept List
  .disable #userhostadd
  halt
}
#userhostadd end
#userhostdel off
raw 302:*: {
  hdel PmControl $right($gettok($1-,2,61),-1)
  echo 3 -a Removed $right($address($2,0),-2) From the PmAccept List
  .disable #userhostdel
  halt
}
#userhostdel end
on ^*:open:?:*: {
  if ( !$hfind(PmControl,$address) ) {
    hinc -mu60 PmControl $+(Flood.,$address)
    if ( $hget(PmControl,$+(Flood.,$address)) == 1 ) {
      .msg $nick $ewrap(Sorry this PM Has been automatically rejected as you are not on my accept list. Please Contact me through a Known Channel.)  
    }
    halt
  }
}
On *:start: {
  hmake PmControl 20
  $iif( $isfile(PmControl.hsh) , hload PmControl PmControl.hsh )
}
on *:Exit: {
  hsave -o PmControl PmControl.hsh
  hfree PmControl
} 

alias ewrap {
  var %msg
  var %tok = 1
  var %word
  while ($gettok($1-,%tok,32) != $null) {
    %word = $gettok($1-,%tok,32)
    %msg = %msg 15 $+ $upper($left(%word,1)) $+ 15 $+ $right(%word,-1) 
    inc %tok
  }
  return 12,1(15 $+ %msg $+ 12)
}