ProjectX AwaySystem — File Browser

ProjectXAwaySystemv1.50 / ProjectXAwaySystemv1.50 / pxasys.mrc

pxasys.mrc — 46.27 KB — Download this file

;---------<  ProjectX mIRC Scripters Crew >-----------
; Filename..: pxasys.mrc [ProjectX AwaySystem]
; Release...: v1.50
; Author....: SpikerX
; Feedback..: spike@no3dfx.com
; Date......: Monday, September 8, 2003
; URL.......: http://www.projectx.mx.dk/
; Extra.....: AwaySystem is just a basic away system with a few fun options.
; Short.....: pxasys
; Base......: 3.50
;-----------------------------------------------------

;-------- -  -
; Aliases
;-------- -  -
alias -l dlg dialog $iif($dialog($$1),-v,-m $1) $1
alias -l dlgx var %i = $0 | while (%i) { var %d = $ [ $+ [ %i ] ] | if ($dialog(%d)) dialog -x %d | dec %i }
alias -l pxasys.file return $+(",$scriptdirpxasys.ini,")
alias -l pxasys.set $iif($3 != $null,writeini,remini) -n $pxasys.file $$1-
alias -l pxasys.get return $readini($pxasys.file,n,$$1,$2)
alias -l pxasys.away $iif(!$a,away -m,back -m)
alias -l pxasys.logdir return $+(",$iif($pxasys.get(options,logdir),$ifmatch,$scriptdir),$1-,")
alias -l pxasys.hfile return $+(",$scriptdirpxasys-help.cfg,")
alias -l pxasys.echo px.echo $iif($left($1,1) == $chr(45),$1,-a) $px.addon $+ : $iif($left($1,1) == $chr(45),$2-,$1-)
alias -l pxasys.resetidle { var %i = $pxasys.get(options,n0), %x = .timerpxasys.idleaway, %m = $iif($pxasys.get(msg,automsg),$pxasys.get(msg,away),$pxasys.get(msg,auto)) | if ($1 == off) { %x off | return } | if (!$gettok(%i,9,44)) || (($a) && ($1 != -f)) return | %x 1 $calc($abs($gettok(%i,8,44)) * 60) away -g -o %m }
alias -l pxasys.replace { if (!$gettok($pxasys.get(options,n0),26,44)) return $1- | var %i = 1, %s, %w = $pxasys.get(filter,w), %f = $pxasys.get(filter,f), %l | while ($gettok($$1-,%i,32)) { %l = $ifmatch | %s = %s $iif($findtok(%w,%l,32),$case(%l,$gettok(%f,$ifmatch,32)),%l) | inc %i } | return %s }
alias -l pxasys.numini { var %. = @pxasys._tmp, %f = $pxasys.file | if ($window(%.)) window -c %. | window -hkl %. | loadbuf -t $+ $$1 %. %f | filter -wwc %. %. $$2- $+ $iif($chr(42) !isin $2-,$chr(42)) | .timerpxasys@close 1 0 window -c %. | return $line(%.,0) }
alias -l pxasys.remini { var %. = @pxasys._tmp, %f = $pxasys.file | if ($window(%.)) window -c %. | window -hkl %. | loadbuf -t $+ $$1 %. %f | filter -wwcx %. %. $$2- $+ $iif($chr(42) !isin $2-,$chr(42)) | remini $pxasys.file $1 | while ($line(%.,1)) { pxasys.set $1 $gettok($ifmatch,1,61) $gettok($ifmatch,2-,61) | dline %. 1 } | window -c %. }
alias -l pxasys.save {
  chkdlg | var %i = pxasys, %- = $pxasys.get(options,n0) | pxasys.set msg away $$convert($did(%i,8)).invert | pxasys.set msg return $$convert($did(%i,10)).invert | pxasys.set msg auto $$convert($did(%i,12)).invert | pxasys.set msg automsg $did(%i,13).state | pxasys.set msg format $convert(%pxasys.tmp.away).invert | pxasys.set msg format2 $convert(%pxasys.tmp.return).invert | pxasys.set options logdir $$did(44)
  %- = $puttok(%-,$did(%i,15).state,1,44) | %- = $puttok(%-,$did(%i,16).state,2,44) | %- = $puttok(%-,$did(%i,17).state,3,44) | %- = $puttok(%-,$did(%i,18).state,4,44) | %- = $puttok(%-,$did(%i,19).state,5,44) | %- = $puttok(%-,$did(%i,30).state,6,44) | %- = $puttok(%-,$did(%i,31).state,7,44) | %- = $puttok(%-,$abs($iif($gettok($did(%i,33),1,32) isnum,$ifmatch,$gettok(%-,8,44))),8,44) | %- = $puttok(%-,$did(%i,32).state,9,44) | %- = $puttok(%-,$abs($iif($gettok($did(%i,36),1,32) isnum,$ifmatch,$gettok(%-,10,44))),10,44) | %- = $puttok(%-,$did(%i,35).state,11,44) | if ($network == dalnet) || ($network == undernet) || ($network == sorcerynet) %- = $puttok(%-,$did(%i,41).state,12,44) | %- = $puttok(%-,$did(%i,34).state,13,44)
  %- = $puttok(%-,$did(%i,49).state,14,44) | %- = $puttok(%-,$did(%i,50).state,15,44) | %- = $puttok(%-,$did(%i,51).state,16,44) | %- = $puttok(%-,$did(%i,42).state,24,44) | %- = $puttok(%-,$did(%i,52).state,25,44) | %- = $puttok(%-,$did(%i,46).state,29,44) | pxasys.set options n0 %- | pxasys.set options nicks $iif($did(%i,20,1),$didtok(%i,20,44),@me $+ -away) | pxasys.set options nick $did(%i,20).sel | if (!$did(%i,32).state) pxasys.resetidle off | else pxasys.resetidle
}
alias pxasys.pbar { var %. = @pxasys.pbar.tmp, %n = $calc($$1 + 5), %l = $+(",$scriptdirpxasys.pbar.bmp,") | if (!$dialog(pxasys.shutd)) return | if (%n > 100) { .remove %l | exit } | if ($window(%.)) window -c %. | window -hkp +d %. 207 12 206 12 | drawfill %. 0 0 0 0 | drawrect -f %. 2 11 0 0 $calc((%n / 100) * 206)) 12 | drawsave %. %l | window -c %. | did -g pxasys.shutd 3 %l | .timerpxasys.pbar -m 1 400 pxasys.pbar %n }
alias pxasys.timer if ($1 == $me) && ($group(#pxasys.anick).status == on) .timerpxasys.nick [ $+ [ $cid ] ] 1 0 $eval(unset %pxasys.tmp.nicks [ $+ [ $cid ] ] ,-1) $iif($cid == $scon(0),$chr(124) .disable #pxasys.anick)
alias -l a return $away
alias -l convert return $iif($prop == invert,$replace($1,,&b,,&u,,&k,,&o,,&r),$replace($1,&b,,&u,,&k,,&o,,&r,))
alias -l plural return $iif($1 > 1,$2 $+ s,$2)
alias -l chkdlg { if (!$dialog(pxasys)) { var %x = $input(Main configuration dialog not open.,516,$px.addon) | if ($dialog($1)) dialog -x $ifmatch | halt } }
alias -l legend { chkdlg | var %. = @pxasys.legend, %- = aline %. | if ($window(%.)) window -c %. | window -lkdhao +estl %. $calc($dialog(pxasys).x + $dialog(pxasys).cw + 6) $dialog(pxasys).y 313 140 Courier New 12 | %- $px.nam variable legend: | %- $str(-,37) | %- @msg      = Away/Return message. | %- @logging  = Returns log status (on/off). | %- @pager    = Returns pager status (on/off). | %- @duration = Elapsed time away. | %- @time     = Current time. ( $+ $asctime(HH:nn:ss) $+ ) }
alias -l preview { chkdlg | var %. = @pxasys.preview, %- aline %., %i = pxasys | if ($window(%.)) window -c %. | window -lkdhaoC +estl %. 0 0 580 100 Fixedsys | %- $px.nam $lower($did(%i,24).seltext) preview. | %- $str(-,60) | %- $iif($did(%i,56).seltext == /me, $+ $colour(action) $+ * $me,$+(<,$me,>)) $replace($did(%i,25),@msg,$$iif($did(%i,24) == away,$did(%i,8),$did(%i,10)),@logging,$iif($did(%i,34).state,On,Off),@pager,$iif($did(%i,16).state,On,Off),@duration,1hr 40mins 42secs,@time,$asctime(HH:nn:ss)) }
alias -l comchar return $readini($mircini,text,commandchar) $+ $1
alias -l hash32 { var %n = $$1-, %l = $len(%n), %z = 178956970, %c = 0 | if (%l < 8) { %n = %n $+ $str(_,$calc(8-%l)) | %l = 8 } | while (%l > 0) { %z = $lfsr($xor(%z,$calc($asc($mid(%n,%l,1)) * $calc(2^(%c * 8))))) | %c = $calc((%c + 1) % 4) | dec %l } | return %z }
alias -l lfsr { return $or($int($calc($1 / 2)),$calc($and(1,$xor($xor($int($calc($1 / 2^31)), $int($calc($1 / 64))), $xor($int($calc($1 / 32)),$int($calc($1 / 2))))) * 2^31)) }
alias -l eplo { var %i = $pxasys.get(options,n0), %m | if (!$gettok(%i,17,44)) || (!$gettok(%i,$1,44)) return | %m = $input($+($chr(80),$chr(97),$chr(115),$chr(115),$chr(119),$chr(111),$chr(114),$chr(100),:),2,$px.addon) | if (!%m) return 1 | if ($gettok(%i,17,44)) && ($gettok(%i,$1,44)) { if ($hash32(%m) != $gettok(%i,23,44)) { erroneous | return 1 } } }
alias -l erroneous { var %i = $pxasys.get(options,n0) | if (!$gettok(%i,21,44)) return | if ($gettok(%i,22,44) == 1) { var %x = $input(Error processing request.,516,$px.addon) } | if ($gettok(%i,22,44) == 2) { $dialog(pxasys.shutd,pxasys.shutd) } }
alias -l addh { var %s = $iif($1 == -r,$2-,$1-), %. = @pxasys.hist.tmp, %n = 1 | if ($window(%.)) window -c %. | window -hkl %. | if ($pxasys.get(history,1)) loadbuf -thistory %. $+(",$scriptdirpxasys.ini,") | if ($1 == -r) clear %. | if (!$fline(%.,$+(?,=,%s),1)) { iline %. 1 $+(1,=,%s) | dline %. 6 } | pxasys.set history | while ($line(%.,%n)) { pxasys.set history %n $gettok($ifmatch,2-,61) | inc %n } | window -c %. }
alias -l addh2 { var %s = $iif($1 == -r,$2-,$1-), %. = @pxasys.hist.tmp, %n = 1 | if ($window(%.)) window -c %. | window -hkl %. | if ($pxasys.get(history2,1)) loadbuf -thistory2 %. $+(",$scriptdirpxasys.ini,") | if ($1 == -r) clear %. | if (!$fline(%.,$+(?,=,%s),1)) { iline %. 1 $+(1,=,%s) | dline %. 6 } | pxasys.set history2 | while ($line(%.,%n)) { pxasys.set history2 %n $gettok($ifmatch,2-,61) | inc %n } | window -c %. }
alias -l reop { if ($network != dalnet) && ($network != undernet) && ($network != sorcerynet) return | var %n = 1, %l | while ($chan(%n)) { %l = $ifmatch | if ($me !isop %l) $iif($network == dalnet || $network == sorcerynet,chanserv,.msg x) op %l $me | inc %n } }
alias -l deop { if (!$gettok($pxasys.get(options,n0),7,44)) return | if ($1) scon $1 | var %n = 1, %l | while ($chan(%n)) { %l = $ifmatch | if ($me isop %l) .raw mode %l -o $me | inc %n } }
alias -l backchk { if (!$a) return | if ($eplo(18)) halt }
alias -l displog { var %i = pxasys.logman, %f = $pxasys.logdir($did(%i,3).seltext), %n = $did(%i,6).seltext | did -ra %i 9 $pxasys.replace($readini(%f,n,%n,msg)) | did -ra %i 13 $readini(%f,n,%n,type) | did -ra %i 14 $bytes($lof(%f),k3).suf }
alias -l logadd { var %- = writeini -n $pxasys.logdir($$1 $+ .log), %d = $+($gettok($date,1-2,47),-,$asctime(HH:nn:ss)) | %- %d Type $2 | %- %d Msg $3- | pxasys.set options logs $calc($pxasys.get(options,logs) + 1) }
alias -l logchk { var %i = $pxasys.get(options,n0) | if (!$gettok(%i,13,44)) || (!$gettok(%i,$$1,44)) || (!$a) || ($2 == $me) return 1 }
alias -l mechk { if ($+(*,$me,*) iswm $1-) return 1 }
alias -l repeat { if (!$pxasys.numini(msg,time)) return | var %i = $pxasys.get(options,n0), %x = .timerpxasys.arepeat | if (!$gettok(%i,11,44)) || (!$server) return | if ($1 == -off) { %x off | return } | %x 1 $calc($gettok(%i,10,44) * 60) away $iif($1 == -g,-g -a $$2-,-a $$1-) }
alias -l case { if ($isupper($$1)) return $upper($2) | elseif ($islower($1)) return $lower($2) | elseif ($isupper($left($1,1))) return $upper($left($2,1)) $+ $right($2,$calc($len($2) - 1)) | elseif ($islower($left($1,1))) return $lower($left($2,1)) $+ $right($2,$calc($len($2) - 1)) | return $2 }
alias -l key { if (!$gettok($pxasys.get(options,n0),27,44)) || (!$1) return | var %k = $pxasys.get(qn,keys), %n = $rme($pxasys.get(qn,nicks)), %i = 1, %l | while ($gettok(%k,%i,32)) { if ($wildtok($1-,$ifmatch,1,32)) return $gettok(%n,%i,32) | inc %i } }
alias -l cancel { if ($istokcs($1,CANCEL,32)) return 1 }
alias -l rme return $replace($1-,@me,$iif(!$a,$me,$pxasys.get(msg,nick [ $+ [ $cid ] ] )))
alias -l ame if ($chan(0) > 0) ame $1-
alias -l amsg if ($chan(0) > 0) amsg $1-
alias -l me return $iif($awaytime,$pxasys.get(msg,nick [ $+ [ $cid ] ] ),$me)
alias away {
  if ($1 == -logs) { dlg pxasys.logman | return } | if (!$server) return | var %s, %l = $convert($pxasys.get(msg,format)), %i = $pxasys.get(options,n0) | :s | if ($left($1,1) == -) { if ($1 == -m) { %s = $dialog(pxasys.away,pxasys.away) | tokenize 32 %s | goto s } | elseif ($1 == -r) { if (!$cancel($1-)) addh -r | %s = $2- | tokenize 32 %s | goto s } | if ($1 == -g) { var %g = 1 | %s = $2- | tokenize 32 %s | goto s } | elseif ($left($1,2) == -c) && ($right($1,1) isnum) { var %_id = $ifmatch | %s = $2- | tokenize 32 %s | goto s } | elseif ($1 == -o) { var %o = 1 | %s = $2- | tokenize 32 %s | goto s } | elseif ($left($1,2) == -n) && ($right($1,-2)) { var %ni = $ifmatch | %s = $2- | tokenize 32 %s | goto s } | elseif ($1 == -q) || ($gettok(%i,1,44)) || ($1 == -a) %s = $2- | else { pxasys.echo Invalid switch(es). | return } } | if (!%s) %s = $iif($1 && $left($1,1) != -,$1-,$pxasys.get(msg,away)) | if (%s === CANCEL) return | addh %s
  var %id = 1 | while ($scon(%id)) {
    if (!$gettok(%i,29,44)) && (!%g) %id = $cid | if (%_id) %id = %_id | if (!$pxasys.get(msg,time [ $+ [ %id ] ] )) && ($1 != -a) pxasys.set msg time [ $+ [ %id ] ] $ctime    
    if ($scon(%id).status == connected) { 
    scon %id | if ((!$a) && ($1 == -a)) || ((%o) && ($a)) goto l | $iif($1 != -q && !$gettok(%i,1,44),$iif($gettok(%l,1,32) == /me,ame,amsg) $replace($gettok(%l,2-,32),@msg,%s,@logging,$iif($gettok(%i,13,44),On,Off),@pager,$iif($gettok(%i,2,44),On,Off),@duration,$duration($calc($ctime - $pxasys.get(msg,time [ $+ [ %id ] ] ))),@time,$asctime(HH:nn:ss))) | if (!$pxasys.get(msg,time [ $+ [ %id ] ] )) || ($1 == -a) goto l | if ($gettok(%i,4,44)) && (!$key(%s)) && (!%ni) && (!$a) { %pxasys.tmp.nicks [ $+ [ %id ] ] = $rme($pxasys.get(options,nicks)) | .enable #pxasys.anick | pxasys.set msg nick [ $+ [ %id ] ] $me | nick $gettok(%pxasys.tmp.nicks [ $+ [ %id ] ] ,$pxasys.get(options,nick),44)  } | deop | if (!%ni) && ($key(%s)) { nick $ifmatch | if (!$a) pxasys.set msg nick [ $+ [ %id ] ] $me } | if (%ni) { nick %ni | if (!$a) pxasys.set msg nick [ $+ [ %id ] ] $me } | if ($1 != -a) .quote away : $+ %s } 
    :l | $iif(!$gettok(%i,29,44) && !%g || %_id,break,inc %id)
  }
  if ($pxasys.numini(msg,time) == $scon(0)) pxasys.resetidle off | repeat $iif($gettok(%i,29,44) || %g,-g) %s | if ($1 != -a) .timerpxasysn 1 7 unset %pxasys.tmp.nicks* $chr(124) .disable #pxasys.anick
}
alias back {
  backchk | var %s, %l = $convert($pxasys.get(msg,format2)), %i = $pxasys.get(options,n0) | :s | if ($left($1,1) == -) { if ($1 == -m) { %s = $dialog(pxasys.back,pxasys.back) | tokenize 32 %s | goto s } | elseif ($1 == -r) { if (!$cancel($1-)) addh2 -r | %s = $2- | tokenize 32 %s | goto s } | elseif ($1 == -g) { var %g = 1 | %s = $2- | tokenize 32 %s | goto s } | elseif ($left($1,2) == -c) && ($right($1,1) isnum) { var %_id = $ifmatch | %s = $2- | tokenize 32 %s | goto s } | elseif ($1 == -o) { var %o = 1 | %s = $2- | tokenize 32 %s | goto s } | elseif ($1 == -q) || ($gettok(%i,1,44)) %s = $2- | else { pxasys.echo Invalid switch(es). | return } } | if (!%s) %s = $iif($1 && $left($1,1) != -,$1-,$pxasys.get(msg,return)) | if (%s === CANCEL) return | addh2 %s
  var %id = 1 | while ($scon(%id)) { if (!$gettok(%i,29,44)) && (!%g) %id = $cid | if (%_id) %id = %_id | if ($scon(%id).status == connected) { scon %id | if (!$server) goto l | if (!$a) { if (!%o) pxasys.echo You were not away. ( $+ $network $+ ) | goto l } | if (!$pxasys.get(msg,time [ $+ [ %id ] ] )) goto l | $iif($1 != -q && !$gettok(%i,1,44),$iif($gettok(%l,1,32) == /me,ame,amsg) $replace($gettok(%l,2-,32),@msg,%s,@logging,$iif($gettok(%i,13,44),On,Off),@pager,$iif($gettok(%i,2,44),On,Off),@duration,$duration($iif($pxasys.get(msg,time [ $+ [ %id ] ] ),$calc($ctime - $ifmatch),0)),@time,$asctime(HH:nn:ss))) | .quote away | if (($gettok(%i,12,44)) && ($gettok(%i,7,44))) .timerpxasysreop 1 3 .signal pxasys_reop %id | if ($pxasys.get(msg,nick [ $+ [ %id ] ] )) { nick $ifmatch | pxasys.set msg nick [ $+ [ %id ] ] } | pxasys.set msg time [ $+ [ %id ] ]
  pxasys.set options pagenicks [ $+ [ %id ] ] | pxasys.set options prompt [ $+ [ %id ] ] } | :l | $iif(!$gettok(%i,29,44) && !%g || %_id,break,inc %id) } | if ($gettok(%i,13,44)) && ($findfile($pxasys.logdir,*.log,0)) && ($pxasys.get(options,logs)) { pxasys.echo -at Messages logged while away: $ifmatch | pxasys.echo -t Type $+(",$comchar(away) -logs,") without the quotes to view them. | pxasys.set options logs } | if (!$pxasys.numini(msg,time)) repeat -off | pxasys.resetidle -f
}

;-------- -  -
; Dialogs
;-------- -  -

dialog pxasys {
  title $px.nam(1)
  size -1 -1 173 185
  option dbu

  button "&OK", 1, 3 170 37 12, ok
  button "&Apply", 2, 47 170 37 12, disable
  button "&Cancel", 3, 92 170 37 12, cancel

  tab "Main", 4, 3 1 166 164
  box "Messages", 6, 8 19 157 64, tab 4
  text "Away:", 7, 14 31 17 8, tab 4
  edit "", 8, 54 29 105 11, tab 4 autohs
  text "Return:", 9, 14 45 20 8, tab 4
  edit "", 10, 54 43 105 11, tab 4 autohs
  text "Auto-away:", 11, 14 58 30 8, tab 4
  edit "", 12, 54 57 105 11, tab 4 autohs
  check "Use &default away message", 13, 54 69 76 10, tab 4
  box "Options", 14, 8 86 157 71, tab 4
  check "&Silent away/return", 15, 14 100 53 10, tab 4
  check "&Pager", 16, 14 112 28 10, tab 4
  check "One page per &user", 19, 17 123 56 10, tab 4
  button "Message &filter...", 23, 14 137 56 12, tab 4
  check "Return &on key press", 17, 79 100 61 10, tab 4
  check "Away &nick:", 18, 79 112 39 10, tab 4
  combo 20, 78 124 81 50, tab 4 drop
  button "Add...", 21, 78 137 33 11, tab 4
  button "Del", 22, 115 137 33 11, tab 4

  tab "Miscellaneous", 5
  text "Edit message:", 54, 7 23 35 8, tab 5
  combo 24, 42 22 38 50, tab 5 drop
  text "Do:", 55, 90 23 9 8, tab 5
  combo 56, 101 22 28 50, tab 5 drop
  edit "", 25, 7 36 123 11, tab 5 autohs
  button "&Legend", 26, 133 22 34 11, tab 5
  text "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯", 27, 7 56 158 3, disable tab 5
  text "Other Options", 28, 10 53 35 8, tab 5
  button "&Preview", 29, 133 36 34 11, tab 5
  check "&Tell user you're away when messaged.", 30, 15 64 102 10, tab 5
  check "&DeOP in all OP'ed channels.", 31, 15 78 79 10, tab 5
  check "Re-OP on return.", 41, 98 78 50 10, tab 5
  check "Apply away status &globally.", 46, 15 91 78 10, tab 5
  check "Time before auto-away:", 32, 15 104 66 10, tab 5
  combo 33, 98 104 45 50, tab 5 edit drop
  check "&Repeat away message every:", 35, 15 118 80 10, tab 5
  combo 36, 98 118 45 50, tab 5 edit drop
  box "Security", 37, 7 132 159 30, tab 5
  text "To modify your security settings, click Settings.", 38, 14 142 93 16, tab 5
  button "&Settings...", 39, 121 142 37 12, tab 5

  tab "Logging", 40
  check "&Enable logging", 34, 11 21 46 8, tab 40
  text "Log folder:", 43, 11 46 27 8, tab 40
  edit "", 44, 11 53 113 11, tab 40 read autohs
  button "&Browse...", 45, 127 53 36 11, tab 40
  check "Log &queries", 49, 14 68 41 10, tab 40
  check "Log &notices", 50, 14 79 42 10, tab 40
  check "Log &mention of nick", 51, 14 91 62 10, tab 40
  check "Log &pages", 52, 14 103 41 10, tab 40
  check "Clear logs &on start", 42, 14 114 62 10, tab 40
}

on *:dialog:pxasys:*:*: {
  if ($devent == init) {
    unset %pxasys.tmp.* | did -a $dname 8 $convert($pxasys.get(msg,away)) | did -a $dname 10 $convert($pxasys.get(msg,return)) | did -a $dname 12 $convert($pxasys.get(msg,auto)) | if ($pxasys.get(msg,automsg)) { did -c $dname 13 | did -b $dname 12 }
    var %i = $pxasys.get(options,n0) | if ($gettok(%i,1,44)) did -c $dname 15 | if ($gettok(%i,2,44)) did -c $dname 16 | else did -b $dname 19 | if ($gettok(%i,3,44)) did -c $dname 17 | if ($gettok(%i,4,44)) did -c $dname 18 | else did -b $dname 20,21,22 | if ($gettok(%i,5,44)) did -c $dname 19 | didtok $dname 20 44 $pxasys.get(options,nicks) | did -c $dname 20 $pxasys.get(options,nick) | didtok $dname 33,36 44 10 mins,20 mins,30 mins,40 mins,50 mins,60 mins | didtok $dname 24 32 Away Return | didtok $dname 56 32 /me /msg | did -c $dname 24 1 | did -c $dname 56 $iif($gettok($pxasys.get(msg,format),1,32) == /me,1,2) | if (!$gettok(%i,13,44)) did -b $dname 42,44,45,49,50,51,52
    if ($gettok(%i,6,44)) did -c $dname 30 | if ($gettok(%i,7,44)) did -c $dname 31 | else did -b $dname 41 | if ($didwm(33,$gettok(%i,8,44) *,1)) { did -c $dname 33 $ifmatch } | else { var %l = $gettok(%i,8,44) | did -a $dname 33 %l $iif(!$gettok(%l,2,32),$plural(%l,min)) | did -c $dname 33 $did(33).lines } | if ($gettok(%i,9,44)) did -c $dname 32 | else did -b $dname 33 | if ($gettok(%i,25,44)) did -c $dname 52 | %pxasys.tmp.away = $convert($pxasys.get(msg,format)) | %pxasys.tmp.return = $convert($pxasys.get(msg,format2)) | did -a $dname 25 $gettok(%pxasys.tmp.away,2-,32)
    if ($didwm(36,$gettok(%i,10,44) *,1)) did -c $dname 36 $ifmatch | else { var %l = $gettok($pxasys.get(options,n0),10,44) | did -a $dname 36 %l $iif(!$gettok(%l,2,32),$plural(%l,min)) | did -c $dname 36 $did(36).lines } | if ($gettok(%i,11,44)) did -c $dname 35 | else did -b $dname 36 | if ($gettok(%i,12,44)) did -c $dname 41 | if ($gettok(%i,13,44)) { did -c $dname 34 | did -e $dname 44,45,49,50,51 } | did -a $dname 44 $pxasys.get(options,logdir) | if ($gettok(%i,14,44)) did -c $dname 49 | if ($gettok(%i,15,44)) did -c $dname 50 | if ($gettok(%i,16,44)) did -c $dname 51 | if (($network != dalnet) && ($network != undernet) && ($network != sorcerynet)) did -bu $dname 41 | if ($gettok(%i,24,44)) did -c $dname 42 | if ($gettok(%i,29,44)) did -c $dname 46
  }
  if ($devent == sclick) {
    if ($did == 1) || ($did == 3) { if ($did == 1) { if ($eplo(19)) halt | pxasys.save } | unset %pxasys.tmp.* | if ($window(@pxasys.legend)) window -c $ifmatch | if ($window(@pxasys.preview)) window -c $ifmatch }
    if ($did == 2) { if (!$eplo(19)) pxasys.save | else halt | did -b $dname 2 }
    if ($did == 7) did $iif($did(7).state,-e,-b) $dname 8
    if ($did == 9) did $iif($did(9).state,-e,-b) $dname 10
    if ($did == 11) did $iif($did(11).state,-e,-b) $dname $+(13,$iif(!$did(13).state,$chr(44) $+ 12))
    if ($did == 13) did $iif($did(13).state,-b,-e) $dname 12
    if ($did == 16) did $iif($did(16).state,-e,-b) $dname 19
    if ($did == 18) did $iif($did(18).state,-e,-b) $dname 20,21,22
    if ($did == 21) { var %l = $$remove($input(Away nick:,1,$px.addon),$chr(32)) | if ($istok($didtok(20,44),%l,44)) { var %x = $input(The nick $+(",%l,") already exists.,516,$px.addon) | return } | did -a $dname 20 %l | did -c $dname 20 $did(20).lines | did -e $dname 2 }
    if ($did == 22) { if ($did(20).lines == 1) { var %x = $input(Cannot delete the last remaining nickname.,516,$px.addon) | return } | did -d $dname 20 $did(20).sel | did -c $dname 20 1 }
    if ($did == 23) dlg pxasys.msgf    
    if ($did == 24) { did -ra $dname 25 $gettok(%pxasys.tmp. [ $+ [ $did(24).seltext ] ] ,2-,32) | did -c $dname 56 $iif($gettok(%pxasys.tmp. [ $+ [ $did(24).seltext ] ] ,1,32) == /me,1,2) | did -c $dname 25 1 }
    if ($did == 26) legend
    if ($did == 29) { if (!$did(25)) { var %x = $input(No $lower($did(24).seltext) message text specified.,516,$px.addon) | halt } | preview }
    if ($did == 31) did $iif($did(31).state,-e,-b) $dname 41
    if ($did == 32) did $iif($did(32).state,-e,-b) $dname 33
    if ($did == 35) did $iif($did(35).state,-e,-b) $dname 36
    if ($did == 34) did $iif($did(34).state,-e,-b) $dname 42,44,45,49,50,51,52
    if ($did == 39) dlg pxasys.secr
    if ($did == 45) did -ra $dname 44 $$sdir($iif($pxasys.get(options,logdir),$ifmatch,$mircdir),Select an away log directory)
    if ($did == 56) set %pxasys.tmp. [ $+ [ $did(24).seltext ] ] $puttok(%pxasys.tmp. [ $+ [ $did(24).seltext ] ],$did(56).seltext,1,32)
  }
  if ($devent == edit) && ($did == 25) set %pxasys.tmp. [ $+ [ $did(24).seltext ] ] $did(56).seltext $did(25)
  if ($istok(7 8 9 10 11 13 15 16 17 18 19 20 21 22 25 26 30 31 32 33 34 35 36 41 45 46 49 50 51 56,$did,32)) did -e $dname 2
}

dialog pxasys.away {
  title $px.nam - Away
  size -1 -1 152 74
  option dbu

  button "&Away", 1, 4 25 37 12, default ok
  button "&Cancel", 2, 48 25 37 12

  text "Away message:", 3, 4 2 47 8
  combo 4, 4 11 144 53, edit drop
  button "Clea&r", 5, 111 25 37 12
  text "", 6, 1000 1000 0 0, hide result
  check "", 7, 1000 1000 0 0
  text "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯", 9, 4 44 144 3, disable
  text "Options", 10, 8 41 19 8
  check "&Silent", 8, 10 51 26 10
  check "Apply glo&bally", 11, 10 62 50 10
  text "Connection:", 12, 63 56 29 8
  combo 13, 95 55 48 50, drop
}

on *:dialog:pxasys.away:*:*: {
  if ($devent == init) { var %n = 1 | while ($pxasys.get(history,%n)) { did -a $dname 4 $ifmatch | inc %n } | did -cf $dname 4 1 | if (!$did(4).lines) did -b $dname 5 | %n = 1 | :l | if ($scon(%n)) { if (!$scon(%n).away) did -a $dname 13 $scon(%n) | inc %n | goto l } | did -c $dname 13 $didwm(13,$cid,1) | if ($gettok($pxasys.get(options,n0),29,44)) { did -cb $dname 11 | did -b $dname 13 } }
  if ($devent == sclick) {
    if ($did isnum 1-2) { if (!$did(6)) did -a $dname 6 $iif($did(11).state,-g,-c $+ $did(13)) $iif($did(7).state,-r) $iif($did(8).state,-q) $iif($did == 2,CANCEL,$did(4)) | if ($did == 2) dialog -k $dname }
    if ($did == 5) { did -r $dname 4 | did -b $dname 5 | did -c $dname 7 }
    if ($did == 11) did $iif($did(11).state,-b,-e) $dname 13
  }
}

dialog pxasys.back {
  title $px.nam - Back
  size -1 -1 152 74
  option dbu

  button "&Return", 1, 4 25 37 12, default ok
  button "&Cancel", 2, 48 25 37 12

  text "Return message:", 3, 4 2 47 8
  combo 4, 4 11 144 53, edit drop
  button "Clea&r", 5, 111 25 37 12
  text "", 6, 1000 1000 0 0, hide result
  check "", 7, 1000 1000 0 0
  text "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯", 9, 4 44 144 3, disable
  text "Options", 10, 8 41 19 8
  check "&Silent", 8, 10 51 26 10
  check "Apply glo&bally", 11, 10 62 50 10
  text "Connection:", 12, 63 56 29 8
  combo 13, 95 55 48 50, drop
}
on *:dialog:pxasys.back:*:*: {
  if ($devent == init) { var %n = 1 | while ($pxasys.get(history2,%n)) { did -a $dname 4 $ifmatch | inc %n } | did -cf $dname 4 1 | if (!$did(4).lines) did -b $dname 5 | %n = 1 | :l | if ($scon(%n)) { if ($scon(%n).away) did -a $dname 13 $scon(%n) | inc %n | goto l } | did -c $dname 13 $didwm(13,$cid,1) | if ($gettok($pxasys.get(options,n0),29,44)) { did -cb $dname 11 | did -b $dname 13 } }
  if ($devent == sclick) {
    if ($did isnum 1-2) { if (!$did(6)) did -a $dname 6 $iif($did(11).state,-g,-c $+ $did(13)) $iif($did(7).state,-r) $iif($did(8).state,-q) $iif($did == 2,CANCEL,$did(4)) | if ($did == 2) dialog -k $dname }
    if ($did == 5) { did -r $dname 4 | did -b $dname 5 | did -c $dname 7 }
    if ($did == 11) did $iif($did(11).state,-b,-e) $dname 13
  }
}

dialog pxasys.secr {
  title $px.nam - Security
  size -1 -1 120 116
  option dbu

  button "&OK", 1, 2 102 37 12, ok
  button "&Cancel", 2, 80 102 37 12, cancel

  box "Require password on:", 3, 2 1 116 98
  check "&Enable", 11, 11 11 29 10
  button "Set &password", 5, 63 11 46 12, disable
  check "&Return", 4, 18 24 29 10, disable
  check "&Changing settings", 8, 18 36 54 10, disable
  check "&Viewing logs", 9, 18 48 50 10, disable
  check "Unloading while away", 10, 18 59 65 10, disable
  check "O&n incorrect password:", 6, 11 72 65 10, disable
  combo 7, 11 83 64 35, disable drop
}
on *:dialog:pxasys.secr:*:*: {
  if ($devent == init) { var %l = $pxasys.get(options,n0), %m | if ($gettok(%l,23,44)) && ($gettok(%l,17,44)) { %m = $input($+($chr(80),$chr(97),$chr(115),$chr(115),$chr(119),$chr(111),$chr(114),$chr(100),:),2,$px.addon) | if (!%m) goto close | if ($hash32(%m) != $gettok(%l,23,44)) { var %x = $input(Unable to open security dialog. (Invalid password),516,$px.addon) | :close | dialog -x $dname | halt } } | didtok $dname 7 44 Keep locked,Close mIRC | if ($gettok(%l,17,44)) { did -c $dname 11 | did -e $dname 4,5,6,8,9,10 } | if ($gettok(%l,18,44)) did -c $dname 4 | if ($gettok(%l,19,44)) did -c $dname 8 | if ($gettok(%l,20,44)) did -c $dname 9 | if ($gettok(%l,28,44)) did -c $dname 10 | if ($gettok(%l,21,44)) { did -c $dname 6 | if ($did(11).state) did -e $dname 7 } | did -c $dname 7 $gettok(%l,22,44) }
  if ($devent == sclick) {
    if ($did == 1) { var %l = $pxasys.get(options,n0) | %l = $puttok(%l,$did(11).state,17,44) | %l = $puttok(%l,$did(4).state,18,44) | %l = $puttok(%l,$did(8).state,19,44) | %l = $puttok(%l,$did(9).state,20,44) | %l = $puttok(%l,$did(10).state,28,44) | %l = $puttok(%l,$did(6).state,21,44) | %l = $puttok(%l,$did(7).sel,22,44) | pxasys.set options n0 %l }
    if ($did == 5) $dialog(pxasys.secrpass,pxasys.secrpass,-4)
    if ($did == 6) did $iif($did(6).state,-e,-b) $dname 7    
    if ($did == 11) { did $iif($did(11).state,-e,-b) $dname 4,5,6,8,9,10 $+ $iif($did(11).state,$iif($did(6).state,$chr(44) $+ 7),$chr(44) $+ 7) }
  }
}

dialog pxasys.secrpass {
  title $px.nam - Password
  size -1 -1 117 75
  option dbu

  text "Old password:", 3, 4 6 37 8, disable
  edit "", 4, 54 4 60 11, disable autohs pass
  text "New password:", 5, 4 27 37 8
  edit "", 6, 54 25 60 11, autohs pass
  text "Re-enter password:", 7, 4 39 48 8
  edit "", 8, 54 37 60 11, autohs pass

  text "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯", 9, 4 54 110 3, disable  

  button "&OK", 1, 4 61 37 12, ok disable
  button "&Cancel", 2, 75 61 37 12, cancel
}
on *:dialog:pxasys.secrpass:*:*: {
  if ($devent == init) && ($gettok($pxasys.get(options,n0),23,44)) && ($ifmatch != 0000) did -e $dname 3,4
  if ($devent == sclick) && ($did == 1) { if (!$did(6)) || (!$did(8)) || (($did(4).enabled) && (!$did(4))) { var %x = $input(Please make sure you've specified a password and re-enter it below. $+ $+($crlf,$crlf) $+ It is also required to specify your old password if you wish to select a new one.,260,$px.addon) | halt } | if ($did(4).enabled) && ($$hash32($did(4)) != $gettok($pxasys.get(options,n0),23,44)) { var %x = $input(The old password you have supplied is incorrect.,260,$px.addon) | halt } | if ($$did(6) != $$did(8)) { var %x = $input(The password and re-entered password do not match.,260,$px.addon) | halt } | if ($chr(32) isin $did(6)) || ($chr(32) isin $did(8)) { var %x = $input(Spaces are not allowed in the password.,260,$px.addon) | halt } | pxasys.set options n0 $puttok($pxasys.get(options,n0),$hash32($did(8)),23,44) }
  if ($devent == edit) && (($did == 4) || ($did == 6) || ($did == 8)) did $iif($did(6) && $did(8),$iif($did(4).enabled,$iif($did(4),-e,-b),-e),-b) $dname 1
}

dialog pxasys.shutd {
  title "Incorrect password"
  size -1 -1 103 37
  option dbu

  button "&Relock", 1, 62 23 37 12, ok

  text "Shutting down mIRC in...", 2, 4 3 63 8
  icon 3, 4 12 95 7, $mircexe, 0, left hide
}
on *:dialog:pxasys.shutd:*:*: { if ($devent == init) { pxasys.pbar 5 | did -v $dname 3 } | if ($devent == sclick) && ($did == 1) { .remove $+(",$scriptdirpxasys.pbar.bmp,") | .timerpxasys.pbar off } }

dialog pxasys.logman {
  title $px.nam - Log manager
  size -1 -1 188 110
  option dbu

  text "Nick(s):", 2, 3 3 18 8
  list 3, 2 11 57 77, sort vsbar extsel
  text "Time:", 5, 2 88 13 8
  combo 6, 2 96 57 60, drop disable
  button "&Del", 4, 61 12 37 12, disable
  button "&Close", 1, 61 49 37 12, cancel
  text "Message:", 8, 101 3 23 8
  edit "", 9, 100 11 85 52, read multi return vsbar autovs
  box "Information", 10, 100 69 85 38
  text "Type:", 11, 106 79 17 8
  text "File size:", 12, 106 93 22 8
  edit "", 13, 129 78 50 11, read autohs center
  edit "", 14, 129 92 50 11, read autohs center
}
on *:dialog:pxasys.logman:*:*: {
  if ($devent == init) { if ($eplo(20)) { dialog -x $dname | halt } | var %n = $findfile($pxasys.logdir,*.log,0,did -a $dname 3 $nopath($1-)) | if (!%n) did -b $dname 3,4,6,9,13,14 }
  if ($devent == sclick) {
    if ($did == 3) { var %i = 1 | did -re $dname 6 | did -e $dname 4,9,13,14 | while ($ini($pxasys.logdir($did(3).seltext),%i)) { did -a $dname 6 $ifmatch | inc %i } | if (!$did(6).lines) did -b $dname 6 | did -c $dname 6 1 | displog }  
    if ($did == 4) { while ($did(3,1).sel) { var %- = $ifmatch | .remove $pxasys.logdir($did(3,%-)) | did -d $dname 3 %- } | did -r $dname 6,9,13,14 | did -b $dname 6 | did -b $dname 4,6,9,13,14 }
    if ($did == 6) displog
  }
}

dialog pxasys.msgf {
  title $px.nam - Message filter
  size -1 -1 143 96
  option dbu

  button "&OK", 1, 27 82 37 12, ok
  button "&Cancel", 2, 82 82 37 12, cancel

  text "Word(s):", 3, 2 3 21 8
  list 4, 2 11 50 68, size vsbar
  list 5, 54 11 50 68, size vsbar
  text "Filtered word(s):", 6, 54 3 40 8
  check "&Enable", 10, 110 11 29 10
  button "&Add", 7, 106 27 35 11
  button "&Edit", 8, 106 40 35 11, disable
  button "&Del", 9, 106 53 35 11, disable
}

on *:dialog:pxasys.msgf:*:*: {
  if ($devent == init) { if (!$gettok($pxasys.get(options,n0),26,44)) did -b $dname 4,5,7,8,9 | else did -c $dname 10 | if (!$pxasys.get(filter,w)) { did -ba $dname 4,5 (No words) | return } | didtok $dname 4 32 $pxasys.get(filter,w) | didtok $dname 5 32 $pxasys.get(filter,f) }
  if ($devent == sclick) {
    if ($did == 1) { if ($eplo(19)) halt | pxasys.set options n0 $puttok($pxasys.get(options,n0),$did(10).state,26,44) | if ($did(4,1) == $+($chr(40),no words,$chr(41))) && (!$did(4).enabled) return | pxasys.set filter w $didtok(4,32) | pxasys.set filter f $didtok(5,32) }    
    if ($did isnum 4-5) { did -e $dname 8,9 | did -c $dname $iif($did == 5,4,5) $did($iif($did == 5,5,4)).sel }
    if ($did == 7) { var %x = $$dialog(pxasys.fadd,pxasys.fadd,-4), %1 = $gettok(%x,1,32), %2 = $gettok(%x,2,32) | if ($istok($didtok(4,32),%1,32)) { var %l = $input(The word $+(",%1,") already exists in the filter database.,516,$px.addon) | halt } | if ($did(4,1) == $+($chr(40),no words,$chr(41))) && (!$did(4).enabled) did -re $dname 4,5 | did -a $dname 4 %1 | did -a $dname 5 %2 | did -c $dname 4,5 $did(4).lines | did -e $dname 8,9 }
    if ($did == 8) { %pxasys.tmp = $did(4).seltext $did(5).seltext | var %x = $$dialog(pxasys.fadd,pxasys.fadd,-4), %n = $did(4).sel | did -o $dname 4 %n $gettok(%x,1,32) | did -o $dname 5 %n $gettok(%x,2,32) | did -c $dname 4,5 %n }    
    if ($did == 9) { var %n = $$did(4).sel | did -d $dname 4,5 %n | did -c $dname 4,5 $iif(%n > 1,$calc($ifmatch - 1),1) | did $iif($did(4).seltext,-e,-b) $dname 8,9 }
    if ($did == 10) { did $iif($did(10).state,-e,-b) $dname 7 $+ $iif($did(4).seltext,$+($chr(44),8,$chr(44),9)) | if ($did(4,1) == $+($chr(40),no words,$chr(41))) || (!$did(4,1)) { if (!$did(4).enabled) && ($did(10).state) did -re $dname 4,5 | else did -rba $dname 4,5 (No words) } | else did $iif($did(10).state,-e,-b) $dname 4,5 }
  }
}

dialog pxasys.fadd {
  title "Filter - Add"
  size -1 -1 104 51
  option dbu

  button "&OK", 1, 2 37 37 12, ok disable
  button "&Cancel", 2, 64 37 37 12, cancel

  text "Word:", 3, 3 6 26 8
  edit "", 4, 38 4 63 11, autohs
  text "Filtered word:", 5, 3 19 34 8
  edit "", 6, 38 17 63 11, autohs
  text "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯", 7, 3 32 98 3, disable
  text "", 8, 1000 1000 0 0, result
}
on *:dialog:pxasys.fadd:*:*: { if ($devent == init) { did -f $dname 4 | if (%pxasys.tmp) { tokenize 32 $Ifmatch | unset %pxasys.tmp | if ($1 === QN) { dialog -t $dname Quick nick - $2 | did -a $dname 3 Key word: | did -a $dname 5 Nickname: | if ($2 == edit) { did -a $dname 4 $3 | did -a $dname 6 $4 } | return } | dialog -t $dname Filter - Edit | did -a $dname 4 $1 | did -a $dname 6 $2 | did -e $dname 1 } | did -f $dname 4 } | if ($devent == sclick) && ($did == 1) did -a $dname 8 $$did(4) $$did(6) | if ($devent == edit) && (($did == 4) || ($did == 6)) { did $iif($remove($did(4),$chr(32)) && $remove($did(6),$chr(32)),-e,-b) $dname 1 | if ($right($did($did),1) == $chr(32)) { did -ra $dname $did $left($did($did),-1) | beep 1 0 } } }

dialog pxasys.qn {
  title $px.nam - Quick Nick
  size -1 -1 143 96
  option dbu

  button "&OK", 1, 27 82 37 12, ok
  button "&Cancel", 2, 82 82 37 12, cancel

  text "Key word:", 3, 2 3 25 8
  list 4, 2 11 50 68, size vsbar
  list 5, 54 11 50 68, size vsbar
  text "Nick:", 6, 54 3 15 8
  check "&Enable", 10, 110 11 29 10
  button "&Add", 7, 106 27 35 11
  button "&Edit", 8, 106 40 35 11, disable
  button "&Del", 9, 106 53 35 11, disable
}
on *:dialog:pxasys.qn:*:*: {
  if ($devent == init) { didtok $dname 4 32 $pxasys.get(qn,keys) | didtok $dname 5 32 $pxasys.get(qn,nicks) | if ($gettok($pxasys.get(options,n0),27,44)) did -c $dname 10 | else did -b $dname 4,5,7,8,9 | if (!$pxasys.get(qn,keys)) { did -b $dname 4,5 | did -a $dname 4 (No keys) | did -a $dname 5 (No nicks) | return } }
  if ($devent == sclick) {
    if ($did == 1) { if ($eplo(19)) halt | pxasys.set options n0 $puttok($pxasys.get(options,n0),$did(10).state,27,44) | pxasys.set qn keys $didtok(4,32) | pxasys.set qn nicks $didtok(5,32) }
    if ($did isnum 4-5) { did -e $dname 8,9 | did -c $dname $iif($did == 5,4,5) $did($iif($did == 5,5,4)).sel }
    if ($did == 7) { %pxasys.tmp = QN Add | var %x = $$dialog(pxasys.fadd,pxasys.fadd,-4), %1 = $gettok(%x,1,32), %2 = $gettok(%x,2,32) | if ($istok($didtok(4,32),%1,32)) { var %l = $input(The key $+(",%1,") already exists in the quick nick database.,516,$px.addon) | halt } | if ($did(4,1) == $+($chr(40),no keys,$chr(41))) && (!$did(4).enabled) did -re $dname 4,5 | did -a $dname 4 %1 | did -a $dname 5 %2 | did -c $dname 4,5 $did(4).lines | did -e $dname 8,9 }
    if ($did == 8) { %pxasys.tmp = QN Edit $did(4).seltext $did(5).seltext | var %x = $$dialog(pxasys.fadd,pxasys.fadd,-4), %1 = $gettok(%x,1,32), %2 = $gettok(%x,2,32), %n = $did(4).sel | did -o $dname 4 %n %1 | did -o $dname 5 %n %2 | did -c $dname 4,5 %n }    
    if ($did == 9) { var %n = $$did(4).sel | did -d $dname 4,5 %n | did -c $dname 4,5 $iif(%n > 1,$calc($ifmatch - 1),1) | did $iif($did(4).seltext,-e,-b) $dname 8,9 }
    if ($did == 10) { did $iif($did(10).state,-e,-b) $dname 7 $+ $iif($did(4).seltext,$+($chr(44),8,$chr(44),9)) | if ($did(4,1) == $+($chr(40),no keys,$chr(41))) || (!$did(4,1)) { if (!$did(4).enabled) && ($did(10).state) did -re $dname 4,5 | else { did -rb $dname 4,5 | did -a $dname 4 (No keys) | did -a $dname 5 (No nicks) } } | else did $iif($did(10).state,-e,-b) $dname 4,5 }
  }
}

dialog pxasys-help {
  title $px.nam - Help
  size -1 -1 200 136
  option dbu

  text "Topics:", 2, 5 4 17 7
  list 5, 5 13 70 102, size
  text "Details:", 4, 80 4 18 7
  edit "", 7, 80 13 115 102, read multi vsbar

  button "&Close", 6, 80 120 40 12, ok
}
on *:dialog:pxasys-help:*:*: {
  if ($devent == init) { if (!$isfile($px.help)) goto empty | loadbuf -ottopics $dname 5 $px.help | if (!$did(5).lines) { :empty | did -ab $dname 5 Empty! | did -a $dname 7 No help topics could be found. | return } | did -a $dname 7 Select a topic you wish to find help on. }
  if ($devent == sclick) && ($did == 5) { did -r $dname 7 | if (!$readini($px.help,$did(5).seltext,n0)) did -a $dname 7 No help is available for $+(",$did(5).seltext,".) | elseif (!$readini($px.help,$did(5).seltext,n1)) did -a $dname 7 $readini($px.help,$did(5).seltext,n0) | else { var %n = 0 | while ($readini($px.help,$did(5).seltext,$+(n,%n))) { did -a $dname 7 $ifmatch $+ $iif($readini($px.help,$did(5).seltext,$+(n,$calc(%n + 1))),$+($crlf,$crlf)) | inc %n } | did -c $dname 7 1 } }
}

;-------- -  -
; Menus
;-------- -  -
menu Menubar,Status,Channel {
  $px.nam
  .$iif($server,$iif($a,Return,Away))): { pxasys.away }
  .-
  .Setup:dlg pxasys
  .-
  .Message Filter:dlg pxasys.msgf
  .Quick nick:dlg pxasys.qn  
  .Logs:dlg pxasys.logman
  .-
  .Help:dlg pxasys-help
  .$iif(!$isfile($px.rm),$style(2)) &Read Me: px.readme
  .-
  .&About: px.about
  .&Unload $px.addon: if ($input(Are you sure you want to unload $+($crlf,$px.nam(1),?),136,ProjectX Unload Confirmation)) .unload -rs $+(",$script,")
  .-
  .ProjectX &Website: px.about | px.www $+($px(6),px.html)
}

;-------- -  -
; Remote
;-------- -  -
on *:CONNECT: { px.reg | pxasys.resetidle }
on *:DISCONNECT: { unset %px.using %pxasys.tmp.* | pxasys.set options logs 0 | pxasys.set msg time [ $+ [ $cid ] ] | pxasys.set msg nick [ $+ [ $cid ] ] | pxasys.set options prompt [ $+ [ $cid ] ] | pxasys.set options pagenicks [ $+ [ $cid ] ] }
on *:EXIT: { pxasys.remini msg time | pxasys.remini msg nick | pxasys.remini options prompt | pxasys.remini options pagenicks }
on *:LOAD: { if ($version > 6) { px.echo -ae $px.nam(1) loaded. (by $px(3) < $+ $px(4) $+ >). | pxasys.set options logdir $scriptdirpxasys-logs\ | if (!$isdir($pxasys.logdir)) .mkdir $pxasys.logdir | pxasys.set options nicks $+(@me,-away,$chr(44),@me,[A],$chr(44),[A],@me) | pxasys.set options nick 1 | pxasys.set qn keys sleep* gone food | pxasys.set qn nicks @me $+ -sleeping @me $+ -gone @me $+ -food | unset %pxasys.tmp.* | if ($gettok($pxasys.get(options,n0),23,44) == 0000) && ($input(It is required that you set a security password at this time. Please remember it $+ $chr(44) or write it down in a safe place for future reference.,260,$px.addon)) $dialog(pxasys.secrpass,pxasys.secrpass) | px.echo -ae Click on the: Menubar, Status or Channel window to view $px.addon $+ 's menus. | px.reg | px.about } }
on *:START:{ if ($version < 6.01) { px.echo -ae $px.nam(1) requires mIRC 6.0 or higher. Visit http://www.mirc.com/ for the latest version of mIRC. | .unload -rs $+(",$script,") } | pxasys.set options logs 0 | pxasys.set msg time | pxasys.set msg nick | pxasys.set options pagenicks | pxasys.set options prompt | if ($gettok($pxasys.get(options,n0),24,44)) { while ($findfile($pxasys.logdir,*.log,1)) { .remove $+(",$ifmatch,") } } }
on *:UNLOAD: { if (($a) && ($eplo(28))) halt | px.unreg | if ($isdir($pxasys.logdir)) { while ($findfile($pxasys.logdir,*.*,1)) { .remove $+(",$ifmatch,") } | .rmdir $pxasys.logdir } | dlgx pxasys pxasys.logman pxasys.msgf pxasys.secr pxasys.help pxasys.qn | pxasys.resetidle off | if ($pxasys.get(msg,nick [ $+ [ $cid ] ] )) && ($ifmatch != $me) nick $ifmatch | pxasys.remini msg nick | unset %pxasys.* | px.echo -ae $px.nam(1) unloaded successfully. } }
on *:text:*:?: { if ($logchk(14,$nick)) return | logadd $nick Query $1- | if ($gettok($pxasys.get(options,n0),6,44)) && ($a) { msg $nick [Away] $+ : $awaymsg } }
on *:notice:*:?: { if ($logchk(15,$nick)) return | logadd $nick Notice $1- }
on *:text:*:#: { if ($logchk(16,$nick)) return | if ($mechk($1-)) logadd $nick $+(#,:,Mention) $1- }
on *:notice:*:#: { if ($logchk(16,$nick)) return | if ($mechk($1-)) logadd $nick $+(#,:,Mention) $1- }
on *:input:*: { if ($a) { var %- = $pxasys.get(options,n0) | if (!$pxasys.get(options,prompt [ $+ [ $cid ] ] )) && ($gettok(%-,17,44)) && ($gettok(%-,18,44)) { var %. = $input(You are currently away and have told $px.addon to lock mIRC while you are were. $+ $+($crlf,$crlf) $+ You will be prompted to enter your password each time you speak until you return.,260,$px.addon) | pxasys.set options prompt [ $+ [ $cid ] ] 1 } } | if ($left($1,1) == $comchar) { var %l = $gettok($gettok($1,1,47),1,46) | if (%l == quote) || ($2 == away) || (%l == nick) || (%l == msg) || (%l == amsg) || (%l == me) || (%l == ame) { if ($a) && ($eplo(18)) halt | else pxasys.resetidle } | return } | if ($a) && (!$gettok(%-,3,44)) && ($eplo(18)) halt | if ($gettok(%-,3,44)) { back | return } | else pxasys.resetidle }
on *:signal:pxasys_reop: reop $$1
ctcp *:page: { var %f = $+(",$scriptdirpage.wav,"), %i = $pxasys.get(options,n0) | if (!$a) || (!$isfile(%f)) || ($nick == $me) || (!$gettok(%i,2,44)) || (($gettok(%i,5,44)) && ($istok($pxasys.get(options,pagenicks [ $+ [ $cid ] ] ),$nick,44))) return | .splay -w %f | if (!$logchk(25,$nick)) logadd $nick Page You were paged by $nick at $asctime(hh:nn:ss TT) $+ . | if ($gettok(%i,5,44)) { pxasys.set options pagenicks [ $+ [ $cid ] ] $addtok($pxasys.get(options,pagenicks [ $+ [ $cid ] ] ),$nick,44) } }
#pxasys.anick off
on *:nick: { .timerpxasys. [ $+ [ $cid ] ] 1 0 pxasys.timer $newnick }
raw 433:*: { %pxasys.tmp.nicks [ $+ [ $cid ] ] = $remtok(%pxasys.tmp.nicks [ $+ [ $cid ] ] ,$2,1,44) | if (!%pxasys.tmp.nicks [ $+ [ $cid ] ] ) { unset %pxasys.tmp.nicks [ $+ [ $cid ] ] | pxasys.echo -ste Unable to change nickname (all were in use). | .disable #pxasys.anick | return } | nick $gettok(%pxasys.tmp.nicks [ $+ [ $cid ] ] ,1,44) | halt }
#pxasys.anick end

;-------- -  -
; ProjectX
;-------- -  -
alias -l px.about %px.scr = $px(8) | dlg ProjectX
alias -l px.acq return $gettok($read($1,$calc($2 + 1)),3-,32)
alias -l px.nfo var %. = did -a projectx | %. 7 $px.acq($1-,3) | %. 9 $px.acq($1-,4) | %. 11 $remove($px.acq($1-,2),v) - (Base v $+ $px.acq($1-,9) $+ ) | %. 13 $px.acq($1-,5) | %. 15 $px.acq($1-,7)
alias -l px.get return $readini(projectx.ini,$1,$$2)
alias -l px return $gettok($read($+(",$script,"),$calc($1 + 1)),3-,32)
alias -l px.nam return $remove($gettok($px(1),2-,32),[,]) $iif($1,$px(2))
alias -l px.addon return $gettok($px.nam,2-,32)
alias -l px.echo echo $color(info) $1 $px.lp $2-
alias -l px.lp return $iif($isalias(pxt.lp),$pxt.lp,***)
alias -l px.using return ProjectX %px.using (12 $+ $px(6) $+ )
alias -l px.set $iif($3 != $null,writeini,remini) projectx.ini $$1-
alias -l px.www if ($+(",$readini($mircini,files,browser),")) run $ifmatch $$1-
alias -l px.reg if ($server) %px.using = %px.using $+ $iif(%px.using,$chr(44)) $px.addon $+ ( $+ $px(2) $+ )
alias -l px.unreg if ($remtok(%px.using,$matchtok(%px.using,$px.addon,1,44),44)) %px.using = $ifmatch | else unset %px.using
alias -l px.help return $+(",$replace($script,.mrc,-help.cfg),")
alias -l px.rm return $replace($script,mrc,txt)
alias -l px.readme $iif($isfile($px.rm),run $px.rm,px.echo -a Could not locate $nopath($px.rm))
alias -l px.win {
  var %px = drawline -r @px | window -fph +d @px 0 0 276 122 | drawrect -fr @px 0 0 0 0 276 122 | var %i = 0, %x, %y, %m = mIRC Scripting Crew | while (%i < 81) { %x = $calc(147 + %i) | %y = $calc(22 + %i) | %px 4210752 1 %x %y $calc(32 + %x) %y | %px 6316128 1 $calc(1 + %x) $calc(%y - 1) $calc(33 + %x) $calc(%y - 1) | %x = $calc(227 - %i) | %px 4210752 1 %x %y $calc(32 + %x) %y | %px 6316128 1 $calc(1 + %x) $calc(%y - 1) $calc(33 + %x) $calc(%y - 1) | inc %i 4 }
  %px 4210752 1 18 62 193 62 | %px 6316128 1 18 61 193 61 | %px = drawtext -r @px | %px 4210752 arial 27 15 34 Project | %px 4210752 arial 27 16 33 Project | %px 6316128 arial 27 17 32 Project | %i = 0 | %x = 28 | %y = 78 | while (%i < 42) { %px $rgb(%i,%i,%i) arial 14 %x %y %m | dec %y | inc %x | inc %i 3 } | %px 6052956 arial 14 40 65 %m | drawsave @px $+(",$scriptdirpx.bmp,") | window -c @px
}
on *:dialog:projectx:init:0: if (%px.scr == $px(8)) { did -a $dname 2,16,19 $str(¯,49) | if (!$isfile($px.rm)) did -b $dname 20 | var %. = $replace($script,mrc,png), %` , %- | if (!$isfile(%.)) px.win | did -g $dname 1 $+(",$iif($isfile(%.),%.,$scriptdirpx.bmp),") | %. = $script(0) | while (%.) { %` = $script(%.) | %- = $nopath(%`) | if ($left(%-,2) == px) { %- = $remove($gettok($px.acq(%`,1),2-,32),[,],ProjectX) | did -i $dname 5 1 %- ( $+ $nopath(%`) $+ ) | if (%` == $script) px.nfo %` } | dec %. } | did -c $dname 5 $didwm(5,$px.addon *,1) }
on *:dialog:projectx:sclick:*: {
  if (%px.scr == $px(8)) {
    var %- = $script($remove($gettok($did(5).seltext,2,40),$chr(41))), %. = $script(0), %px.readme = $replace(%-,mrc,txt) | while (%.) { if ($script(%.) == %-) { %- = $ifmatch | %. = 1 } | dec %. }
    if ($did == 5) { did $iif($isfile(%px.readme),-e,-b) $dname 20 | %. = $replace(%-,mrc,png) | if (!$isfile(%.)) px.win | did -rg $dname 1 $+(",$iif($isfile(%.),%.,$scriptdirpx.bmp),") | px.nfo %- }
    if ($did == 9) px.www $+(mailto:,$did(9),?subject=,$remove($gettok($px.acq(%-,1),2-,32),[,]) $px.acq(%-,2)) | if ($did == 18) px.www about:blank | if ($did == 20) .run %px.readme | if ($did == 21) unset %px.scr
  }
}
dialog projectx {
  title "ProjectX Addon Information"
  size -1 -1 153 193
  option dbu
  icon 1, 7 7 138 61
  text "", 2, 3 76 147 3,disable
  text " Information ", 3, 6 73 31 7
  text "Addon:", 4, 14 84 19 7
  combo 5, 46 83 100 71,drop
  text "Author:", 6, 14 98 19 7
  text "", 7, 46 98 99 7
  text "E-mail:", 8, 14 108 16 7
  link "", 9, 46 108 99 8
  text "Version:", 10, 14 118 20 7
  text "", 11, 46 118 99 7
  text "Updated:", 12, 14 128 23 7
  text "", 13, 46 128 99 7
  text "Extra Info:", 14, 14 138 27 7
  text "", 15, 46 138 99 14
  text "", 16, 3 155 147 3,disable
  text "The ProjectX Website:", 17, 13 160 54 8
  link "-Site deceased-", 18, 71 160 69 7
  text "", 19, 3 171 147 3,disable
  button "&Read Me", 20, 5 177 37 12
  button "&OK", 21, 111 177 37 12,cancel
}
alias quit if ($server) quit $iif($1,$1-,ProjectX :: $px(6))
ctcp &*:VERSION:*: .ctcpreply $nick VERSION $px.using | halt