; BorgIRC - Startup and logon routines
; ----------------------------------------------------------

ON *:START: { 
  diag.startup
  prestart 
}

alias diag.startup {
  if ($script(core.mrc) == $null) {
    echo -s ** (startup.mrc) Error: Cannot find critical module: startup.mrc. Attempting to correct the problem.
    echo -s ** (startup.mrc) Launching BorgDiag...
    if ($script(borgdiag.mrc)) { diag | halt }
    else {
      echo -s ** BorgDiag is not present as a script, attempting to load.... 
      var %tmp = system\modules\borgdiag\borgdiag.mrc
      if ($isfile(system\modules\borgdiag\borgdiag.mrc)) {
        .load -rs %tmp | echo -s ** BorgDiag loaded | echo -s ** NOTE: Make sure BorgDiag resets the script files to default 
        if ($isalias(diag)) { diag | halt }
      }
      else { echo -s ** Fatal error: BorgDiag not found. Please reinstall BorgIRC. | halt }
    }
  }
}

alias prestart {
  ; BorgUpdate maintenance 
  ; ----------------------------------------
  var %tmp = $indir $+ bupdate.tmp | if ($isfile(%tmp)) { .remove %tmp }
  if ($script(bupdate.mrc)) { .unload -rs bupdate.mrc }

  if (%splash == $null) { set %splash on }
  chkfx | unset %tb.txt | if (%session == $null) { set %f.dae $asctime } | inc %session
  set %~ctcp_snt 0 | set %~ctcp_rcv 0 | set %~lines 0 | set %~char 0 | set %~query 0 | set %~dcc_rcv 0 | set %~dcc_snt 0 | set %~lines_rcv 0 | set %~notice 0 | set %stime $ticks $time | if %d.log == on { .debug on }
  var %sttt = $ticks 

  set %connect $false

  ; Additional error checking
  ; ---------------------------------------
  unset %missing
  if (!$isfile($gfxdir $+ startup.png)) { var %missing = $gfxdir $+ startup.png }
  if (!$isfile($gfxdir $+ borgirc.png)) { var %missing = $gfxdir $+ borgirc.png }

  if (%missing) {
    echo -s ** (startup.mrc): A critical file is missing ( $+ %missing $+ ). 
    echo -s ** (startup.mrc): This means that you have probably installed a upgrade on a too old version or something went wrong with the installation. You are advised to re-install a full copy of BorgIRC or correct the problem manually and restart BorgIRC.
    halt
  }


  if (%splash == on) { spbar | .timerwait 1 0.5 prestart2 $1 | h }
  prestart2 $1
}

alias prestart2 { 
  ;--------------------------------------------------
  spupd 0 done
  ;--------------------------------------------------

  ;-------------------------------------------------------
  spupd 5 $x $+ BorgIRC controleren...
  ;--------------------------------------------------------
  intchk
  spupd 50 done
  ;-------------------------------------------------------
  spupd 50 $x $+ Laden multi-taal systeem...
  ;-------------------------------------------------------
  .lan.init $1
}

alias startup {
  ;--------------------------------------------------
  spupd 70 done
  spupd 70 $x $+ Thema toepassen...
  ;--------------------------------------------------
  if (%tbar == $null) { set %tbar on }
  if ((%th == on) && (%th.bk == on)) { bkg -m } 
  if %th == $null { set %th off | set %th.s 1 } 
  if %c.i == $null { set %c.i 03 } | if %c.i2 == $null { set %c.i2 02 } | if %c.i3 == $null { set %c.i3 06 } | if %c.ip == $null { set %c.ip 03 } | if %c.ip2 == $null { set %c.ip2 02 } | if %c.ip3 == $null { set %c.ip3 06 }
  if %th.bk == $null { set %th.bk on } 
  if %th == on { 
    if %th.cl == on { if %c.co == $null { set %c.co $colour(normal) } | if %c.cm == $null { set %c.cm $colour(normal) } | if %c.cp == $null { set %c.cp $colour(normal) } | if %c.cn == $null { set %c.cn $colour(normal) } | if %c.cr == $null { set %c.cr $colour(normal) } }
    if (%th.s == 99) && (%cth) { slct 99 %cth -q | goto end } 
    if %th.s == 99 && %cth == $null { set %th.s 1 } 
    if %th.s == $null { set %th.s 1 } 
    slct %th.s
  } 
  :end 
  spupd 75 done

  if (%first.time == $null) { 
    run leesmij.txt
    %f.date = $date | %first.time = $true 
    infw.bupdate LASTUP $ctime
    var %tmp = $input($_(bc150),136,$_(bc151))
    if (%tmp) { aico 0 | aico 2 | ms $_(bc152) }
  }
  if %mp3 == $null { set %mp3 off } | if %mod == $null { set %mod off } | if %fx.grab == $null { set %fx.grab off } | if %fx.serv == $null { set %fx.serv off } | if %cdt == $null { set %cdt off } | if %lscr == $null { set %lscr off } | fx weIcome | if %im == $null { set %im off } | if %tl == $null { set %tl off } | if %dccsend == $null { set %dccsend on }

  chk.crc 

  ;---------------------------------------------------
  spupd 80 $x $+ Laden $_(bc154) $+ ...
  ;---------------------------------------------------
  talk.default

  ;---------------------------------------------------------
  spupd 90 done
  spupd 90 $x $+ $_(bc155) $+ ...
  startup.bupdate

  if ($ctime > 1104706800) && (%xmas.stay == $null) && ($script(x-mas.mrc)) { 
    var %tmp = $input(De feestdagen zijn weer voorbij. Wil e de Feestdagen special 2004-2005 uitschakelen?,136,Feestdagen special 2004-2005)
    if (%tmp) { .unload -rs x-mas.mrc | a $^not De feestdagen special is nu uitgeschakeld! }
    else { %xmas.stay = $true }
  }
  spupd 100 done
  if ($sslready) { spupd 100 $x $+ SSL-server ondersteuning is aanwezig. }
  spupd 100 $x $+ $_(bc156)

  if ($dialog(spbar)) {
    did -h spbar 3 
    if (%c.date) { did -v spbar 8 | did -ra spbar 8 $_(bc159) } 
  }

  tbar
  %sec = 1 | if ($dex(spbar) == $false) { .timerclose 0 2 cntdwn $1 }
  %c.date = $asctime
  if (%talker) { talk.init }

  if (!$1) { ms $_(bc162A) | linesep -s }

  if ($1 == -r) && ($server) { linesep -s | ms Je bent al verbonden met  $+ $scon(0) server $+ $iif($scon != 1,s) $+ . }
  else {
    ms $_(bc162)
    if (%ls) { ms $_(bc165) $+ %c.i2 %ls } 
  }
  tbar
  if (%bupd.autochk == $null) { %bupd.autochk = $true } 
  if (%bupd.autochk) { 
    inc %bupd.autochk.count
    if (%bupd.autochk.count > 2) { unset %bupd.autochk.count | check.version }
  }
  else { 
    inc %bupd.autochk.sec 
    if (%bupd.autochk.sec > 19) { unset %bupd.autochk.sec | %bupd.autochk = $true }
  }
  fx welcome -q

  if (%splash == off) {
    startup.bconn
    if ($dex(bconn) && $dex(bconn.s)) { ms $_(bc165B) }
    linesep -s
    ms * Kijk ook eens op 12 $+ $core.url $+  en 12 $+ $core.url3 $+ !
  }

}

; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
; BorgUpdate Startup - This version of BorgIRC supports upgrading from BorgIRC 2.57, 2.58 & 2.58cc

alias startup.bupdate {
  if ($borgver < 2.59a) {
    spupd 95 $x $+ $_(bc155b) $+ ...
    if (($borgver == 2.57) || ($borgver == 2.58) || ($borgver == 2.58cc) || ($borgver == 2.59)) { devlog } 
    else { ms $_(bc155c) }
    linesep -s

    if ($script(chatcity.mrc)) { .unload -rs chatcity.mrc }
    if (!$script(networks.mrc)) { .load -rs $mrcdir $+ networks.mrc }

    infw.core URL1 http://www.borgirc.net
    infw.core URL2 http://home.versatel.nl/mirc-helpdesk
    infw.core URL3 http://www.chatnetwerk.nl
    infw.core DEV $false

    if ($borgver < 2.58) { 
      cfgw.bconn showdutchonly $true
      cfgw.bconn onstartup $true
      cfgw.bconn lastserver irc.chatnetwerk.nl
    }

    .server -a irc.chatnetwerk.nl -p 6667 -g NL_ChatNetwerk -d NL: ChatNetwerk.NL
    update.host 1

    infw.core VERSION 2.59a
    infw.core DATE 10-02-2005
    infw.lanman VERSION 0.9
    infw.bupdate VERSION 1.12
    infw.bupdate LASTUP $ctime

    linesep -s
    tbar
    ms $_(bc155d)
    linesep -s
    ms $_(bc155e)
    ms $_(bc155f)
    linesep -s
    spupd 95 done
  }
}
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

; BorgIRC connect Startup
; ----------------------------------------
alias startup.bconn {
  if ($1) { var %tmp54 = $1 } | else { unset %tmp54 }
  if ($cfgr.bconn(onstartup) && ($1 != r)) { conn }
  chk.defnick

  if (!$fopen(cfg.core)) { .fopen cfg.core $cfg.core }
  .fseek -w cfg.core server#*
  var %dummy = $true
  while (%dummy) { 
    var %in = $fread(cfg.core) 
    if (server#* iswm %in) { 
      tokenize 32 %in
      if ($2) { 
        if (!%tmp54) { server $iif(%connect,-m) $gettok($1,2,35) | %connect = $true }
        if (%tmp54 == -r) { srvw.bconn $gettok($1,2,35) $false }
      }
    }
    else { unset %dummy }
  }
  .fclose cfg.core
}


alias cntdwn {
  dec %sec
  if ($dex(spbar) == $false) { spupd 100 $+ $_(bc166) } 
  if (%sec == 0) { 
    unset %sec 
    if ($dex(spbar) == $false) { dialog -x spbar } 
    .timerclose off
    if (!$1) {
      startup.bconn
      if ($dex(bconn) && $dex(bconn.s)) { ms $_(bc165B) }
    }
    linesep -s
    ms * Kijk ook eens op 12 $+ $core.url $+  en 12 $+ $core.url3 $+ !
  }
}

alias ls { 
  var %tmp = system\mrc\ $+  $1- $+ .mrc 
  if ($isfile(%tmp)) {
    if $script($nopath(%tmp)) { reload -rs %tmp | return }
    ms * $_(bc167)
    .load -rs %tmp 
  } 
  else { l.err %tmp } 
}

alias la { 
  var %tmp = system\mrc\ $+  $1- $+ .mrc 
  if ($isfile(%tmp)) {
    if $alias($nopath(%tmp)) { reload -a %tmp | return }
    ms * $_(bc167)
    .load -a %tmp 
  } 
  else { l.err %tmp } 
}

alias uls .unload -rs $mrcdir $+  $1- $+ .mrc
alias ula .unload -a $mrcdir $+  $1- $+ .mrc

alias -l l.err a $^err $_(bc168)

alias mls {
  if ($1 == -r) { var %tmp = 1 | while ($gettok($2-,%tmp,44)) { ls $gettok($2-,%tmp,44) | inc %tmp } }
  if ($1 == -ur) { var %tmp = 1 | while ($gettok($2-,%tmp,44)) { uls $gettok($2-,%tmp,44) | inc %tmp } }
  if ($1 == -a) { var %tmp = 1 | while ($gettok($2-,%tmp,44)) { la $gettok($2-,%tmp,44) | inc %tmp } }
  if ($1 == -ur) { var %tmp = 1 | while ($gettok($2-,%tmp,44)) { ula $gettok($2-,%tmp,44) | inc %tmp } }
}

;alias chkscr if (($script(0) < 15) || ($alias(0) < 2)) { ms * $_(bc169) | loadall }

alias loadall { 
  mls -r core,startup,misc,away,chanmgn,raw,ctcp,borgfx,d01,p01,pp_nl1,pp_nl2,pp_nl3,pp_int1,networks
  mls -a a01,a02
}

alias cn.do {
  if (%cn.ajoin.chatcafe) { join #chatcafe }
  if (%cn.easy.select) { dl.open cn2 }
}

alias ccity.do {
  if (%ccity.ajoin.borgirc) { join #borgirc }
  if (%ccity.easy.select) { dl.open cc2 }
}

alias con.chk {
  if (%awaydefchk) && ($me == %away.nick) { nick %defnick | .timerawaydefnick 1 2 s $^not $_(bc170a) }

  var %temp = $gettok($getcfg.bupdate(general,bupdate.host),1,32) | if (%temp == $null) || (%temp < 1) || (%temp > 3) { cfgw.bupdate general BUpdate.host 1 }

  ; Chatcity specific support
  if (chatcity isin $netw) { .auser 100 $me
    if (%ccity.support == $null) { %ccity.support = $true }
    if (%ccity.ajoin.borgirc == $null) { %ccity.ajoin.borgirc = $false }
    if (%ccity.easy.select == $null) { %ccity.easy.select = $true }
    if (%ccity.support) { 
      if (%ccity == $null) { dl.open cc }
      else { ccity.do }
    }
  }

  ; ChatNetwerk specific support
  if (chatnetwerk isin $netw) { .auser 100 $me
    if (%cn.support == $null) { %cn.support = $true }
    if (%cn.ajoin.borgirc == $null) { %cn.ajoin.borgirc = $false }
    if (%cn.easy.select == $null) { %cn.easy.select = $true }
    if (%cn.support) { 
      if (%cn == $null) { dl.open cn }
      else { cn.do }
    }
  }

  .disable #jw | unset %jw* %jc* %take.* %data*

  ; File server diagnostics
  if (($send(0) == 0) && ($fserv(0) == 0)) { unset %fserv.init.* %fs.send.* }

  sync 

  if (%away.nick == $null) { set %away.nick $me [ $+ ] -away } 

  if %offnick == $null { set %offnick off }
  .IAL ON | .IGNORE ON | .FSEND ON | .REMOTE ON | .NOTIFY ON 
  unset %cc.* %sm.* %t %dpm.* %nick1 %bc %kc %who.* %nfc.* %tc* %f7* %tv* %dmc.* %dwc.* %dc.* %ctt %num %cubes* %tmp* %who* %tc* %km* %nfc* %flog.ctrl* %playfile.*
  if %opctrl ==  $null { set %opctrl 1 } | if %g.pop == $null { set %g.pop $true } | if %gender == $null { set %gender male } | if %o.gender == $null { set %o.gender female }
  if (%rp == $null) { %rp = on }
  if (%random.skin == $null) { %random.skin = $false }

  if %rso == $null || %rso == on { 
    %rso = on 
    if (%M.sd == on) { .ignore -pntir * } 
    if (%C.sd == on) { .ignore -rt * } 
    if (%N.sd == on) { .ignore -nr * } 
    if (%P.sd == on) { .ignore -pr * }
    set %C.sd off | set %M.sd off 
    unset %oldnick. [ $+ [ $cid ] ] 
    set %PM.sd off | set %D.sd off | set %N.sd off 
  } 

}

ON *:CONNECT: { 
  set %connect $true
  tbar
  con.chk

  fx InternetLink -q 
  if (!%aoper.username) || (!%aoper.password) { %aoper = $false }
  if (%aoper) && ($server == %aoper.server) { a $^not Automatisch aangemeld als IRC Operator | oper %aoper.username $decode(%aoper.password,m) }

  if %c.i == $null { set %c.i 03 } 
  if %c.i2 == $null { set %c.i2 02 } 
  if %c.i3 == $null { set %c.i3 06 } 
  if %c.ip == $null { set %c.ip 03 } 
  if %c.ip2 == $null { set %c.ip2 02 } 
  if %c.ip3 == $null { set %c.ip3 06 } 
  if (%th == on && %th.cl == on) { 
    if %c.co == $null { set %c.co $colour(listbox text) } 
    if %c.cm == $null { set %c.cm $colour(listbox text) } 
    if %c.cp == $null { set %c.cp $colour(listbox text) } 
    if %c.cn == $null { set %c.cn $colour(listbox text) } 
    if %c.cr == $null { set %c.cr $colour(listbox text) }
  }

  set %logintime $time | set %lnd $date | .pdcc 2147483647 | .dcc packetsize 2048 | ms $_(bc170)
  if (%count. [ $+ [ $netw ] ] == $null) { set %countdate. [ $+ [ $netw ] ] $date } | inc %count. [ $+ [ $netw ] ] 1
  if %tbar == on { tbar } 
  if ($ircx) { ms $^warn $_(bc173) | goto blah } 
  if ((%im == on) && (%wm == on) && (%sno == on)) { mode $me +iws } 
  if %wm == on { mode $me +w } 
  if %sno == on { mode $me +s }
  :blah 
  if (%lscr == $null) { set %lscr off } | if (%lscr == on) { info1 } | if %im == on { .timercloak 1 1 timedcloak }
  if ($timer(sync) == $null) { .timersync -i 0 60 sync }
  if ($timer(aa) == $null) && (%aa == on) { .timeraa -i 0 1 aa }
  if (%l.d == on) { .timerlag -i 0 60 lc }
  linesep
  if (Chatcity isin $netw) { ms $_(bc174) | ms $_(bc175) }
}

alias spbar dl.open spbar
dialog spbar {
  size -1 -1 235 143
  option dbu
  icon $bico
  title "BorgIRC"
  text "BorgIRC",6,95 5 150 7,left
  text "©1998-2005 STING. Alle rechten voorbehouden",7,95 13 150 7,left

  text "..",8,-1 140 235 7, center

  edit "Wachten op initialisatie...",1,94 24 140 110,left read multi
  text "100%",2, 113 90 15 7,right hide
  text "0 0 100",3,1 140 232 10
  icon 4, 1 1 89 135,$gfxdir $+ about.png,1
  box "",5,-1 133 300 300

  button "Stop",99,145 175 50 20,cancel hide
}

alias spupd  {
  if (($dex(spbar)) || (%splash == off)) { return }
  did -o spbar 3 1 $int($1)
  did -o spbar 2 1 $1 $+ % 
  if ($2-) { did -a spbar 1 $2- }
}


; Nicknames

alias chk.defnick {
  if (%defnick == $null) || ($1 == -n) { dl.open defnick }
}

dialog defnick {
  title $_(bc175a)
  size -1 -1 113 73
  icon $bico
  option dbu
  text $_(bc175b),1,2 2 100 7
  box "",2,2 9 110 37,2

  text $_(bc175c),3,4 16 100 7
  edit "",4,60 14 50 10

  text $_(bc175d),5,4 26 100 7
  edit "",6,60 24 50 10

  text $_(bc175e),7,4 36 100 7
  edit "",8,60 34 50 10

  check $_(bc175f),9,9 47 100 7
  button "&Ok",99,42 57 35 13,ok
}

on *:dialog:defnick:init:*: {
  if (%defnick == $null) { %defnick = $me }
  if (%altnick == $null) { %altnick = $anick }

  if (%awaydefchk == $null) && (%away.nick) { %awaydefchk = $true }
  if (%awaydefchk) { did -c defnick 9 }

  did -ra defnick 4 %defnick
  did -ra defnick 6 %altnick
  if (%away.nick) { did -ra defnick 8 %away.nick }
}

on *:dialog:defnick:edit:8: if ($did(8).text) { %an = on } | else { %an = off }

on *:dialog:defnick:sclick:9: {
  if (%awaydefchk == $null) || (%awaydefchk == $false) { on | %awaydefchk = $true }
  else { off | %awaydefchk = $false }
}
on *:dialog:defnick:sclick:99: {
  if ($did(4).text == $did(8).text) { fx comply | a $^err $_(bc175g) | h }
  if ($did(4).text == $did(6).text) { fx comply | a $^err $_(bc175h) | h }

  if ($did(4).text) { %defnick = $did(4).text | if ($server == $null) && ($me != %defnick) { .nick %defnick } }
  elseif ($me == $null) { fx comply | a $^err $_(bc175i) | h }

  if ($did(6).text) { %altnick = $did(6).text | if ($anick != %altnick) { .anick %altnick } }
  else { anick %defnick $+ _ }

  if ($did(8).text) { %away.nick = $did(8).text }
}

; BorgIRC Integrity check & diagnostics
; -----------------------------------------------------------

alias intchk { 
  ; Environment diagnostics
  unset %fixall

  ; mIRC version check
  if ($version < 6.16) { 
    if (%ver.warn == $null) { 
      var %tmp = $input(BorgIRC was developed for use with mIRC 6.16. You are using mIRC $version $+ . $x $x $+ This can cause unforseen problems. $x $+ Usage is at your own risk. $x $x $+ Do you wish to proceed anyway?,520,Warning)
      if (%tmp) { %ver.warn = $true } | else { exit | h }     
    }
    ms $^warn BorgIRC was developed for use with mIRC 6.16. You are using mIRC $version $+ . This can cause unforseen problems. Usage is at your own risk.
    linesep -s
  } 
  ; CD-ROM check
  if ($right($left($mircexe,2),1) == $chr(58)) {
  if ($disk($left($mircexe,1)).type == cdrom) { dialog -x spbar | .echo -q $input(BorgIRC does not function on a CD-ROM drive. BorgIRC will now exit. $crlf $crlf $+ Please install BorgIRC on a hard disk (ie. C:, D:).,516,Fatal error,Exit) | exit | halt } } 

  ; Read-only attribute check
  if ($window(@attr.diag) == $null) { window -ah @attr.diag }
  else { clear @attr.diag }
  var %tot = $findfile($mircdir $+ system,*.*,0,echo @attr.diag $1-)
  var %no = 0
  while (%no < %tot) {
    inc %no 
    if r isin $dll($fdll,GetFileAttr,$line(@attr.diag,%no)) { 
      if (%fixall == $null) { var %tmp = File: $nopath($line(@attr.diag,%no)) $crlf $crlf $+ BorgIRC has found a problem with a script file. It is set to Read-Only, which can cause BorgIRC to not work properly. $crlf $crlf $+ Do you want to correct this problem? $crlf $crlf $+ Press YES to correct all such problems. $crlf $+ Press NO to ignore it $crlf $+ Press CANCEL the environment check. | var %yn = $input(%tmp,304,Problem found!) }
      else { var %yn = $yes }
      if (%yn == $yes) { var %fixall = $true | dll $fdll SetFileAttr na $line(@attr.diag,%no) }
      if (%yn == $cancel) { return }
    }
  }
  if ($window(@attr.diag)) { window -c @attr.diag }

  ; Trojan check

  var %no = 0
  while (%no < $script(0)) {
    inc %no
    if ($chr(160) isin $script(%no)) { var %s = $script(%no) | .unload -rs %s | rename %s script $+ %no $+ .vir | echo *** 4Warning - BorgIRC has detected and removed a virus-worm from your mIRC. (Renamed file to: $nofile(%s) $+ script $+ %no $+ .vir $+ ) }
  }

  ; Script settings diagnostics
  sync 
  if (%kick.reason == $null) { %kick.reason = $false Behave }
  if (%kill.reason == $null) { %kill.reason = Behave }
  if (%kline.reason == $null) { %kline.reason = Behave }
  if (%gline.reason == $null) { %gline.reason = Behave }
  if (%shun.reason == $null) { %shun.reason = Behave }
  if (%kline.length == $null) { %kline.length = 1d }
  if (%gline.length == $null) { %gline.length = 1d }
  if (%shun.length == $null) { %shun.length = 30m }
  if (%oper.override == $null) { %oper.override = $true }
  if (%nick.caller.beep == $null) { %nick.caller.beep = $true }

  if (%ded.snotice == $null) { %ded.snotice = $true }
  if (%ded.services == $null) { %ded.services = $true }
  if (%ded.snotice.to == $null) { %ded.snotice.to = 600 }
  if (%ded.services.to == $null) { %ded.services.to = 600 }

  if %b.b == $null { set %b.b off } | if %ub.b == $null { set %ub.b off } | if %o.b == $null { set %o.b off } | if %d.b == $null { set %d.b off } | if %b.g == $null { set %b.g off } | if %j.g == $null { set %j.g off } | set %fs.ad1 off | if %l.d == $null { set %l.d off } | if %CTCP.prot == $null { set %CTCP.prot on } | if %DCC.prot == $null { set %DCC.prot on }
  if %opctrl == $null { set %opctrl 1 } | if %nukenab == $null { set %nukenab off } | if %im == $null { set %im on } | if %wm == $null { set %wm off } | if %sno == $null { set %sno off } |  if %auto.op == $null { set %auto.op on } | if %deop.prot == $null { set %deop.prot on } | if %kick.prot == $null { set %kick.prot on } | if %ban.prot == $null { set %ban.prot on } | if %mdp == $null { set %mdp on } | if %mkp == $null { set %mkp on } | if %mbp == $null { set %mbp on } | if %pb.prot == $null { set %pb.prot on } | if %kcs == $null { set %kcs off } | if %bcs == $null { set %bcs off } | if %mp3 == $null { set %mp3 off } | if %woj == $null { set %woj off }
  if %mod == $null { set %mod off } | if %lscr == $null { set %lscr off } | if %fps == $null { set %fps off } | if %tbar == $null { set %tbar on } | if %kcs == $null { set %kcs off } | if %kcop == $null { set %kcop off } | if %bcs == $null { set %bcs off } | if %bcop == $null { set %bcop off } | if %cdt == $null { set %cdt off } | if %ownclone == $null { set %ownclone off }
  if %nc == $null { set %nc on }
  if %l.fx == $null { set %l.fx off } | if %tl == $null { set %tl off } | if %msg.prot == $null { set %msg.prot on } | if %nt.prot == $null { set %nt.prot on }
  if (%pop.nl == $null) { popset on }
  fs.chk
  if (%nick.caller == $null) { %nick.caller = $true }
  if (%priv == $null) { %priv = $false }
  if ($srvr.bconn(www.chatcity.nl) == $null) { srvw.bconn www.chatcity.nl $false }
  if ($srvr.bconn(irc.chatnetwerk.nl) == $null) { srvw.bconn irc.chatnetwerk.nl $false }
  if ((%tst == off) || (%tst == $null)) { .timestamp off } | if %tst == on { .timestamp on } | if %fps == $null { set %fps off }
  if (%aa.time == $null) { %aa.time = 15 }
  if (%mode == $null) { %mode = 2 }

  format.default
  filter.default
  skin.default

  if (%filter.log == $null) { %filter.log = $true } 
  if (%filter.log.file == $null) { %filter.log.file = $shortfn($logdir) $+ filter.log }
  if (%filter.log.clean == $null) { %filter.log.clean = $true }
  if (%filter.log.clean) { write -c %filter.log.file }
}

alias aico addicon $shortfn($mircexe) $shortfn($mircdir) $shortfn($mircdir) $+ system\gfx\borgico.ico $dll($nLINKn,specdir,$1)
