; BorgIRC Channel management
; -------------------------------------------------

; Operator control commands
; -------------------------------------------
alias req.op { 
  if ($me.op($1)) || ($me.own($1)) { return } | if ($2 == h) && ($me.hop($1)) { return }
  else { fx denied | a $^err $_(bc240) | h }
}
alias req.own if ($me.own($1)) { return } | else { fx denied | a $^err $_(bc241) | h }

alias own setmode $1 +q $2
alias deown setmode $1 -q $2
alias op setmode $1 +o $2
alias deop setmode $1 -o $2
alias vo setmode $1 +v $2
alias devo setmode $1 -v $2
alias halfop setmode $1 +h $2
alias dehalfop setmode $1 -h $2

alias me.hop var %1 = $iif($1,$1,#) | return $iif($me ishop %1,$true,$false)
alias me.op {
  var %1 = $iif($1,$1,#) 
  return $iif( ( ($2 == h) && ($me ishop %1)) || (($me isop %1) && (!$me.own(%1))),$true,$false)
}

alias me.own { 
  if ($netw == IrcWorld) { return $false } 
  var %1 = $iif($1,$1,#)
  return $iif( ($isunreal && ~ isin $nick(%1,$me).pnick) || $me isowner %1 || ($ircop),$true,$false)
}

alias isown if ($$1) { var %1 = $iif($1,$1,#) | return $iif( ($isunreal && ~ isin $nick(%1,$2).pnick) || $2 isowner %1,$true,$false) }
alias me.vo var %1 = $iif($1,$1,#) | return $iif($me isvo %1,$true,$false)
alias kickban var %nicks = $iif($2,$2,$snicks) | setban $1 %nicks | a kick $1 %nicks $3-
alias kb kickban $1-


alias setmode { 
  if ($3 == $null) { var %nicks = $replace($snicks,$chr(44),$chr(32)) } | else { var %nicks = $replace($3,$chr(44),$chr(32)) }
  var %no = 1
  if ($numtok(%nicks,32) > 1) {
    while (%no < $numtok(%nicks,32)) {
      var %snicks = $gettok(%nicks,%no,32) $gettok(%nicks,$calc(%no + 1),32) $gettok(%nicks,$calc(%no + 2),32)
      inc %no 3
      if (%snicks) { 
        raw -q mode $1 $2 $+ $str($right($2,1),$calc($numtok(%snicks,32) - 1)) %snicks
      }
    }
  }
  else { 
    raw -q mode $1 $2 %nicks 
  }
}

; raw -q mode $1 $2 $+ $str($right($2,1),$calc($numtok(%nicks,32) - 1)) %nicks

alias acc.chk if (%ircx.sec.access) { access.upd $1 $2 }

; Internal ACCESS list (IRCX)
alias _au { $1- 
  h  ;Feature disabled
  if ($ircx == $false) { fx comply | a $^err $_(bc242) | h } | if ($2 == $null) { fx comply | a $^err /chk.access - syntax: /access.upd [channel] <post-alias> | h }
  req.op $1
  a Updating internal ACCESS list for $1 - please stand by.
  %acc. [ $+ [ $1 ] ] = $true | %acc.post. [ $+ [ $1 ] ] = $2
  access $1 list
}


alias access.chk {
  if ($1 == $null) { fx comply | a $^err An internal error has occured in module access.chk (flags: $1- $+ ) | h }
  var %tmp = 0 
  while (%tmp < $hget(acc. [ $+ [ $1 ] ],0).item) {
    inc %tmp 
    a $hget(acc. [ $+ [ $1 ] ],%tmp)
  }

}


alias kick {
  var %nicks = $iif($2,$2,$snicks)
  var %tmp = 0 
  if ($chr(44) !isin $1- && $chr(44) !isin %nicks) { raw -q kick $1 $2 : $+ $3- | return }
  while (%tmp < $numtok(%nicks,44)) { inc %tmp | raw -q kick $1 $gettok(%nicks,%tmp,44) : $+ $3- }
}

alias setban { 
  if ($2 == $null) { var %nicks = $snicks } | else { var %nicks = $2 }

  unset %tmp0 | var %tmp = 0 
  while (%tmp < $numtok(%nicks,44)) { 
    inc %tmp
    var %adr = $address($gettok(%nicks,%tmp,44),2)
    if (%adr !isin %tmp0) { var %tmp0 = %tmp0 $address($gettok(%nicks,%tmp,44),2) }
  }
  ; auto deop/deowner - security measure
  var %tmp = 0 | unset %set.deop %set.deown
  while (%tmp < $numtok(%nicks,44)) { 
    inc %tmp
    if ($isown($1,$gettok(%nicks,%tmp,44)) && $me.own($1)) { var %set.deown = %set.deown $gettok(%nicks,%tmp,44) | continue }
    if ($gettok(%nicks,%tmp,44) isop $1) { var %set.deop = %set.deop $gettok(%nicks,%tmp,44) }
  }
  ;a blah: @: %set.deop .: %set.deown $numtok(%set.deop,32) $numtok(%set.deown,32)
  a $numtok(%set.deown,32)
  if ((%set.deop) || (%set.deown)) { var -s %tmp1 = -o $+ $str(o,$calc(($numtok(%set.deop,32) + $numtok(%set.deown,32) ) - 1)) }
  a raw -q mode $1 %tmp1 $+ + $+ $str(b,$calc($numtok(%tmp0,32))) %set.deown %set.deop %tmp0
}

; Filter kick/ban control
alias fkb uf -kb $1-
alias fk uf -k $1-
alias uf {
  if ($2 == $null) { var %target = $snick(#,1) } | else { var %target = $2 } | var %adrs = $address(%target,2)
  if (%adrs == $null) { fx comply | a $^err Kan adres van  $+ %target $+  niet vinden. $iif(%target ison #,Voor 4/who # uit,Het doelwit heeft # verlaten.) | return }
  req.op #
  var %tmp = 0 | while (%tmp < $nick(#,0))  { inc %tmp | if ($address($nick(#,%tmp),2) == %adrs) && ($nick(#,%tmp) != $me) { var %nicks = %nicks $nick(#,%tmp) } }

  s Targetted for filter kick $+ $iif(b isin $1,/ban) $+ : %nicks ( $+ %adrs $+ )
  if ($1 != -o) { deop %nicks } | if ($1 == -kb) { ban %adrs }

  if (k isin $1) { 
    var %tmp = 0 | while (%tmp < $numtok(%nicks,32)) { inc %tmp | raw -q kick # $gettok(%nicks,%tmp,32) :Filter kick $+ $iif(b isin $1,/ban) $+  - Matching your address }
    s Filter routine completed.
  }
}

; Mass commands

; Example: /mass -o
alias mass {
  var %tmp2 = $left($right($1,2),1)
  unset %nicks | %loop = 1 | var %tmp = 0
  var %tot = $iif($pm($1),$nick(#,0,$right($1,1)),$nick(#,0,a,$right($1,1)))
  var %pre.tot = %tot
  if $left($right($1,2),1) == q { var %tot = $iif($pm($1),$calc(%tot + $nick(#,0,%tmp2)),$calc(%tot + $nick(#,0,a,%tmp2))) }
  if (%tot != %pre.tot) { inc %loop }

  var %no = 0 | var %tmp = 0
  while (%no < %loop) {
    inc %no
    while (%tmp < %tot) {
      inc %tmp 
      if (%loop > 1) { if (%no == 1) { var %mod = o } | if (%no == 2) { var %mod = q } }
      else { var %mod = $right($1,1) }
      var %chk = $iif($pm($1),$nick(#,0,%mod),$nick(#,0,a,%mod))
      if (%chk < 1) { break }
      var %tmp1 = $iif($pm($1),$nick(#,%tmp,%mod),$nick(#,%tmp,a,%mod))
      if (%tmp1 == $me) { continue }
      var %nicks = %nicks $+ $iif(%tmp > 1,$chr(44)) $+ %tmp1
    }
    var %tmp = 0
  }
  if ($left(%nicks,1) == $chr(44)) { var %nicks = $right(%nicks,$calc($len(%nicks) - 1)) }
  var %div = $int($calc(%tot / 3))
  if (%tot <= 2) && (%tot > 0) {
    if (%nicks) { setmode # $1 %nicks }
    return
  }
  var %tmp = 0 
  while (%tmp < %tot) {
    inc %tmp 3 | if (%tmp > %tot) { break }
    var %tok = $calc(%tmp - 2) $+ - $+ %tmp
    setmode # $iif($1 == -qo,-o,$1) $gettok(%nicks,%tok,44)
  }
}

alias -l pm if ($left($1,1) == $chr(45)) { return $true } | if ($left($1,1) == $chr(43)) { return $false } | fx comply | a $^err An internal error has occured. Script halted. (flags: $1- $+ ) | h

alias mkick {
  req.op # | unset %nicks
  if (o isin $1) { var %no = $nick(#,0,qo) }
  else { var %no = $nick(#,0) } 

  var %tmp = 0 
  while (%tmp < %no) { 
    inc %tmp
    var %nick = $iif( o isin $1,$nick(#,%tmp,qo),$nick(#,%tmp) )
    if (%nick != $me) { var %nicks = %nicks $+ $iif(%tmp > 1,$chr(44)) $+ %nick } 
  }
  if (%nicks) {
    if (b isin $1) { setban # %nicks }
    kick # %nicks Mass kick $+ $iif(b isin $1,/ban) $+  - Channel clearing
  }
  else { fx comply | a $^err Er zijn geen personen beschikbaar voor een mass kick $+ $iif(b isin $1,/ban) $+ . }
}

alias take { 
  var %1 = $iif($1,$1,#) | req.op %1 | var %keys = $rc $+ $rc
  if (($me.op(%1)) && ($nick(%1,0,q) > 0)) { 
    var %tmp = $input(U hebt owner status nodig om dit kanaal succesvol te resetten. Wilt u hiermee doorgaan?,264,Channel reset)
  } 
  a Channel reset in progress... target:  $+ %1
  if ($ircx) { access %1 clear } | mass $iif($ircx,-qo,-o) 
  if ($ircx) {
    set %take. [ $+ [ %1 ] ] 2 
    if ($me.own(%1)) { prop %1 ownerkey : $+ %keys }
    prop %1 hostkey : $+ %keys
    a $^not Owner/host key changed to:  $+ %keys
  }
  mass -v 
  mode %1 +imk $rc $+ $rc $+ $rc
  topic %1 $logo Channel reset
}

alias -l rc return $chr($r(97,122)) $+ $chr($r(97,122)) $+ $chr($r(97,122))

alias kba { 
  req.op #
  var %tmp = 0 
  while (%tmp < $snick(#,0)) {
    inc %tmp
    if ( $comchan($snick(#,%tmp),0).op > 0) {
      var %no = 0 
      while (%no < $comchan($snick(#,%tmp),0)) {
        inc %no 
        if ( $comchan.op( $snick(#,%tmp),%no) ) { kickban $comchan($snick(#,%tmp),%no) $snick(#,%tmp) $kick.reason }
      }
    }
  }
}

alias kick.file return $txtdir $+ kicks.txt
alias kick.reason return $iif($gettok(%kick.reason,1,32),$read($kick.file),$gettok(%kick.reason,2-,32))

; Warnings

alias wn1 ma Can you please behave 12 $+ $iif($1,$1,$snicks) $+ . Thank you for your cooperation.
alias wn2 ma Can you please change your nickname 12 $+ $iif($1,$1,$snicks) $+ . Thank you for your cooperation.
alias wn3 ma Can you please refrain from spamming 12 $+ $iif($1,$1,$snicks) $+ . Thank you for your cooperation.
alias wn4 ma Can you please remove your clone 12 $+ $iif($1,$1,$snicks) $+ . Thank you for your cooperation.

; Old protection system - "Quantum Protection Grid"
; Schedueled for complete rewrite
; -------------------------------------------------------------------------------

on @*:DEOP:#: { 
  ^cc $nick
  if $nick == $me || $nick == $opnick { h }
  if (%mdp == on) {
    if %op.t == $null { unset %dpm.* | set -u10 %op.t on | set %dpm. [ $+ [ $site ] ] 1 | goto noinc }
    set -u10 %op.t on
    if (%op.t == on) { inc %dpm. [ $+ [ $site ] ] 1 }
    :noinc
    if (%dpm. [ $+ [ $site ] ] > 3) && $level($address($nick,8)) < 60 { kb # $nick Auto-ban - Mass deop overtreding | unset %dpm* %op.t }
  }
  if %d.b == on && $me isop $chan { mode $chan +o $opnick | .onotice $chan Deop Bescherming - Er mogen geen mensen ge-deopt worden }
  if %deop.prot == on {
    if ($level($address($opnick,8)) == 50) { fx warning! | mode $chan +o-o $opnick $nick }
    if ($level($address($opnick,8)) == 60) { fx warning! | mode $chan +o-o $opnick $nick }
    if (($level($address($opnick,8)) == 70) && (%ownclone == on)) { fx warning! | mode $chan +o-o $opnick $nick }
  }
  :end
}  
alias -l ^cc if ((chatbot isin $1) && (chatcity isin $netw)) { h }

on *:KICK:#:  { ^cc $nick
  if %kcs == on { inc %kc 1 | if %kcop == $null { set %kcop off }
    if %kcop == on { msg # Kick teller - Kick %kc sinds mijn binnenkomst op IRC om $+ %c.ip2 %logintime }
    if %kcop == off || %kcop == $null { set %bcop off | e # Kick teller - Kick %kc sinds uw binnenkomst op IRC om $+ %c.ip2 %logintime }
  }
  if $me isop $chan { goto begin }
  else { goto end }
  :begin
  if $knick == $nick || $nick == $me { h }
  if %mkp == on {
    if %kt == $null { unset %km.* | set -u10 %kt on | set %km. [ $+ [ $nick ] ] 1 | goto noinc }
    set -u10 %kt on
    if %kt == on { inc %km. [ $+ [ $nick ] ] 1 }
    :noinc
  if (%km. [ $+ [ $nick ] ] > 3) { if $me isop # && !$is.own(#,$nick) { kb # $nick Auto-ban - Mass kick overtreding } | unset %km* %kt } } 
  if %kick.prot == on { 
    if ($level($address($knick,8)) == 50) { fx warning! | kick $chan $nick $gx(4,Kick bescherming) %c.ip $+ $knick mag niet gekickt worden! }
    if ($level($address($knick,8)) == 60) { fx warning! | kick $chan $nick $gx(4,Kick bescherming) %c.ip $+ $knick mag niet gekickt worden! }
    if (($level($address($knick,8)) == 70) && (%ownclone == on)) { fx warning! | kick $chan $nick $gx(4,Kick bescherming) - %c.ip $+ $knick mag niet gekickt worden! }
  }
  :end
}
alias gx return  $+ $1 $+ < $+ $2 $+  $+ $1 $+ >

alias mtch { 
  if $1 iswm $2 $+ !* { return $true } 
  if $1 iswm $2 $+ !*@* { return $true } 
  if $address($2,1) iswm $1 { return $true } 
  if $address($2,2) isin $1 { return $true }
  if $address($2,3) == $1 { return $true }
  if $address($2,4) == $1 { return $true } 
  if $address($2,5) iswm $1 { return $true } 
  if $address($2,9) == $1 { return $true } 
  if $address($2,17) == $1 { return $true } 
  if $address($2,18) == $1 { return $true }
  if ($ip isin $1) { return $true }
  return $false
}

alias pb {
  raw -q mode $chan -o $+ $iif($isunreal,a) $+ $iif($isunreal || $ircx,q) $nick $iif($isunreal,$nick) $iif($isunreal || $ircx,$nick)
  raw -q mode $chan -b+b $banmask $address($nick,2) 
  kick $chan $nick $_(bc030)
}

on *:BAN:#: {
  ^cc $nick | if ($me !isop #) || ($nick == $me) { goto end }

  ; Personal ban protection
  if (%pb.prot == on) { if $mtch($banmask,$me) { pb } }

  ;Ban Block
  if ((%b.b == on) && ($me isop $chan)) { mode $chan -b $banmask | .onotice # Ban blokkade - Graag geen mensen bannen. }

  ; Mass ban protection
  if (%mbp == on) { if %bt == $null { unset %bm.* | set -u10 %bt on | set %bm. [ $+ [ $nick ] ] 1 | goto noinc }
    set -u10 %bt on |  if %bt == on { inc %bm. [ $+ [ $nick ] ] 1 }
  :noinc | if (%bm. [ $+ [ $nick ] ] > 3) { kb # $nick Auto-ban - Mass ban overtreding | unset %bm* %bt | goto nombp } }
  :nombp | if $nick == $bnick { h } 

  ;User ban protection
  if (%ban.prot == on) {
    var %tmp 0 | :loop | inc %tmp | var %tmp2 = $read($sysdir $+ ini\prot50.inf,%tmp) 
    if (%tmp2) {
      if $gettok(%tmp2,1,44) == # {
        if $mtch($banmask,$gettok(%tmp2,2,44)) { mode $chan -bo $banmask $nick | kick $chan $nick Ban bescherming - Deze gebruiker bannen is niet toegestaan!
        }
      } 
      goto loop 
    } 
  } 
  :end
  if %bcs == on { inc %bc 1 | if %bcop == $null { set %bcop off }
    if %bcop == on { msg # Ban teller - Ban4 %bc sinds mijn binnenkomst op IRC om $+ %c.ip2 %logintime }
    if %bcop == off || %bcop == $null { set %bcop off | e $chan Ban teller - Ban4 %bc sinds uw binnenkomst op IRC om $+ %c.i2 %logintime }
  }
} 
on +@10!:JOIN:#: .onotice $chan $^warn 2 $+ $nick is genoteerd op de zwarte lijst en is niet welkom in deze kamer! | kb # $nick Auto-ban - Je staat op mijn zwarte lijst
on +@20!:JOIN:#: .onotice $chan $^warn 2 $+ $nick is genoteerd als een oneerlijke operator - User level 20: operator status geweigerd
on +@30!:JOIN:#: .onotice $chan $^warn 2 $+ $nick is genoteerd als een probleem maker - User level 30: Shut-up auto-kick
on +35!:JOIN:#:  { 
  e $chan Level 35 gebruiker $+ %c.i $nick is binnengekomen $+ %c.i2 $chan 
  mode $chan +v $nick 
  if (%lvl.msg != $true) { .notice $nick Welkom $nick $+ ! Je staat op mijn gebruikers lijst - level 35: Auto-voice } | set -u10 %lvl.msg $true
  h
}
on +40!:JOIN:#: { e $chan Level 40 gebruiker $+ %c.i $nick is binnengekomen $+ %c.i2 $chan
  if %auto.op == on || %auto.op == $null { if $me isop # || $me.op(#) { 
      set %auto.op on 
      mode $chan +o $nick 
    .notice $nick Welkom $nick $+ ! Je staat op mijn gebruikers lijst - level 40: Auto-medebeheerder | h } 
  }
  .notice $nick Welkom $nick $+ ! Je staat op mijn gebruikers lijst - level 40: Auto-op 4*Niet beschikbaar*
}
on +50!:JOIN:#: { _add # $fulladdress | e $chan Level 50 user $+ %c.i $nick is binnengekomen $+ %c.i2 $chan
  if %auto.op == on || %auto.op == $null { 
    if $me isop # || $me.op(#) { 
      set %auto.op on 
      mode $chan +o $nick 
      if (%lvl.msg != $true) { .notice $nick Welkom $nick $+ ! Je staat op mijn gebruikers lijst - level 50: Auto-op & bescherming } | set -u10 %lvl.msg $true
      h
    }
  }
  if (%lvl.msg != $true) { .notice $nick Welkom $nick $+ ! Je staat op mijn gebruikers lijst - level 50: Auto-op & bescherming 4*Niet beschikbaar* } | set -u10 %lvl.msg $true
}
on +50!:PART:#: _del # $fulladdress
on +51!:PART:#:  _del # $fulladdress | if $comchan($nick,0) < 1 { ruser 51 $address($nick,8) }
on +50!:QUIT: var %tmp2 = $nick | var %tmp = 0 | :loop | inc %tmp | if $comchan(%tmp2,%tmp) { _del $comchan(%tmp2,%tmp) $fulladdress | goto loop }
on +51!:QUIT: var %tmp2 = $nick | var %tmp = 0 | :loop | inc %tmp | if $comchan(%tmp2,%tmp) { _del $comchan(%tmp2,%tmp) $fulladdress | goto loop } | .ruser 51 $address($nick,8)
on +50!:NICK: {
  var %_1 = $fulladdress
  var %_2 = $reptok(%_1,$gettok(%_1,1,33),$newnick,1,33)
  .guser 51 $newnick 8 | var %tmp2 = $newnick | var %tmp = 0 | :loop | inc %tmp | if $comchan(%tmp2,%tmp) {  _del $comchan(%tmp2,%tmp) $fulladdress | _add $comchan(%tmp2,%tmp) %_2 | goto loop }
}
on +51:NICK: { 
  var %tmp1 = $fulladdress
  var %tmp2 = $reptok(%tmp1,$gettok(%tmp1,1,33),$nick,1,33)
  var %tmp3 = $reptok(%tmp1,$gettok(%tmp1,1,33),$newnick,1,33)
  var %tmp2b = $mask(%tmp2,8)
  var %tmp3b = $mask(%tmp3,8)
  ruser 51 %tmp2b
  if ($level(%tmp3b) != 50) { guser 51 $newnick 8 } 
  var %tmp4 = $newnick 
  var %tmp = 0 
  :loop
  inc %tmp 
  if ($comchan(%tmp4,%tmp)) { 
    _del $comchan(%tmp4,%tmp) %tmp2
    _add $comchan(%tmp4,%tmp) %tmp3
    goto loop
  }
}
alias _add write -a $sysdir $+ prot50.inf $1 $+ $chr(44) $+ $2
alias _del write -ds $+ $1 $+ $chr(44) $+ $2 $sysdir $+ prot50.inf 


on +55!:JOIN:#: { 
  e $chan Level 55 gebruiker $+ %c.i $nick is binnengekomen $+ %c.i2 $chan
  if %auto.op == on || %auto.op == $null { 
    if (%lvl.msg != $true) {   
      if ($me.own(#)) { set %auto.op on | mode $chan +q $nick 
      .notice $nick Welkom $nick $+ ! Je staat op mijn gebruikerslijst - level 55: Auto-owner | set -u10 %lvl.msg $true | h }
      if ($me isop #) { set %auto.op on | mode $chan +o $nick }
    }
  }
  .notice $nick Welkom $nick $+ ! Je staat op mijn gebruikerslijst - level 55: Auto-owner 4*Niet beschikbaar* $logo
  set -u10 %lvl.msg $true
}
on 70!:PART:#: .ruser 70 $nick 8 | a $^not Uw clone ( $+ %c.i $+ $nick $+ ) is vertrokken uit2 $chan 
on 70!:QUIT: .ruser 70 $nick 8 | a $^not Uw clone ( $+ %c.i $+ $nick $+ ) heeft IRC verlaten
on 100:HELP:#: { 
  if (%mehelp.t) { return }
  fx codes 
  set -u10 %mehelp.t $true 
  if $nick == $me { return }
  if %ant == on || %ant == $null { if ((nt isin $chan(#).mode) && (tn !isin $chan(#).mode)) { mode $chan +tn } }
  if ($chan != $active) { a $^not Je hebt op $+ %c.i2 # half-operator status gekregen van $+ %c.i $nick }
}
on 100:OP:#: { 
  if (($ircx) && (%ialref. [ $+ [ # ] ] == $null)) { set -u120 %ialref. [ $+ [ # ] ] $true | set %wj. [ $+ [ # ] ] $true | .who # }
  if (%meop.t) { return }
  fx codes 
  set -u10 %meop.t $true 
  if $nick == $me { return }
  if %ant == on || %ant == $null { if ((nt isin $chan(#).mode) && (tn !isin $chan(#).mode)) { mode $chan +tn } }
  if ($chan != $active) { a $^not Je hebt op $+ %c.i2 # operator status gekregen van $+ %c.i $nick }
}
on 100:OWNER:#: { 
  if (($ircx) && (%ialref. [ $+ [ # ] ] == $null)) { set -u60 %ialref. [ $+ [ # ] ] $true | set %wj. [ $+ [ # ] ] $true | .who # }
  if (%meow.t) { return }
  fx codes
  set -u10 %meow.t $true
  if $nick == $me { return } 
  if %ant == on || %ant == $null { if ((nt isin $chan(#).mode) && (tn !isin $chan(#).mode)) { mode $chan +tn } }
  if ($chan != $active) { a $^not Je hebt op $+ %c.i2 # ownership gekregen van $+ %c.i $nick }
}

on @!*:OWNER:#: { 
  if ($level($address($opnick,8)) == 20) { ^cc $nick | mode # -o $opnick | .onotice # $^warn $opnick is aangewezen als een onwaardige operator - gaarne dit persoon geen owner geven! | return }
  if (%o.b == on) && ($opnick != $nick) && ($opnick != $me) { raw -q mode $chan -q $opnick | .onotice # Op barrier - Gaarne niet meer personen ops/owner geven op dit kanaal - dit leidt tot instabiliteit }
}

on @!*:OP:#: { 
  if ($level($address($opnick,8)) == 20) { ^cc $nick | mode # -o $opnick | .onotice # $^warn $opnick is aangewezen als een onwaardige operator - gaarne dit persoon geen ops geven! | return }
  if (%o.b == on) && ($opnick != $nick) { raw -q mode $chan -o $opnick | .onotice # Op barrier - Gaarne niet meer personen ops/owner geven op dit kanaal - dit leidt tot instabiliteit }
} 

on +!@20:OP:#: ^cc $nick | mode # -o $opnick | .onotice $chan $^not Gebruiker staat bekend als een bedrieger - ops geweigerd $logo
on 100:DEOP:#: if %medop.t == on { h } | set -u10 %medop.t on | fx functions | if $active != $chan { a $^alr %c.i $+ $nick heeft in $+ %c.i2 $chan uw operator status weggenomen. } 
on 100:DEHELP:#: if %medhop.t == on { h } | set -u10 %medhop.t on | fx functions | if $active != $chan { a $^alr %c.i $+ $nick heeft in $+ %c.i2 $chan je half-operator status weggenomen. } 
on 100:DEOWNER:#: if %medown.t == on { h } | set -u10 %medown.t on | fx functions | if $active != $chan { a $^alr %c.i $+ $nick heeft in $+ %c.i2 $chan je ownership weggenomen. } 


on 100:KICK:#: fx warning! | if $active != $chan { a $^alr U bent uit %c.i2 $+ # gekickt door $+ %c.i $nick $+ ! }
on 100:BAN:#: { fx warning! | if ($chan == $active) { s $^alr U bent uit %c.i2 $+ # verbannen door $+ %c.i $nick $+ ! }
  else { fx warning! | a $^alr U bent verbannen in $+ %c.i2 $chan door $+ %c.i $nick , banmask: $+ %c.i $banmask }
}

ON @*:UNBAN:#: if (%ub.b == on) { ^cc $nick | if $nick == $me { h } | mode # +b $banmask | msg $chan Unban blokkade - verwijderen van gebande adressen niet toegestaan }
