Author Topic: Blacklist Input  (Read 179 times)

morbid

  • Trial Moderator
  • Junior
  • ***
  • Posts: 61
  • Reputation +0/-0
  • I own you
  • Location: I'm probably standing right behind you.
    • View Profile
Blacklist Input
« on: February 15, 2011, 06:36:01 pm »
Again don't like dialogs. And I am aware this snippet isn't clean but *shrugs
It still works.
Code: [Select]
on *:input:#:{
  if ($1 == +blk) { /write blacklist.txt $2 | set %nick $2 | set %rp $address($2,4) | /write blacklist.txt %rp | echo 14 $2 Has been added to your blacklist. | kick $chan $2 }
  if ($1 == -blk) { /write -ds %rp blacklist.txt | /write -ds $2 blacklist.txt | echo 14 $2 Has been removed from your blacklist | unset %nick | unset %rp }
  if ($1 == .list) {
    var %count = 0
    var %i = 1
    while (%i <= $lines(blacklist.txt)) {
      //echo - $+ $read(blacklist.txt, %i)       
      inc %i
      inc %count
    }
    if (%count == 0) {
      echo    None. 
    }
  }
}
 
on *:JOIN:#:{
  if ($read(blacklist.txt,w,$nick)) || ($read(blacklist.txt,w,$address($nick,4))) {
    ban $chan %rp | kick $chan $nick 0,1 Blacklist: %nick , IP: %rp | unset %t
    else halt {
    }
  }
}

Or if you like using the user list feature
this will work

Code: [Select]
on @blacklist:join:#:{
  ban -k # $nick 4 0,1 Blacklist: $nick , IP: $address($nick,4)
}
on @*:input:#:{
  if $1 = .list {
    var %^ tokenize 32
    while $ulist(*,$0) { %^ $1- $v1 } | %^ $2-
    echo # * Banned Addresse(s) in my black list:
    scon -r echo # $* -> $!ial( $* ).nick
  }
  if $2 ison # {
    var %a $ulist($address($2,4))
    if $regex($1,/^([+-])blk\b/) && $regml(1) = + {
      goto $iif(!%a,x,$iif(%a,y)) | :x | .guser -a blacklist $2 4
      echo # 14 * The user $qt($2) has been added to your black list.
      kick # $2 You've been placed on my black list!
      halt | :y | echo # 14 * The user $qt($2) is already added! | halt
    }
    else {
      goto $iif(%a,z,~) | :z | .ruser blacklist $2 4
      echo # 14 The user $qt($2) has been removed from your black list. | halt
      :~ | echo # 14 * The user $qt($2) was removed or doesn't exist on my black list!
      halt
    }
  }
}

Share on Bluesky Share on Facebook