; BorgIRC - misc.mrc

alias space return  
on ^*:MODE:#: e -c $+ $colour(mode) # $nick sets mode: $1- | hdef
on ^*:PING: h
on ME:*:PART:#: unset %topic. [ $+ [ $chan ] ]
on *:DISCONNECT: { 
  unset %ircop. [ $+ [ $cid ] ] | if ($scon(0) == 1) { %connect = $false }
  .ruser 100 $me
  unset %ircx. [ $+ [ $netw ] ] | unset %topic.* %tb.txt | tbar | if %tst == $null { set %tst off | .timestamp off } | set %lvt. [ $+ [ $netw ] ] %logintime | set %lvd. [ $+ [ $netw ] ] %lnd | set %ls $iif(Chatcity !isin $netw,$server,www.chatcity.nl) | unset %dpm.* %km.* %bm.* %mosm.* %ifc.* %mc.* %nfc.* %tmp %temp %oc.msg | s Druk op Ctrl+F5 om te verbinden met de laatst bezochte server: $+ %c.i2 %ls | if %oldnick. [ $+ [ $cid ] ] { nick %oldnick. [ $+ [ $cid ] ] } | fx shuddwn | .rlevel -r 70 | unset %kc %bc %logintime
}
on *:EXIT: .rlevel -r 100
ON ^*:OPEN:?: { 
  if (%priv) { priv -n $1- | close -m $nick | hdef | return }
  inc -u8 %qwin 
  if (%qwin > 8) { fx security | s $_(bc176) | .ignore -pu60 $wildsite $nick }
  fx incoming | if (($away) && (%al == on) && ($window(@AwaySystem))) { h } 
  if ((%th == on) && (%th.ft == on)) { .timerwaitfont 1 0.5 font $nick %ft } 
  .timerbkg 1 2 bkg $nick
}
ON @*:topic:*: {
  inc -u15 %fld.topic. [ $+ [ # ] ]
  if (%fld.topic. [ $+ [ # ] ] > 5) { hdef | h }

  if (%topic. [ $+ [ # ] ] == $null) { set %topic. [ $+ [ # ] ] $chan(#).topic | return }
  if (%tl == on) { 
    if ($nick == $me) { set %topic. [ $+ [ # ] ] $chan(#).topic | return }
    if ($chan(#).topic != %topic. [ $+ [ $chan ] ]) { 
      a $^not $_(bc177)
      topic # %topic. [ $+ [ # ] ] 
    .notice $chan $^not $_(bc178) } 
    :end 
  } 
  else { %topic. [ $+ [ # ] ] = $chan(#).topic }
}
ON *:QUIT: if ($query($nick)) && (%quitmsg. [ $+ [ $nick ] ] == $null) { set -u60 %quitmsg. [ $+ [ $nick ] ] $true | e $nick $^not %c.i2 $+ $nick heeft IRC verlaten }

alias clc if $1 == $null { s $_(bc179) | h } | if $1 == -m { var %tmp = 0 | while ($chan(%tmp)) { inc %tmp | var %tc = $encode($chan(%tmp),m) | clc1 %tc } | return } 
alias clc1 var %in = $decode($1,m) | var %tmp0 = 0 | while (%tmp0 < $nick(%in,0)) { inc %tmp0 | clc2 $1 $nick(%in,%tmp0) }
alias clc2 { 
  var %in = $decode($1,m)
  if ($me ison %in) {
    cline $colour(listbox text) %in $2
    if $2 isop %in && $2 != $me { cline %c.co %in $2 }
    if ($address($2,2)) {
      if $level($2) < 40 && $level($2) > 1 { cline %c.cn %in $2 }
      if $level($2) > 30 && $level($2) < 60 { cline %c.cp %in $2 }
      if $level($address($2,8)) == 60 { cline %c.cr %in $2 }
      if $address($2,2) == $address($me,2) && $2 != $me { cline %c.cc %in $2 } 
    }
    cline %c.cm %in $me
  }
}

alias cinf { 
  var %in = $decode($1,m)
  set %topic. [ $+ [ %in ] ] $chan(%in).topic 
  cc %in
  if %ant == $null { set %ant on } 
  if ($me isop %in) && (%ant == on) { if t !isin $chan(%in).mode && n !isin $chan(%in).mode { mode %in +tn | goto end }
  if n !isin $chan(%in).mode { mode %in +n } | if t !isin $chan(%in).mode { mode %in +t } | :end }
}


alias chkthm var %in = $decode($1,m) | if $me !isop %in { clc1 $1 }
alias stp var %in = $decode($1,m) | %topic. [ $+ [ %in ] ] = $chan(%in).topic
alias chkircx { 
  var %in = $decode($1,m) 
  if ($me isop %in || $me isowner %in) { 
    if (($ircx) && (%ialref. [ $+ [ %in ] ] == $null)) { 
      set -u60 %ialref. [ $+ [ %in ] ] $true 
      set %wj. [ $+ [ %in ] ] $true 
      .who %in 
    }
  }
}
alias gpf .notice # Greetings - $1- | e -c $+ $colour(join) # $_(bc180) $1- | if %chance > 4 && %chance != 9 && %chance != 6 { fx logoff | h } 

on ME:^*:JOIN:#: {
  var %c = $encode(#,m)
  unset %ialref. [ $+ [ # ] ]
  if ((%th == on) && (%th.ft == on)) { font # %ft }
  if (!$ircx) { set %wj. [ $+ [ # ] ] $true | .who # }
  .timercinf. $+ # 1 2 cinf %c
  .timerbkg. $+ # 1 2 bkg -c %c
  .timerircx. $+ # 1 2 chkircx %c
  .timertpc. $+ # 1 2 stp %c
  .timerchkthm $+ # 1 30 chkthm %c
  if $getcfg.core(grmain) { 
    if ($getcfg.core(grmode) == 1) { var %tmp = $getcfg.core(grcust) | if (%tmp == $null) { cfgoff grmain | fx logoff | h } | goto $getcfg.core(grskin) 
      :Plain | var %line = %tmp | goto doit
      :Classic | var %line = 12<Groeten12> %tmp | goto doit | :Rozen | var %line = 03-->--04@12 %tmp 04@03--<-- | goto doit
      :Angels | var %line = 8,1~Å~0 %tmp 8,1~Å~0 | goto doit | :Borg | var %line = 9,1<Gr3,1oete9,1n>15,1 %tmp $+  | goto doit
      :Spacy | var %line = 11,1\12\2\0,1 %tmp 2/12/11/ | goto doit | :doit | .notice # %line | e -c $+ $colour(join) # $_(bc180) $remove(%line,$logo)
      fx logoff | h
    }
    if ($getcfg.core(grmode) == 2) { goto $r(1,9)
      :1 | gpf I am Locutus of Borg, resistance is futile. Your life as it has been is over. From this time forward you will service us. | sp locutus | h 
      :2 | gpf We are the Borg. You will be assimilated, resistance is futile! | sp voyborg2 | h 
      :3 | gpf We are the Borg. Existence as you know it is over. We will add your biological and technological distinctiveness to our own. | sp voyborg1 | h
      :4 | gpf We are the Borg. Lower your shields and surrender your ships. We will add your biological and technological distinctiveness to your own. Your culture will adapt to service us. Resistance is futile. | sp weborg | h 
      :5 | gpf You will all become one with the Borg | fx logoff | h | :6 | gpf Freedom is irrelevant. Self-determination is irrelevant, you must comply | sp freedom | h | :7 | gpf Incorrect strategy... number one | fx logoff | h
    :8 | gpf $chan $+ , grid 19 subjunction 12, you will be assimilated | fx logoff | h | :9 | gpf Our survival is your survival | sp survival | h }
  }
  else { fx logoff -n | hdef }
}
on *:DNS: { 
  if (%alt.dns == on) { unset %alt.dns | var %tmp = ma } | else { var %tmp = $_a } | if ($iaddress == $null) { fx comply | %tmp $^err $_(bc181) }
  if ($raddress == $null) && ($iaddress) { fx scancomp | %tmp 12Dns scan - $+ %c.ip $nick  $+ $_(bc182,$iaddress) | %tmp $^err $_(bc183) | h }
  if ($raddress) && ($iaddress == $null) { fx scancomp | %tmp 12Dns scan - $+ %c.ip $nick  $+ $_(bc184,$raddress) | h }
  if ($iaddress) && ($raddress) { %tmp 12Dns scan - $+ %c.ip $nick  $+ $_(bc185,$raddress,$address) | fx scancomp | h }
}
ON ^*:INVITE:#: if ($level($address($nick,8)) < 50) { if %ift == $null { unset %ifc.* | set -u10 %ift on | set %ifc. [ $+ [ $site ] ] 1 | goto noinc } | set -u10 %ift on | if %ift == on { inc [ %ifc. [ $+ [ $site ] ] ] 1 } | :noinc | if ([ %ifc. [ $+ [ $site ] ] ] > 3) { unset %ifc.* | unset %ift | fx security | a 4 Flood: Uitnodigings flood gedetecteerd van $+ %c.i2 $nick $+ / $+ $site - genegeerd | ignore -piu120 $wildsite | h } } | fx voycom | a %c.i3 $+ Uitnodiging - U bent uitgenodigd naar $+ %c.i2 $chan door $+ %c.i $nick $+ / $+ $site | h
ON *:NICK: {
  var %lvl = $level($address($newnick,8))
  if ($nick == $me) { 
    .ruser 100 $nick | .auser 100 $newnick 
    if ($dialog(cn.nickserv)) { did -ra cn.nickserv 10 Ik wil mijn huidige nickname ( $+ $newnick $+ ) reserveren }
    return
  }
  if ((%lvl > 35) && (%auto.op == on)) { 
    var %tmp = 0
    while (%tmp < $comchan($newnick,%tmp)) {
      inc %tmp
      var %mchange = + $+ $iif(%lvl == 35,v) $+ $iif(%lvl == 50,o) $+ $iif(%lvl == 55 && $ircx,q) $iif(%lvl == 55 && $ircx == $false,o)
      var %c = $comchan($newnick,%tmp)
      if ($newnick isreg %c) { 
        if (($me.own(%c)) || ($me.op(%c))) { mode %c %mchange $newnick }
      }
    }
  } 
  if ($nick == $null) { h } 
  if %o.ak == on && %ak == on { chknick } 
  return
  :cn 
}
on ^*:WALLOPS:*Remote CONNECT*: a $^not $_(bc188,$5) | h
on ^*:WALLOPS:*Received SQUIT*: a $^not $_(bc189,$5) | h

on ^*:SNOTICE:*: {
  var %w = @ $+ $netw
  if (%ded.snotice) {
    if (!$window(%w)) { window -ank0 %w }
    echo %w $timestamp $1-
    window -g1 %w 
    if (%ded.snotice.to) { .timerclose_snotices $+ $netw 1 %ded.snotice.to cw @ $+ $netw }
    hdef
  }
  if (*Net Junction* iswm $1-) { a $^not $_(bc188,$5) | h }
  if (*Net break* iswm $1-) { a $^not $_(bc189,$5) | h }
  if (*did a /whois on you* iswm $1-) { fx schqbeep | a $^not $2 $3 heeft je /whois informatie opgevraagd | h }

}

alias cw if ($window($1)) { window -c $1 }

;alias perc return $round($calc(100 - ($1 / $2) * 100),1) $+ %
;alias perc1 return $round($calc(100 - ($1 / $2) * 100),1)

alias perc return $calc(($1 / $2) * 100) $+ %
alias perc1 return $calc(($1 / $2) * 100)


on ^*:ACTION:*:#: {
  var %1 = $1- | var %2 = $strip($1-)
  if (%filters) {
    if (%filter.mp3play) { 
      if (%filter.mynick) { if ($me isin %2) { goto endfilt } }
      var %tmp = *[MP3]* | if (%tmp iswm %2) { unset %1 }
      var %tmp = * $+ $chr(124) $+ MP3 $+ $chr(124) $+ *.mp3* | if (%tmp iswm %2) { unset %1 }
      if (*media*kbps* iswm %2) { unset %1 }
      var %tmp = *(MP3)*.mp3* | if (%tmp iswm %2) { unset %1 }
      if (*==>*mp3* iswm %2) { unset %1 }
      if (mIRCleSound*.mp3* iswm %2) { unset %1 }
      if (*hinkelirc*MP3* iswm %2) { unset %1 }
      if (WiSHIRC-Mp3 isin %2) { unset %1 }
      if (*.mp3*-=RFU ScripT=-* iswm %2) { unset %1 }
      if (Mp³ isin %2) { unset %1 }
      if (is playing isin %2) { unset %1 }
      if (is listening to isin %2) || (luistert naar isin %2) { unset %1 }
      if (Mp3 (Selected) isin %2) { unset %1 }
      if (*DiMp3* iswm %2) { unset %1 }
      if (jjjjj Mp3 jjjjj isin %2) { unset %1 }
      if (14p15laying: isin %1) { unset %1 }
      if (Mp3 MaCHiNe Playz isin %2) { unset %1 }
      if (Selected/Playing isin %2) { unset %1 }
      if (*MillenniumSE*MB* iswm %2) { unset %1 }
      if (*MillenniumSE*KB* iswm %2) { unset %1 }
      if (QuickStyleMp3 isin %2) { unset %1 }
      if (Draait nu isin %2) { unset %1 }
      if (mp3n Jukebox isin %2) { unset %1 }
      :endfilt
    }
  }
  if (%1) { 
    if (%1 != $1-) {
      if (%filter.log) && ($isdir($nofile(%filter.log.file))) { 
        if (%flog.ctrl. [ $+ [ $remove($1-,$chr(32)) ] ] != $true) {
          set -u10 %flog.ctrl. [ $+ [ $remove($1-,$chr(32)) ] ] $true
          write -a %filter.log.file $flogt Filtered: < $+ $nick $+ > %1 
        }
      }
      echo $colour(action) -l # $iif(%tst == on,$timestamp) * $nick(#,$nick).pnick %1 
      hdef
    }
  }
  else { 
    if (%filter.log) && ($isdir($nofile(%filter.log.file))) { 
      if (%flog.ctrl. [ $+ [ $remove($1-,$chr(32)) ] ] != $true) {
        set -u10 %flog.ctrl. [ $+ [ $remove($1-,$chr(32)) ] ] $true
        write -a %filter.log.file $flogt Blocked:  $+ $color(action) $+ * $nick $1-
      }
    }
    hdef
  }
}

on ^*:TEXT:*:#: { 
  var %1 = $rawtxt | var %2 = $strip(%1)

  if (%filters) {
    if (%filter.format) { 
      var %tmp = $left($1-,7) | var %c1 = $count(%tmp,$chr(3)) | var %b1 = $count(%tmp,$chr(2)) 
      var %c2 = $count(%1,$chr(3)) | var %b2 = $count(%1,$chr(2)) 
      if (%c1 == 1) && (%c2 == %c1) { var %1 = $strip(%1,c) } | if (%b1 == 1) && (%b2 == %b1) { var %1 = $strip(%1,b) } 
    }
    if (%filter.comic) {
      if #G isin $1 { var %1 = $gettok(%1,2-,32) } 
      if $eval(# Appears as*.,0) iswm $1- { unset %1 }
    }
    if (%filter.mp3play) { 
      if (%filter.mynick) { if ($me isin %2) { goto endfilt } }
      var %tmp = *[MP3]* | if (%tmp iswm %2) { unset %1 }
      var %tmp = * $+ $chr(124) $+ MP3 $+ $chr(124) $+ *.mp3* | if (%tmp iswm %2) { unset %1 }
      if (*(BorgIRC)*[MP3]* iswm %2) { unset %1 }
      if ($eval(4(BorgIRC12),0) isin %2 && .mp3 isin %2) { unset %1 }
      if (*media*kbps* iswm %2) { unset %1 }
      var %tmp = *(MP3)*.mp3* | if (%tmp iswm %2) { unset %1 }
      if (*==>*mp3* iswm %2) { unset %1 }
      if (mIRCleSound*.mp3* iswm %2) { unset %1 }
      if (*hinkelirc*MP3* iswm %2) { unset %1 }
      if (WiSHIRC-Mp3 isin %2) { unset %1 }
      if (Mp³ isin %2) { unset %1 }
      if (NoW PlaYinG*.mp3* iswm %2) { unset %1 }
      if (Ik speel nu:*.mp3* iswm %2) { unset %1 }
      if ($eval(mp3 [,0) isin %2) { unset %1 }
      if (.mp3 isin %2) && (t×PLåY6.0 isin %2) { unset %1 }
      if (*DiMp3* iswm %2) || (*ÐîMÞ3* iswm %2) { unset %1 }
      if (QuickStyleMp3 isin %2) { unset %1 }
      if (14p15laying: isin %1) { unset %1 }
      if (I'm listening to isin %1) || (To get it type isin %1) { unset %1 }
      if (is playing isin %2) || (Now Playing: isin %2) { unset %1 }
      if (WinampStatus isin %2) { unset %1 }
      if (uNDeRTaKeRMP3 isin %2) { unset %1 }
      if (*playing:*Mb* iswm %2) { unset %1 }
      if (*-mp3-*mb* iswm %2) { unset %1 }
      if (*MillenniumSE*khz* iswm %2) { unset %1 }
      if (*MillenniumSE*KB* iswm %2) { unset %1 }
      if (*MillenniumSE*MB* iswm %2) { unset %1 }
      if (»¡«Scøøp MP3»!« isin %2) { unset %1 }
      if (*.mp3 is now playing* iswm %2) { unset %1 }
      if (*@HomeIRC Mp3* iswm %2) { unset %1 }
      if (mp3 Server Online isin %2) { unset %1 }
      if (.:mp3:. isin %2) { unset %1 }
      var %tmp = *Revolution*Player* | if (%tmp iswm %2) { unset %1 }
      if (MSE Jukebox isin %2) { unset %1 }
      if (RingIrc: MP3] isin %2) || (*RingIRC*JukeBoX* iswm %2) { unset %1 }
      if (Media: MP3 isin %2) { unset %1 }
      if (*Mp3*Player*Ik*Draai*Nummer* iswm %2) { unset %1 }
      if (*Mp3systeM*kbps* iswm %2) { unset %1 }
      if (*::..MP3..::.* iswm %2) { unset %1 }
      if (*PolderIRC*MP3* iswm %2) { unset %1 }
      if (*Danst Met De Muizen Op* iswm %2) { unset %1 }
      if (*JuKeBoX* iswm %2) { unset %1 }
      if (*Irriteert de buren met $chr(60) $+ * iswm %2) { unset %1 }
      if (*mp3*kbps* iswm %2) { unset %1 } 
      :endfilt
      if (DRaaiT isincs %2) { unset %1 }
      if (Mystic Script Mp3player isin %2) { unset %1 }
    }
    if (%filter.nchat) && ($1- == Type hier en druk op 'Enter' om te zenden.) { unset %1 }
    if (%1) { 
      if (%1 != $rawtxt) { 
        if (%filter.log) && ($isdir($nofile(%filter.log.file))) { 
          if (%flog.ctrl. [ $+ [ $remove($1-,$chr(32)) ] ] != $true) {
            set -u10 %flog.ctrl. [ $+ [ $remove($1-,$chr(32)) ] ] $true
            write -a %filter.log.file $flogt Filtered: < $+ $nick $+ > %1 
          }
        }
        echo -l # $iif(%tst == on,$timestamp) < $+ $nick(#,$nick).pnick $+ > %1 
        window -g $+ $iif($me isin %1,2,1) #
        hdef
      }
    }
    else { 
      if (%filter.log) && ($isdir($nofile(%filter.log.file))) {
        if (%flog.ctrl. [ $+ [ $remove($1-,$chr(32)) ] ] != $true) {
          set -u10 %flog.ctrl. [ $+ [ $remove($1-,$chr(32)) ] ] $true
          write -a %filter.log.file $flogt Blocked: < $+ $nick $+ > $1- 
        }
      }
      hdef
    }
  }
  if (%nick.caller) && ($active != @AwaySystem) && ($me isin %2) && ($active != #) { a $^not $_(bc190) | $iif(%nick.caller.beep,splay $fxdir $+ voycom.wav) }
  if ($level($address($nick,8)) == 30) && ($me isop $chan) { 
    if (%shutup. [ $+ [ $site ] ]) { unset %shutup. [ $+ [ $site ] ] | deop $nick | ban -u180 # $nick 2 | kick # $nick $_(bc191) | goto end2 }
    else { set -u30 %shutup. [ $+ [ $site ] ] $true | kick # $nick $_(bc193) | goto end2 }
  }
  if (!stem isin $1-) && (%vp == on) { 
    if $2 == ja { if (%v.n [ $+ [ $site ] ]) { .notice $nick $_(bc194) | goto end2 } 
      set %v.n [ $+ [ $site ] ] ja | inc %v.ja 1 | if (%v.nee == $null) { %v.nee = 0 }
      set %v.tot $calc(%v.ja + %v.nee) 
      set %v.ja.p $calc((%v.ja / %v.tot) * 100) 
      set %v.nee.p $calc((%v.nee / %v.tot) * 100)
      if %v.ja.p == $null { set %v.ja.p 0 } 
      if %v.nee.p == $null { s set %v.nee.p 0 }
      aline @VotingPoll $_(bc195)
      goto end2 
    }
    if $2 == nee { if (%v.n [ $+ [ $site ] ]) { .notice $nick $_(bc194) | goto end2 } 
      set %v.nee [ $+ [ $site ] ] nee | inc %v.nee 1 | if (%v.ja == $null) { %v.ja = 0 }
      set %v.tot $calc(%v.ja + %v.nee) 
      set %v.ja.p $calc((%v.ja / %v.tot) * 100) 
      set %v.nee.p $calc((%v.nee / %v.tot) * 100)
      if %v.ja.p == $null { set %v.ja.p 0 } 
      if %v.nee.p == $null { set %v.nee.p 0 }
      aline @VotingPoll $_(bc195)
      goto end2 
    }
  }
  if (%fs) { 
    if ($strip($1) == %fs.tr) { 
      fs.chk
      if ($fserv($nick)) { .notice $nick $_(bc196) | return }
      var %tmp = $txtdir $+ motd.txt 
      if ($exists(%tmp) == $false) { 
        a $^err $_(bc197,%tmp)
        .notice $nick $_(bc198)
        return 
      }
      var %tmp0 = $iif(%fs.maxdccuser,%fs.maxdccuser.v,99)
      if (%tmp0 != 99) { .notice $nick $_(bc199,%tmp0) 
        if (%fs.sharechan) { .notice $nick $_(bc200) }
      }
      .fs.chk.folder -n
      fserve $nick %tmp0 %fs.dir %tmp
    }
  }
  if (($away) && (%oldnick. [ $+ [ $cid ] ] isin $1- || $me isin $1-)) { 
    if %as.c != on || %as == off { 
      if (!%awaymsg. [ $+ [ # ] ]) { 
        set -u500 %awaymsg. [ $+ [ # ] ] $true
        var %tmp = $atime 
        des # is afwezig $fm2($awaymsg) $fm1(%tmp)
      }
      fx voycom | e @AwaySystem $_(bc201,$1-)
    }
  }
  :end2 | if ($1 == $chr(33) $+ $me) { set -u20 %sreq. [ $+ [ $nick ] ] $2 } 
}

alias flogt {
  if (%filter.log.warn != $true) {
    if ($bytes($file(%filter.log.file).size,m) > 10) { %filter.log.warn = $true | a $^warn Uw auto-filter log bedraagt nu 10 mb. Deze zal automatisch opgeschoont worden wanneer deze 20 heeft bereikt. } 
  }
  if ($bytes($file(%filter.log.file).size,m) > 20) { %filter.log.warn = $false | a $^not Uw auto-filter log is groter geworden dan 20 mb. Deze is nu automatisch opgeschoont. | .remove %filter.log.file }
  return $chr(91) $+ $asctime(dd-mm-yy HH:nn:ss) $+ $chr(93)
}

alias l return  $+ $chr(124) $+ 

on ^*:ACTION:*:?: { 
  inc %~query 
  priv -a $1-
  if (%PM.sd == on) { h }
  if $level($address($nick,8)) < 50 { if %mft == $null { unset %mc.* | set -u10 %mft on | set %mc. [ $+ [ $site ] ] 1 | goto noinc }
    set -u10 %mft on | if %mft == on { inc [ %mc. [ $+ [ $site ] ] ] 1 }
    :noinc | if ([ %mc. [ $+ [ $site ] ] ] == 15) && ($away) { unset %mc.* %mft | fx security || e @AwaySystem $^warn $_(bc209)
      .notice $nick $_(bc210)
      .ignore -pu120 $wildsite $nick | goto end2
    }
    if ([ %mc. [ $+ [ $site ] ] ] == 50) && (!$away) { 
      unset %mc.* 
      unset %mft | fx security 
      a $^warn $_(bc209)
      .notice $nick $_(bc210)
      .ignore -pu120 $wildsite $nick
      goto end2 
    }
  }
  :end | if ($away) { if %al == on { write $shortfn($logdir) $+ awaylog.txt ( $+ $date $time $+ ) - $nick $+ ( $+ $site $+ ) $1- }
    if %as.c != on || %as == off { 
    if (%awaymsg. [ $+ [ $site ] ] == $null) { set -u360 %awaymsg. [ $+ [ $site ] ] $true | var %tmp = $atime | des $nick $_(bc217) } }
    if $window(@AwaySystem) { fx voycom | e @AwaySystem $_(bc218,$1-) | goto end2 } 
  } 
  :end2
}

alias priv {
  if ($1 == $null) { return }

  if ((%priv) && (!$away)) { 
    if (%privmsg. [ $+ [ $site ] ] == $null) { 
      fx voycom 
      set -u360 %privmsg. [ $+ [ $site ] ] $true 
      s $_(bc211) | .des $nick $_(bc212)
    } 
    if ($window(@FluisterBlock) == $null) { 
      window -e @FluisterBlock
      e @FluisterBlock $fm1(Fluister block)
      e @FluisterBlock Personen die u in uw privé iets zeggen, zullen de melding krijgen dat u op dit moment geen berichten accepteert.
      e @FluisterBlock Deze optie kunt u weer uitschakelen in het menu BorgIRC > Extra instellingen > Fluister block > Uit.
      linesep @FluisterBlock
    } 
    if ($1 == -n) { e @FluisterBlock $_(bc213,$2-) }
    if ($1 == -a) { e @FluisterBlock $_(bc213b,$2-) }

    h 
  }
}

on ^*:TEXT:*:?: { 
  inc %~query 
  if %PM.sd == on { h }
  if ($level($address($nick,8)) < 50) && (%msg.prot == on) { 
    if (%mft == $null) { unset %mc.* | set -u10 %mft on | set %mc. [ $+ [ $site ] ] 1 | goto noinc }
    set -u10 %mft on 
    if (%mft == on) { inc %mc. [ $+ [ $site ] ] }
    :noinc 
    if (%mc. [ $+ [ $site ] ] == 20) && $away { 
      unset %mc.* %mft | fx security 
      e @AwaySystem $^warn $_(bc214)
      .notice $nick $_(bc210) | .ignore -pu120 $wildsite $nick | goto end2 
    }
    if (%mc. [ $+ [ $site ] ] == 10) && !$away { 
      unset %mc.* %mft | fx security | a $^warn $_(bc214) | .notice $nick $_(bc210) | .ignore -pu120 $wildsite $nick | goto end2 
    } 
  }
  :end
  if (Wanna be an OPERATOR in isin $1-) { fx security | a $^warn BorgIRC heeft een kwaadwillende boodschap van $nick geblokkeerd. | a $^warn %c.i2 $+ $nick is geinfecteerd met een virus. Laat hem/haar de volgende regel uitvoeren: 4 $+ $eval(//unload -rs $chr(160) $+ . $+ $chr(160),0) $chr(124) /timers off | h }

  if ($away) {
    if %al == on { write $shortfn($logdir) $+ awaylog.txt ( $+ $date $time $+ ) - $nick $+ ( $+ $site $+ ) $1- }
    if ((%as.c != on) || (%as == off)) { 
      if (!%awaymsg. [ $+ [ $site ] ]) { 
        set -u360 %awaymsg. [ $+ [ $site ] ] $true 
        var %tmp = $atime 
        des $nick $_(bc217,%tmp)
      }
    }
    if $window(@AwaySystem) {
    fx voycom | e @AwaySystem $_(bc218,$1-) | goto end2 }
  } 
  :end2 
  if ($1 == $chr(33) $+ $me) { set -u20 %sreq. [ $+ [ $nick ] ] $2 }
}

menu @FluisterBlock {
  $_(p072)
  .$iif(%priv,$style(1)) $_(BOn): on | %priv = $true
  .$iif(%priv == $false,$style(1)) $_(BOff): off | %priv = $false
}

on ^*:NOTICE:*:#: { 
  inc %~notice | if %N.sd == on { h }
  if (%filter.greet) && (%flt. [ $+ [ $nick ] ]) { 
    if ((Greetings isincs $1-) || (Groeten isincs $1-)) { hdef } 
  }
  if %nt.prot == on {
    if $level($address($nick,8)) < 50 { if %nft == $null { unset %nfc.* | set -u10 %nft on | set %nfc. [ $+ [ $site ] ] 1 | goto noinc }
      set -u10 %nft on | if %nft == on { inc %nfc. [ $+ [ $site ] ] 1 }
      :noinc | if (%nfc. [ $+ [ $site ] ] > 6) { unset %nfc.* %nft | fx security | a $^warn $_(bc215) | ignore -pnu120 $wildsite | h }
    }
  }
}

on ^*:NOTICE:*:?: { 
  if %N.sd == on { h }
  if %nt.prot == on {
    if ((Chatvalley isin $server && $nick == Q) || (Dalnet isin $netw && $nick == ChanServ) || (ChatNetwerk isin $netw && ($nick == ChanServ || $nick == BotServ || $nick == HostServ || $nick == OperServ || $nick == MemoServ || $nick == HelpServ || $nick == Robo-Op || $nick == NickServ))) { goto endprot }
    if $level($address($nick,8)) < 50 { 
      if %nft == $null { 
        unset %nfc.* 
        set -u10 %nft on 
        set %nfc. [ $+ [ $site ] ] 1 
        goto noinc
      }
      set -u10 %nft on 
      if %nft == on { 
        inc %nfc. [ $+ [ $site ] ] 1
      }
      :noinc 
      if ([ %nfc. [ $+ [ $site ] ] ] > 6) { 
        unset %nfc.* %nft 
        fx security 
      a $^warn $_(bc215) | ignore -pnu120 $wildsite | h }
    }
  }
  :endprot
  if ($away) { if ((%as.c != on) || (%as == off) && (DCCSEND !isin $1-) && (%awaymsg. [ $+ [ $site ] ] == $null)) { set -u500 %awaymsg. [ $+ [ $site ] ] $true | var %tmp = $atime | .notice $nick $_(bc216,%tmp) }
    if $window(@AwaySystem) { if (dccsend !isin $1-) { fx voycom } | e @AwaySystem $_(bc218,$1-) | h 
    }
  }
}

on !*:JOIN:#: {  
  if (%filter.greet) { set -u30 %flt. [ $+ [ $nick ] ] $true }
  if %th == on && %th.cl == on { 
    .timerjoin. $+ $nick $+ . $+ $encode(#,m) 1 1 clc2 $encode(#,m) $nick
  }
  if (%woj == on) { set %~j. [ $+ [ $nick ] ] # | whois $nick }
  if (undernet isin $netw) && (($nick == W) || ($nick == X)) { set %ubot $nick }
  if ((%o.ak == on) && ($me isop $chan)) { chknick }
  if %cdt == on { if $clone($nick,$chan) == $null { goto end }
    if %cdt == $null || %cdt == off { set %cdt off || goto endclone }
    if $address($nick,2) iswm $address($me,2) { a $^not $_(bc219)
      if (%ownclone == on) && ($me isop $chan) { 
        if $level($address($nick,8)) != 60 { .guser 70 $nick 8 } 
        a $^not $_(bc220)
        if (%oc.msg != $true) { .notice $nick $_(bc221) }
        set -u15 %oc.msg $true
        if $me.own(#) { mode # +q $nick | goto end }
        if $me isop # { mode # +o $nick | goto end } 
      }
    }
    if xxx isin $gettok($wildsite,2,64) { goto end } | e # Clones: $+ %c.ip2  $clone($nick,$chan) from $+ %c.ip2 $wildsite | fx clones | :end
  } 
}

menu @Pictures {
  Laat plaatje zien: {
    var %tmp = $shortfn($sfile($ascdir $+ \*.txt,$_(bc222),OK))
    if $istok(.jpg jpeg .gif .bmp .pcx .mpg mpeg,$right(%tmp,4),32) { fx comply | a $^err $_(bc223) | h } 
    .loadbuf @Pictures %tmp
  }
  -
  Leegmaken: clear @Pictures
}
menu @AwaySystem {
  $iif($away == $false,Set away): awayon
  $iif($away,Set back): awayoff
  -
  Clear window: clear @Awaysystem
}

; Theme events


on *:op:#: if %th == on && %th.cl == on { .timerthdeop $+ $nick 1 1 clc2 $encode(#,m) $opnick }
on *:owner:#: if %th == on && %th.cl == on { .timerthdeop $+ $nick 1 1 clc2 $encode(#,m) $opnick }
on *:deop:#: if %th == on && %th.cl == on { .timerthdeop $+ $nick 1 1 clc2 $encode(#,m) $opnick }


; Abandoned help system (c) 1998 

alias hlp {
  if ($1) { goto pars } | vh ref | h | :pars
  if ($istok(cctrl cscan disp sndsys pict away msgs intro malic gsettings grsettings psettings,$1,32)) { vh $1 }
  fx comply | a $^err $_(bc224,$1-)
}
alias vh set %1 $1 | dl.open hlp | h

dialog hlp {
  title "BorgIRC On-line help"
  size -1 -1 520 335
  icon $bico
  button "&Sluiten",99,400 300 100 25,ok default
  radio "<< Vorige ",1,10 300 100 25,left push disable
  radio "Volgende >>",2,110 300 100 25,left push disable
  edit "",3,10 10 500 275,left read multi pass autohs autovs hsbar vsbar
}

on *:dialog:hlp:init:0: .loadbuf -ot $+ %1 hlp 3 $txtdir $+ help.txt | unset %1

menu @Help {
  Introductie: hlp intro
  Whatsnew: a De vernieuwingen van het script zijn contenu bijgehouden in het bestand Whatsnew.doc
  Website: a Bezoek voor STING zijn nieuwigheden zijn homepage: $core.url
  Feature help
  .Quantum Protection Grid: { window -a @Quantum
    aline @Quantum 6 --- On-line Reference guide: The Quantum Protection Grid ---
    aline @Quantum  
    aline @Quantum 6 The Quantum Protection Grid is a fundamental feature in BorgIRC.
    aline @Quantum 6 It is a superior protection system which includes the following:
    aline @Quantum  
    aline @Quantum 6 -> Efficient user protection -- DEOPKICKBAN protection
    aline @Quantum 6 -> Basic flood protection -- Safety protocols when sendingreceiving CTCP's, etc.
    aline @Quantum 6 -> NukeNabber support -- Collaboration with this program allows better tracking of malicious users
    aline @Quantum 6 -> Shielding -- Allows users to toggle ignore's onoff
    aline @Quantum 6 -> Personal Ban protection -- Prevents you from being banned if you have ops
    aline @Quantum 6 -> Channel protection -- Built-in .timers to prevent mass de-opskicks
    aline @Quantum 6 -> Mass-ban prevention under research
    aline @Quantum  
    aline @Quantum 6 It is still in test phases, it still needs improvements and fixes.
    aline @Quantum  
  }
  .Lag detector: { window -a @LagHelp
    aline @LagHelp 6 --- On-line Reference guide: Lag Detector ---
    aline @LagHelp  
    aline @LagHelp 6 What is a lag detector?
    aline @LagHelp  
    aline @LagHelp 6 A lag detector is a tool that checks how long it takes to send and
    aline @LagHelp 6 receive data from the IRC server you are connected to.
    aline @LagHelp 6 If for example, the server is very slow, it can happen that if you say
    aline @LagHelp 6 something, that 10 seconds later the data is received at the server.
    aline @LagHelp  
    aline @LagHelp 6 Every 2 minutes the lag detector (when activated) reports the time
    aline @LagHelp 6 it takes to send/receive data. When the lag info is updated, you
    aline @LagHelp 6 hear a sound event. (when activated)
    aline @LagHelp  
    aline @LagHelp 6 How can I toggle the Lag detector on or off
    aline @LagHelp  
    aline @LagHelp 6 Go the Control panel and uncheck/check Enable lag detector
    aline @LagHelp  
    aline @LagHelp 6 How can I turn off that lag sound?
    aline @LagHelp  
    aline @LagHelp 6 Simply by going to the Control panel in the menubar and unchecking:
    aline @LagHelp 6 Enable lag sound effect
  }
}


; BorgIRC Talker systeem v1.01 - Zie Leesmij.txt in de talker folder
; BorgIRC Regel opmaak v1.00
; ------------------------------------------------------------------------------------------------------

alias day return $replace($day,Saturday,Zaterdag,Sunday,Zondag,Monday,Maandag,Tuesday,Dinsdag,Wednesday,Woensdag,Thursday,Donderdag,Friday,Vrijdag)

on *:input:*: { 
  if ($left($1,1) == /) { return }
  if ($istok(@NickServ @ChanServ @OperServ @HostServ @MemoServ @BotServ @HelpServ,$active,32)) { linesep $active | msg $remove($active,$chr(64)) $1- }
  inc %~lines | inc %~char $len($1-) 
  if ($left($1-,1) == $chr(33)) && ($len($1) > 1) && (%format.notriggers) { return }
  if ($active == @msn) { return }
  if ($left($active,1) == $chr(61)) && (%format.nodccchat) { return }
  if (%nc == on) && ($chr(35) isin $target) && (*: iswm $1) { 
    if ($2) {
      var %tmp = $remove($1,:) $+ * 
      if ($ialchan(%tmp,#,1).nick) { set -nu %output  $+ $ialchan(%tmp,#,1).nick $+ : $2- } 
      if ($ialchan(*,#,0) < 2) && ($nick(#,0) > 1) { fx comply | a $^err $_(bc225) }
      if (%tmp == *) { set -nu %output $1- }
    }
  } 
  if (%format) { 
    if ((%format.mode == 0) && (%format.bold == $false) && (%format.underline == $false)) { %format = $false | format.chk | return }
    set -nu %output $format $+ $iif(%output,%output,$1-) 
  }
  if (%talker) { 
    set -nu %output $iif(%output,%output,$1-)
    if (%talk.mode) {
      if (http:// isin $1-) { unset %output | goto output }
      var %tmp = 0 | while (%tmp < $hget(talk,0).item) { 
        inc %tmp 
        if ($hget(talk,%tmp).item isin %output) { 
          set -nu %output $replace(%output,$hget(talk,%tmp).item, $+ $hget(talk,$hget(talk,%tmp).item) $+ $format) 
        } 
      }
      set -nu %output $remove(%output,$chr(32) $+ <2->,$chr(32) $+ <2>,$chr(32) $+ <me>,$chr(32) $+ <chan>,$chr(32) $+ <time>,$chr(32) $+ <date>) 
    }
  elseif ($hfind(talk,$1)) { set -nu %output $replace($hget(talk,$1),<2->,$format $+ $2-,<2>,$format $+ $2,<me>,$me,<chan>,$chan,<time>,$time,<date>,$date) } }
  if (<sound isin %output) { talk.proc %output | if ($exists($wavedir $+ %a)) { .sound %a } | var %tmp = <sound %a $+ > | set -nu %output $remove(%output,$chr(32) $+ %tmp) }
  unset %a, %b 
  :output
  if (%output != $1-) && (%output) { msg $active %output | hdef } 
  else { return } 
  :end
  resetidle
}

alias talk.proc var %x, %y = $regsub($1-, /<sound [^>]+\.(wav)>/gi,,%x) set %b %x | var %i = $regex(parsesounds, $1-, /<sound ([^>]+)>/gi) | set %a $regml(parsesounds,1)

alias talk.toggle if (%talker) { off | %talker = $false | if ($hget(talk)) { hfree talk } } | else { on | %talker = $true | if (%current.talker) { talk.init } }
alias talk.init {
  a Geselecteerde talker: %current.talker
  if ($isfile(%current.talker)) { 
    if ($read(%current.talker,1) != $chr(91) $+ talkers $+ $chr(93)) { fx comply | a $^err $_(bc233) | h }
    if ($hget(talk)) { hfree talk } | hmake talk 50 | var %tmp = 6
    while (%tmp < $lines(%current.talker)) { 
      inc %tmp  
      var %in = $read(%current.talker,n,%tmp)
      if (/sound !isin %in) || (/ sound !isin %in) { var %tmp1 = $gettok($read(%current.talker,%tmp),1,32) }
      else { a $^err $_(bc226) | continue }
      var %tmp2 = $gettok($read(%current.talker,%tmp),2-,32)

      if (%tmp1) { hadd talk %tmp1 %tmp2 }
    }
    linesep
    echo -a $_(bc227)
    echo -a $_(bc228)  $+ $tget(name)
    echo -a $_(bc229)  $+ $tget(author)
    echo -a $_(bc230)  $+ $tget(version)
    linesep
    if ($tget(Sentence) == No) { %talk.mode = $false } | else { %talk.mode = $true }
  }
}

alias tget return $readini(%current.talker,talkers,$1)

alias talk.view {
  if ($window(@Talker)) { window -c @Talker } | window -al -t30 @Talker | aline @Talker Huidig geladen talker: %current.talker | aline @Talker -
  var %tmp = 0 | while (%tmp < $hget(talk,0).item) { inc %tmp | aline @Talker $hget(talk,%tmp).item $chr(9) $hget(talk,$hget(talk,%tmp).item) } | window -s @Talker
}

alias talk.select {
  if ($1- == $null) {
    var %tmp = $shortfn($sfile($talkdir $+ \*.tlk;*.txt,$_(bc231),$_(bc232)))
    if (%tmp) && ($read(%tmp,1) != $chr(91) $+ talkers $+ $chr(93)) { fx comply | a $^err $_(bc233) | h }
    else { on | %current.talker = %tmp | if (%talker) { talk.init } | else { notalk } }
  }
  else { 
    if (%tmp) && ($read(%tmp,1) != $chr(91) $+ talkers $+ $chr(93)) { fx comply | a $^err $_(bc233) | h }
    else { on | %current.talker = $talkdir $+ $1- $+ .tlk | if (%talker) { talk.init } | else { notalk }
    }
  }
}
alias talk.mode if (%talk.mode) { on | %talk.mode = $false } | else { on | %talk.mode = $true }
alias -l notalk a $_(bc234)

alias talk.default {
  if (%talker == $null) { %talker = $false }
  if (%current.talker == $null) { %current.talker = $talkdir $+ Sting1.tlk }
  if ($isfile(%current.talker) == $false) { %current.talker = $talkdir $+ Sting1.tlk }
  if (%talk.mode == $null) { %talk.mode = $true }
}

dialog format {
  title "Regel opmaak"
  size -1 -1 173 140
  icon $bico
  option dbu
  check "Maak gebruik van regel opmaak",1,2 3 100 7
  box "Instellingen",2,1 14 171 89
  check "Maak tekst vet gedrukt",3,5 22 80 7
  check "Onderstreep tekst",4,5 30 80 7
  radio "Gebruik geen kleur",5,5 45 80 7
  radio "Gebruik reverse kleur",6,5 53 80 7
  radio "Maak gebruik van kleuren:",7,5 61 72 7
  text "Voorgrond:",8,80 61 31 10, right
  text "Achtergrond:",9,80 72 32 10, right
  combo 10,120 58 49 100,size
  combo 11,120 70 49 100,size

  check "Niet gebruiken bij regels die beginnen met ! of @ (triggers)",12,5 84 150 7
  check "Niet gebruiken bij DCC CHAT (file servers)",13,5 92 150 7

  text "Voorbeeld:",14,12 106 25 7
  edit "",15,42 104 112 11,autohs

  button "&Ok",99,42 125 45 13,ok
  button "&Reset",100,92 125 45 13
}

on *:dialog:format:init:*: {
  mdx MarkDialog $dname
  mdx SetControlMDX 10 comboboxex drop > [ $vdll ]
  mdx SetControlMDX 11 comboboxex drop > [ $vdll ] 
  mdx SetControlMDX 15 richedit nohidesel return vsbar read autohs > [ $gdll ] 
  did -a $dname 15 limit -1
  mdx SetFont 15 1 400 Fixedsys

  combo 10 
  combo 11 
  format.chk
}

alias form dl.open format
alias format.toggle { 
  if (%format) { off | %format = $false | if $dialog(format) { md -b format 2 14 } }
  else { on | %format = $true | if $dialog(format) { md -e format 2 14 } }
}

alias format.chk {
  if ($dialog(format)) { 
    if (%format) { did -c format 1 | md -e format 2 14 }
    else { did -u format 1 | md -b format 2 14 }

    if ((%format.col < 0) && (%format.col.bkg < 0)) { %format.mode = 0 }

    if (%format.mode == 0) { did -c format 5 | did -u format 6,7 | did -b format 10,11 }
    if (%format.mode == 1) { did -c format 6 | did -u format 5,7 | did -b format 10,11 }
    if (%format.mode == 2) { did -c format 7 | did -u format 5,6  }

    if (%format.notriggers) { did -c format 12 }
    if (%format.nodccchat) { did -c format 13 }

    did - $+ $iif(%format.bold,c,u) format 3 
    did - $+ $iif(%format.underline,c,u) format 4 

    did -c format 10 $iif(%format.col > -1,$calc(%format.col + 3),2) 
    did -c format 11 $iif(%format.col.bkg > -1,$calc(%format.col.bkg + 3),2) 

    upd.form
  }
}


alias -l combo {
  did -i $dname $1 1 iconsize small
  var %no = -1 | while (%no < 17) { inc %no | did -i format $1 1 seticon %no $+ , $+ $gfxdir $+ borgirc.icl }
  var %no = 0 |  while (%no < 17) { inc %no | did -a format $1 %no %no %no 0 $gettok($col,%no,44) } 
}

on *:dialog:format:sclick:*:{
  goto $did
  :1 | format.toggle | h  
  :3 | if (%format.bold) { off | %format.bold = $false } | else { on | %format.bold = $true } | upd.form | h
  :4 | if (%format.underline) { off | %format.underline = $false } | else { on | %format.underline = $true } | upd.form | h
  :5 | on | %format.mode = 0 | did -b format 10,11 | upd.form | h
  :6 | on | %format.mode = 1 | did -b format 10,11 | upd.form | h
  :7 | on | %format.mode = 2 | did -e format 10,11 | upd.form | h
  :10 | on 
  %format.col = $calc($gettok($did(10).seltext,1,32) - 2) 
  if (%format.col < 10) && (%format.col > -1) { %format.col = 0 $+ %format.col } 
  upd.form
  h
  :11 | on | set %format.col.bkg $calc($gettok($did(11).seltext,1,32) - 2)
  if (%format.col.bkg < 10) && (%format.col.bkg > -1) { %format.col.bkg = 0 $+ %format.col.bkg } 
  upd.form
  h
  :100 | on | unset %format.* | format.default | format.chk | h
  :99 | :0
}

alias format {
  if (%format) {
    if (%format.col == 0-1) { %format.col = -1 }
    if (%format.col < 0) { %format.mode = 0 }
    if (%format.mode == 2) {
      var %col =  $+ %format.col $+ $iif(%format.col.bkg > -1,$chr(44) $+ %format.col.bkg)
    } 
    else { unset %col }
    return $iif(%format.bold,) $+ $iif(%format.underline,) $+ $iif(%col,%col) $+ $iif(%format.mode == 1,)
  }
}
alias format.default {
  if (%format == $null) { %format = $false }
  if (%format.mode == $null) { %format.mode = 0 }
  if (%format.col == $null) { %format.col = 02 }
  if (%format.bold == $null) { %format.bold = $false }
  if (%format.underline == $null) { %format.underline = $false }
  if (%format.notriggers == $null) { %format.notriggers = $true }
  if (%format.nodccchat == $null) { %format.nodccchat = $true }
}

alias -l col return $_(bc237)
alias upd.form did -o format 15 1 text +m $format $+ Voorbeeld regel


; Auto-filters
; ----------------

alias filter.set { 
  if ($1 == on) { on | %filters = $true | var %filter.tmp = $true } | if ($1 == off) { off | var %filter.tmp = $false }
  if (%filter.tmp != $null) { %filter.format = %filter.tmp | %filter.comic = %filter.tmp | %filter.mp3play = %filter.tmp | %filter.nchat = %filter.tmp | return }
  if (%filter. [ $+ [ $1 ] ]) { off | %filter. [ $+ [ $1 ] ] = $false } | else { on | %filter. [ $+ [ $1 ] ] = $true }
}

alias filter.default {
  if (%filters == $null) { %filters = $false }
  if (%filter.format == $null) { %filter.format = $false }
  if (%filter.comic == $null) { %filter.comic = $true }
  if (%filter.nchat == $null) { %filter.nchat = $true }
  if (%filter.mynick == $null) { %filter.mynick = $true }
  if (%filter.mp3play == $null) { %filter.mp3play = $false }
  if ($isdir($nofile(%filter.log.file)) == $false) { %filter.log.file = $shortfn($logdir) $+ filter.log }
}

alias filter.toggle if (%filters) { off | %filters = $false } | else { on | %filters = $true }
alias filter.log.toggle if (%filter.log) { off | %filter.log = $false } | else { on | %filter.log = $true }
alias filter.log.set {
  var %tmp = $shortfn($sdir($logdir,Selecteer een lokatie voor uw auto-filter log,$_(BSel)))
  if (%tmp) { %filter.log.file = $shortfn(%tmp) $+ filter.log }
  else { %filter.log.file = $shortfn($logdir) $+ filter.log }
}
alias filter.log.clean.toggle if (%filter.log.clean) { off | %filter.log.clean = $false } | else { on | %filter.log.clean = $true }

alias flog { 
  if ($isfile(%filter.log.file)) { 
    window -a @Filterlog | loadbuf -r @Filterlog %filter.log.file 
    linesep @filterlog
    e @filterlog Total lines filtered or blocked:  $+ $calc($line(@filterlog,0) - 1)
  }
  else { fx comply | a $^err Filter log is leeg of bestaat niet ( $+ %filter.log.file $+ ) }   
}

; BorgIRC Sound skin system v1.01
; ------------------------------------------------------

alias skindir return $moddir $+ format\skins\
alias skin.get { 
  :begin
  var %skinread = $replace($read(%current.skin),<filetype>,$1,<get>,$2,<file>,$3,<info>,$4,<extra>,$5) 
  if (%skinread != [skins]) && (%skinread) { return %skinread } | else { goto begin }
}
alias skin.toggle if (%skin) { off | %skin = $false } | else { on | %skin = $true }
alias skin.select {
  if ($1 == $null) {
    var %tmp = $shortfn($sfile($skindir $+ \*.txt,$_(bc238),$_(bc232)))
    if (%tmp) && ($read(%tmp,1) == [skins]) { on | %current.skin = %tmp }
    else { a $^err $_(bc239) | h }
  }
  else { on | %current.skin = $skindir $+ $1 $+ .txt }
}
alias skin.default {
  if (%current.skin == $null) { %current.skin = $skindir $+ Default.txt }
  if ($isfile(%current.skin) == $false) { %current.skin = $skindir $+ Default.txt }
  if ($isfile(%current.skin) == $false) { fx comply | a $^err $_(bc239a) | h } 
}


; BorgIRC Connect
; -----------------------------------

alias conn { 
  if ($1 == reset) {
    startup.bconn -r
    s Alle auto-connect instellingen zijn nu gereset.
    return
  }
  dl.open bconn.s
}
alias bconn.upd if ($dialog(bconn)) { did -ra bconn 34 $asctime(ddd dd mmm yyyy HH:nn:ss) } | else { .timerbconnupd off }
alias cfgw.bconn write -s $+ bconn. $+ $1 $cfg.core bconn. $+ $1 $2-
alias cfgr.bconn return $read($cfg.core,s,bconn. $+ $1)
alias srvr.bconn return $gettok($read($cfg.core,s,server# $+ $1),$iif($2,$2,1),32)
alias srvw.bconn write -s $+ server# $+ $1 $cfg.core server# $+ $1 $2


dialog bconn.s {
  title "BorgIRC Connect - /conn"
  size -1 -1 180 89
  icon $bico
  option dbu
  icon 1,1 1 178 12,$gfxdir $+ bconn_head.jpg,1

  box "",30,1 11 178 67

  text "Kies een server:", 36, 5 18 150 7, left
  combo 37,76 16 100 75, drop sort
  check "Geef alleen Nederlandstalige servers weer",38,5 31 150 7
  check "Automatisch verbinding maken met deze server",39,5 39 150 7

  icon 40,50 53 80 12,$gfxdir $+ bconn.jpg,1
  check "Nieuw venster openen",41,55 68 80 7

  ;  button ">>",42,166 66 10 10

  button "OK", 498, -1 -1 1 1,ok
  check "Dit venster weergeven bij opstarten",501,1 81 100 7
}

alias bconn.fill {
  did -r $dname 37
  var %t0 = $cfgr.bconn(showdutchonly)
  var %no = 0 | while (%no < $server(0)) { inc %no | if (%t0) && ($left($server(%no).desc,2) == NL) { md2 -a $dname 37 $server(%no) } | if (!%t0) { md2 -a $dname 37 $server(%no) } }
  var %no = 0 | while (%no < $did($dname,37).lines) { inc %no | if ($did($dname,37,%no) == $cfgr.bconn(lastserver)) { did -c $dname 37 %no } }   
}

on *:dialog:bconn*:init:*:{ 
  bconn.fill
  if ($dname == bconn) {
  }
  if ($dname = bconn.s) {
    did - $+ $iif($cfgr.bconn(showdutchonly),c,u) $dname 38
    did - $+ $iif($cfgr.bconn(onstartup),c,u) $dname 501
    did - $+ $iif($srvr.bconn($did($dname,37),1),c,u) $dname 39
  }

  if ($dname == bconn) {
    mdx MarkDialog $dname
    mdx SetControlMDX 32 treeview haslines linesatroot hasbuttons showsel > [ $vdll ]
    mdx SetFont $dname 34 14 900 arial
    mdx SetFont $dname 35  14 900 arial
    mdx SetControlMDX 72 richedit nohidesel return vsbar read autohs > [ $gdll ] 
    did -i $dname 32 1 dragmethod copy move link

    ;  did -a $dname 2 +bce 1 2 0 2 0 About
    ;  did -i $dname 2 1 cb 2
    did -i bconn 32 1 cb root
    did -a bconn 32 +b Algemeen
    did -i bconn 32 1 cb 2
    did -a bconn 32 Nicknames
    did -i bconn 32 1 cb root 
    did -i bconn 32 1 branch expandall last

    .timercfgupd 0 1 bconn.upd
  }

}

on *:dialog:bconn*:sclick:*: {
  if ($did == 32) { 
    var %sel = $remove($gettok($did(32,1),4-,32),$chr(32)) | goto %sel 
    :2 | did -c bconn 1 | h   
    :22 | did -c bconn 2 | h   
    :23 | did -c bconn 3 | h   
    :24 | did -c bconn 4 | h   
  }
  goto $did
  :37 | did - $+ $iif($srvr.bconn($did($dname,37),1),c,u) $dname 39 | cfgw.bconn lastserver $did($dname,37) | h
  :38 | $iif($cfgr.bconn(showdutchonly),off,on) | cfgw.bconn showdutchonly $iif($cfgr.bconn(showdutchonly),$false,$true) | bconn.fill | h
  :39 | $iif($did($dname,39).state,on,off) | srvw.bconn $did($dname,37) $iif($did($dname,39).state,$true,$false) | h
  :40 | server $iif($did($dname,41).state,-m) $did($dname,37) | dialog -x $dname | h
  :41 | $iif($did($dname,41).state,on,off) | h
  :501 | $iif($cfgr.bconn(onstartup),off,on) | cfgw.bconn onstartup $iif($cfgr.bconn(onstartup),$false,$true)
  :498 | :0
  h 
}

alias bconn.refresh {
  did - $+ $iif(cfgr.bconn(showdutchonly),c,u) bconn 38
  did -u bconn 39

  if (%im == on) { did -c bconn 42 }
  if (%wm == on) { did -c bconn 43 }
  if (%sno == on) { did -c bconn 44 }
  if (%lscr == on) { did -c bconn 45 }
  if (%lscr.hide) { did -c bconn 46 }

  if $( $+(%, bconn.nicks.,$did(bconn,37)),1) { did -c bconn 61 | did -e bconn 62,63,64,65,66,67 }
  else { did -u bconn 61 | did -b bconn 62,63,64,65,66,67 } 


  if (%awaydefchk) { did -c bconn 68 }

  ;  $+(%, bconn.nicks.,$did(bconn,37)) 
  ;  $+(%, bconn.defnick.,$did(bconn,37)) 
  ;  $+(%, bconn.altnick.,$did(bconn,37)) 
  ;  $+(%, bconn.awaynick.,$did(bconn,37)) 


}
