aIRC — File Browser

aIRCv0.8.69 / aIRCv0.8.69 / script / partyline4.mrc

partyline4.mrc — 26.89 KB — Download this file

;/**********************************************************************
; *
; * aIRC
; * Partyline (commands)
; *
; **********************************************************************/

;;
;
; -( CMDS1 )-
;
;;

; +bot +t
; +bot <handle> <address[:telnet-port[/relay-port]]> [host]
alias +bot { _useredit.echocode +bot $1- }
alias _cmd.+bot {
  if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 +bot }
  if ($2 == $null) { return 517 }
  if ($_isuser($2)) { return 420 $2 }
  if ($_isinvalidinitialchar4handle($2)) { return 590 $left($2,1) }
  if ($_validateuser(3,$2,$null)) { return $ifmatch $2 }
  var %a = $null ,%tp = 3333,%rp = 3333
  if ($gettok($3,1,58)) { %a = $ifmatch }
  if ($_isint($gettok($gettok($3,2,58),1,47))) { %tp = $ifmatch }
  if ($_isint($gettok($3,2,47))) { %rp = $ifmatch }
  if ($_ismask2($4)) {
    var %m = $4
    if ($_validateuser(11,$2,%m)) { return $ifmatch $2 %m }
  }
  __cmd.+user $null $2 %m
  __cmd.chattr $null $2 +b
  _wuini $2 botaddr %a $+ : $+ %tp $+ / $+ %rp
  _cmdlog $iif($1,$1,$me) +bot $2 %m
  return 223 $2 $iif(%a != $null,%a,$null) %tp %rp %m
}

; +host +tm|m
; +host <handle> <newhostmask>
alias +host { _useredit.echocode +host $1- }
alias _cmd.+host {
  var %result = $__cmd.+host($1,$2,$3)
  if ($left(%result,1) >= 4) { return %result }
  _cmdlog $iif($1,$1,$me) +host $2 $gettok(%result,3,32)
  return %result
}
alias __cmd.+host {
  var %c
  tokenize 32 $1-
  tokenize 32 $1 $2 $_fixmask($3)
  if ($1 != $null) && ($_not($_ismaster($1,0,tmn))) { return 999 +host }
  if ($2 == $null) || ($3 == $null) { return 503 }
  if ($_validateuser(44,$2,$3)) {
    %c = $ifmatch
    if (%c == 440) && ($istok($_ruini($2,hosts),$3,32)) { }
    else { return %c $2 $3 }
  }
  if ($1 != $null) && ($_ismaster($1,0,t)) && ($_not($_ismaster($1,0,mn))) && (b !isincs $_nickflags($2)) { return 591 $2 }
  if ($_partyline.chlevels($1,$2)) { return 998 }
  if (%c == $null) { _dummy $_addinguserhostmask($2,$3) }
  return 203 $2 $3
}


; +ignore +m
; +ignore [-pcntikxu#] <hostmask> [comment]
; (aIRC modified command)
alias +ignore { _useredit.echocode +ignore $1- }
alias _cmd.+ignore {
  if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 +ignore }
  var %i = 1,%option,%duration = 0,%handle,%line,%file,%switches = -pcntik
  if (-* iswm $2) {
    %option = $remove($2,-,l,r)
    if (u isincs %option) {
      if ($_isint($round($remove(%option,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z),0)) > 0) { %duration = $ifmatch }
    }
    var %switches
    while ($mid(%option,%i,1) != $null) {
      if ($ifmatch isincs pcntik) { %switches = %switches $+ $ifmatch }
      inc %i
    }
    if (%switches != $null) { %switches = - $+ %switches }
    else { %switches = -pcntik }
    tokenize 32 $1 $3-
  }
  if (%duration) { %switches = %switches $+ u $+ %duration }
  if ($2 == $null) { return 533 }
  tokenize 32 $1 $_fixmask($2) $3-
  if ($_not($_ismask($_fixmask($2)))) { return 470 }
  _start.ignores
  tokenize 32 $1 $2 $iif($3- != $null,$3-,requested)
  %handle = $iif($1 != $null,$1,$me)
  %line = $2 %handle $ctime %duration %switches $3-
  %file = $_igninifile
  _dummy $read -ns" $+ $2 $+ " %file

  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;  if ($readn) { return 534 $2 }
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  if ($readn) { write -s $+ $2 $"(%file) %line }
  else { write $"(%file) %line }
  .ignore %switches $2
  if (p isincs %switches) { _closequery $2 }
  .timer -o 1 0 _cmdlog %handle +ignore $2 $3-
  if ($3- != $null) { _recent.add ignorereason 20 $3- } 
  return 224 $2 $3-
}

; +user +m
; +user <handle> [hostmask]
alias +user { _useredit.echocode +user $1- }
alias _cmd.+user {
  var %result = $__cmd.+user($1,$2,$3)
  if ($left(%result,1) >= 4) { return %result }
  _cmdlog $iif($1,$1,$me) +user $2 $gettok(%result,3,32)
  return %result
}
alias __cmd.+user {
  tokenize 32 $1-
  tokenize 32 $1 $2 $_fixmask($3)
  if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 +user }
  if ($2 == $null) { return 501 }
  if ($_isinvalidinitialchar4handle($2)) { return 590 $left($2,1) }
  if ($_validateuser(3,$2,$null)) { return $ifmatch $2 }
  if ($1 != $null) && ($2 == $me) { return 592 $2 }
  if ($_ismask($3)) {
    var %m = $3
    if ($_validateuser(43,$2,%m)) { return $ifmatch $2 %m }
  }
  _dummy $_creatinguser($2,%m,$null,$null)
  return 201 $2 %m
}

; -bot B
; -bot <nickname>
alias -bot { _useredit.echocode -user $1 }
alias _cmd.-bot {
  _cmd.-user $1-
  return $result
}

; -host
; -host <hostmask>
;
; -host +m|m
; -host <handle> <hostmask>
alias -host { _useredit.echocode -host $1- }
alias _cmd.-host {
  if ($1 != $null) {
    if ($_ismask($2)) {
      tokenize 32 $1 $1 $2
      goto ok
    }
    if ($_not($_ismaster($1,0,mn))) { return 999 -host }
  }
  if ($2 == $null) || ($3 == $null) { return 504 $2 $3 }
  if ($_validateuser(4,$2,$null)) { return $ifmatch $2 }
  if ($1 != $null) && ($_ismaster($1,0,t)) && ($_not($_ismaster($1,0,mn))) && (b !isincs $_nickflags($2)) { return 593 $2 }
  if ($_partyline.chlevels($1,$2)) { return 998 }
  :ok
  if ($2 == $null) || ($3 == $null) { return 504 $2 $3 }
  var %m = $_ruini($2,hosts)
  if ($istok(%m,$3,32) == $false) { return 505 $2 $3 }
  _dummy $_removinguserhostmask($2,$3)
  _cmdlog $iif($1,$1,$me) -host $2 $3
  return 204 $2 $3
}

; -ignore  +m
; -ignore <hostmask OR number>
alias -ignore { _useredit.echocode -ignore $1- }
alias _cmd.-ignore {
  if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 -ignore }
  if ($2 == $null) { return 544 }
  var %handle = $iif($1 != $null,$1,$me),%file = $_igninifile,%dl,%hostmask
  close -@ @__-ignore
  window -h @__-ignore
  _start.ignores
  loadbuf @__-ignore $"(%file)
  if ($2 isnum) && ($2 > 0) {
    if ($2 <= $line(@__-ignore,0)) { %dl = $2 }
  }
  else {
    var %i = 1,%l
    while ($line(@__-ignore,$fline(@__-ignore,$2 *,%i)) != $null) {
      if ($gettok($ifmatch,1,32) == $2) {
        %dl = $fline(@__-ignore,$2 *,%i)
        break
      }
      inc %i
    }
  }
  %hostmask = $gettok($line(@__-ignore,%dl),1,32)
  close -@ @__-ignore
  if (%dl == $null) { return 545 }
  write -ds $+ %hostmask $"(%file)
  .ignore -r %hostmask
  _cmdlog %handle -ignore %hostmask
  return 235 %hostmask
}


; -user +m
; -user <nickname>
alias -user { _useredit.echocode -user $1 }
alias _cmd.-user {
  if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 -user }
  if ($2 == $null) { return 502 }
  if ($_validateuser(4,$2,$null)) { return $ifmatch $2 }
  if ($_partyline.chlevels($1,$2)) { return 998 }
  _removeuser $2
  .remini " $+ $_userinifile $+ " $2
  _cmdlog $iif($1,$1,$me) -user $2
  return 202 $2
}

; addlog +to|o
; addlog <text>
alias addlog { _useredit.echocode addlog $1 }
alias _cmd.addlog {
  if ($1 != $null) && ($_not($_ismaster($1,1,mnot))) { return 999 addlog }
  if ($2- == $null) { return 546 }
  var %handle = $iif($1,$1,$me)
  .timer -o 1 0 _cmdlog %handle $+ : $2-
  return 236
}

; away
; away [away-message]

alias _cmd.away {
  tokenize 32 $1 $strip($remove($2-,$chr(9),$cr,$lf))
  if ($2- == $null) { _cmd.back }
  else {
    _partyline.show away $1 $2-
    _pls.set $sockname away $2-
    _plsw You are now away. $+ $crlf $+ Notes will be stored.
  }
}

; back 
; back

alias _cmd.back {
  if ($_pls.get($sockname,away)) {
    _partyline.show back $1
    _pls.set $sockname away $null
    _plsw You're not away any more.
    _partyline.noteswaiting
  }
  else { _plsw You weren't away! }
}

; banner +t
; banner <text>

alias banner { _useredit.echocode banner $1 }
alias _cmd.banner {
  if ($1 != $null) && ($_not($_ismaster($1,0,mnt))) { return 999 banner }
  if ($len($2-) == 0) { return 547 }
  _partyline.display $null $null $null $null * ### Botwide:[ $+ $iif($1,$1,$me) $+ ] $2-
}

;_
; binds +m
; binds [type]

; boot +t
; boot <nickname> [reason]
alias boot { _useredit.echocode boot $1- }
alias _cmd.boot {
  if ($1 != $null) && ($_not($_ismaster($1,$3,mn))) { return 999 boot }
  if ($2 == $null) { return 515 $2 }
  if ($_validateuser(4,$2,$null)) { return $ifmatch $2 }
  if ($_partyline.chlevels($1,$2)) { return 998 }
  var %s = partyline*. $+ $2 $+ ._l*
  if ($_not($sock(%s,0))) { return 516 $2 }
  var %x
  if ($1 != $null) { %x = by $1 }
  if ($3- != $null) { %x = %x $+ : $3- }
  else { %x = %x $+ . }
  sockwrite %s -=- poof -=- $+ $crlf $+ You've been booted from the bot %x $+ $crlf
  sockclose %s
  .timer -mo 1 0 _cmdlog $iif($1,$1,$me) boot $2 $3-
  .timer -mo 1 50 _partyline.show boot $iif($1,$1,$me) $2
  return 212 $2 $3-
}

;_
; botattr +t
; botattr <nickname> [attributes] [channel]

; botaccess +m|+m
; botaccess <nickname> [flags|level] [channel]
; aIRC only!
alias botaccess { _useredit.echocode botaccess $1- }
alias _cmd.botaccess {
  var %flags,%handle = $1,%nick = $2,%attr,%chan,%oldflags,%newmodes
  if (%handle == $null) { %handle = $me }
  if ($_ischan($3)) && (+* !iswm $3) { %chan = $3 }
  else { var %attr = $3,%chan = $4 }
  if ($1 != $null) {
    if ($_ischan(%chan)) { %flags = $_nickflags($1,%chan) }
    else { %flags = $_nickflags($1) }
  }
  if ($1 != $null) && (m !isincs %flags) && (n !isincs %flags) { return 999 botaccess }
  if (%nick == $null) { return 583 }
  if ($_validateuser(68,%nick,$null)) { return $ifmatch $2 }
  if (%nick == $null) { return 583 }
  %oldflags = $_getuserfield(%nick,$iif(%chan,$_nospaces(botaccess.,%chan),botaccess))
  if (%attr != $null) {
    if (%attr isnum) && ($round(%attr,0) >= 0) {
      _setuserfield %nick $iif(%chan,$_nospaces(botaccess.,%chan),botaccess) $round(%attr,0)
      %newmodes = $round(%attr,0)
    }
    else {
      %newmodes = $_fixflags($_changemodes(%oldflags,%attr),$_fixmodes(%attr),%chan)
      _setuserfield %nick $iif(%chan,$_nospaces(botaccess.,%chan),botaccess) %newmodes
    }
  }
  else { %newmodes = %oldflags }
  if (%newmodes != $null) {
    _cmdlog $iif($1,$1,$me) botaccess %nick %attr %chan
    if (%newmodes !isnum) { %newmodes = + $+ %newmodes }
    if (%chan != $null) {
      _user.chchan %nick %chan
      return 272 %nick %newmodes %chan
    }
    return 273 %nick %newmodes
  }
  if (%chan != $null) { return 274 %nick %chan }
  return 275 %nick
}

; botprofile +m
; botprofile <nickname> [profile]
; aIRC only!
alias botprofile { _useredit.echocode botprofile $1- }
alias _cmd.botprofile {
  if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 botprofile }
  if ($2 == $null) { return 584 }
  if ($_validateuser(68,$2,$null)) { return $ifmatch $2 }
  if ($3- != $null) {
    if ($3- == none) { _setuserfield $2 botprofile }
    elseif ($_not($_isbotprofile($3-))) { return 585 $2 $3- }
    else { _setuserfield $2 botprofile $3- }
  }
  _cmdlog $iif($1,$1,$me) botprofile $2 $+ : $3-
  if ($_getuserfield($2,botprofile) != $null) { return 276 $2 $ifmatch }
  return 277 $2
}

; chbotpass +m
; chbotpass <nickname> [pass]
; aIRC only!
alias chbotpass { _useredit.echocode chbotpass $1- }
alias _cmd.chbotpass {
  if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 chbotpass }
  if ($2 == $null) { return 586 }
  if ($_validateuser(68,$2,$null)) { return $ifmatch $2 }
  if ($3 == $null) {
    _setuserfield $2 botpass
    _cmdlog $iif($1,$1,$me) chbotpass $2 [nothing]
    return 278 $2
  }
  _setuserfield $2 botpass $_crypt($3)
  _cmdlog $iif($1,$1,$me) chbotpass $2 [something]
  return 279 $2
}


; botinfo +t
; botinfo
alias _cmd.botinfo {
  if ($1 != $null) && ($_not($_ismaster($1,0,mnt))) { return 999 botinfo }
  _cmdlog $1 botinfo
  var %network,%chans,%uptime
  if ($_not($_connected)) { %network = <NO_IRC> }
  else {
    if ($lower(%.network) != $null) { %network = < $+ $ifmatch $+ > }
    if ($replace($_mychans,$chr(32),$chr(44)) != $null) { %chans = $^p($ifmatch) }
  }
  %uptime = $readini -n " $+ $_tmpdir(session.ini) $+ " script uptime
  %uptime = [UP $_duration($calc($ctime - %uptime)) $+ ]
  _plsw *** [[ $+ $me $+ ]] aIRC v $+ $_vers $+ +win $+ $bits %network %chans %uptime
}

; bots
; bots
alias _cmd.bots {
  _cmdlog $1 bots
  _plsw No bots linked.
}

; bottree +t
; bottree
alias _cmd.bottree {
  if ($1 != $null) && ($_not($_ismaster($1,0,mnt))) { return 999 bottree }
  _cmdlog $1 bottree
  _plsw No bots linked.
}

; vbottree +t
; vbottree
alias _cmd.vbottree {
  if ($1 != $null) && ($_not($_ismaster($1,0,mnt))) { return 999 vbottree }
  _cmdlog $1 vbottree
  _plsw No bots linked.
}

;_
; chaddr +t
; chaddr <bot> <address:botport#/userport#>

; chat
; chat off
; chat <channel # or name>
; chat <*channel# or name>
alias _cmd.chat {
  var %chat = $iif(@ isin $gettok($sockname,3,46),1,0) ,%f
  if ($2 == off) {
    if (%chat) {
      _plsw Leaving chat mode...
      _partyline.show left $1
      _sockrename $sockname $puttok($sockname,$remove($gettok($sockname,3,46),@),3,46)
    }
    else { _plsw You weren't in chat anyway! }
  }
  elseif (%chat) { _plsw You're already on the party line! }
  else {
    _plsw Entering the party line...
    _partyline.show join $1
    %f = _l@ $+ $removecs($gettok($sockname,3,46),_,l,@)
    _sockrename $sockname $puttok($sockname,%f,3,46)
  }
}


; chattr +m|m
; chattr <nickname> [attributes] [channel]|[attributes] [channel]...
alias chattr { _useredit.echocode chattr $1- }
alias _cmd.chattr {
  var %result = $__cmd.chattr($1,$2-),%change = $replace($gettok(%result,4,32),$chr(1),|,$chr(9),$chr(32))
  if ($left(%result,1) >= 4) { return %result }
  if ($gettok(%result,1,32) == 209) { _cmdlog $iif($1,$1,$me) chattr $gettok(%result,2,32) %change }
  return %result
}
alias __cmd.chattr {
  tokenize 32 $1-
  if ($1 != $null) && ($_not($_ismaster($1,1,mn))) { return 999 chattr }
  if ($2 == $null) { return 510 }
  var %t = Change user attributes [/chattr]
  tokenize 32 $1 $2 $replace($3-,$chr(44),|)
  if ($_validateuser(4,$2,$null)) { return $ifmatch $2 }
  if ($3- == $null) { return 209 $2 $1 $null $null }
  elseif (+* !iswm $3) && ($_ischan($3)) && ($4 == $null) { return 209 $2 $1 $3 $3 }
  else {
    _nicklist.col.chandle - $2 *
    var %t = $numtok($3-,124),%i = 0,%cr,%z
    :loop2
    var %m,%c,%f,%n,%cs = $_ruini($2,channels)
    inc %i
    if (%i <= %t) {
      %m = $_fixmodes($gettok($gettok($3-,%i,124),1,32))
      %c = $gettok($gettok($3-,%i,124),2-,32)
      if (+* !iswm %m) && ($_ischan(%m)) && (%c == $null) {
        %cr = $addtok(%cr,%m,44)
        goto loop2
      }
      if ($_text($removecs(%m,+,-)) !isalpha) || ((%c != $null) && ($_not($_ischan(%c)))) { goto loop2 }
      %cr = $addtok(%cr,%c,44)
      if (%c != $null) {
        if ($1 != $null) && ($_not($_ismaster($1,%c,mn))) { goto loop2 }
        if ($_partyline.chlevels($1,$2,%c)) { goto loop2 }
        %f = $_ruini($2,%c)
      }
      else {
        if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { goto loop2 }
        if ($_partyline.chlevels($1,$2)) { return 998 }
        %f = $_ruini($2,global)
      }
      %n = $_fixflags($_changemodes(%f,%m),%m,%c)
      if (%c != $null) {
        %z = %z $+ $chr(1) $+ %m $+ $chr(9) $+ %c
        if (%n != $null) {
          _wuini $2 channels $addtok(%cs,%c,32)
          _wuini $2 %c %n
        }
        else { remini " $+ $_userinifile $+ " $2 %c }
      }
      else {
        %z = %z $+ $chr(1) $+ %m
        _wuini $2 global %n
      }
      if (%f !=== %n) { _partyline.changeflags $1 $2 $iif(%c,%c,$null) $iif(%f != $null,%f,0) %n }
      goto loop2
    }
    if ($left(%z,1) == $chr(1)) { %z = $right(%z,-1) }
    return 209 $2 $1 $iif(%z,%z,$null) $iif(%cr,%cr,$null)
  }
}

; chhandle +t
; chhandle <oldhandle> <newhandle>
alias chhandle { _useredit.echocode chhandle $1- }
alias _cmd.chhandle {
  if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 chhandle }
  if ($2 == $null ) || ($3 == $null) { return 506 $2 $3 }
  if ($_validateuser(4,$2,$null)) { return $ifmatch $2 }
  tokenize 32 $1 $2 $_fixhandle($3)
  if ($_isinvalidinitialchar4handle($3)) { return 594 $left($3,1) }
  if ($_validateuser(3,$3,$null)) { return $ifmatch $3 }
  if ($_partyline.chlevels($1,$2)) { return 998 }
  if ($1 != $null) {
    if ($_ismaster($1,0,t)) && ($_not($_ismaster($1,0,mn))) && (b !isincs $_nickflags($2)) { return 998 }
    if ($2 == $me) { return 592 }
  }
  _removeuser $2
  flushini " $+ $_userinifile $+ "
  write -s[ $+ $2 $+ ] " $+ $_userinifile $+ " $chr(91) $+ $3 $+ $chr(93)
  flushini " $+ $_userinifile $+ "
  _wuini $3 handle $3
  var %h = $_ruini($3,hosts)
  if (%h != $null) {
    var %i = 1,%t = $numtok(%h,32)
    while (%i <= %t) {
      _auser $3 $gettok(%h,%i,32)
      inc %i
    }
  }
  .timer -o 1 0 _partyline.chhandle $2 $3
  _cmdlog $iif($1,$1,$me) chhandle $2 $3
  return 205 $2 $3
}

; chpass +t
; chpass <handle> [password]
alias chpass { _useredit.echocode chpass $1- }
alias _cmd.chpass {
  var %result = $__cmd.chpass($1,$2,$3)
  if ($gettok(%result,1,32) isnum 206-207) { _cmdlog $iif($1,$1,$me) chpass $2 $iif($3 == $null,[nothing],[something]) }
  return %result
}
alias __cmd.chpass {
  if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 chpass }
  if ($2 == $null) { return 507 }
  if ($_validateuser(4,$2,$null)) { return $ifmatch $2 }
  if ($_partyline.chlevels($1,$2)) { return 998 }
  if ($3 == $null) {
    _setuserfield $2 pass
    return 206 $2
  }
  if ($len($3) < 6) { return 508 $2 }
  _setuserfield $2 pass $_crypt($3)
  return 207 $2 $3
}

; comment +m
; comment <handle> <newcomment>
alias comment { _useredit.echocode comment $1- }
alias _cmd.comment {
  if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 comment }
  if ($2 == $null) { return 509 comment comment }
  if ($_validateuser(4,$2,$null)) { return $ifmatch $2 }
  if ($_partyline.chlevels($1,$2)) { return 998 }
  _cmdlog $iif($1,$1,$me) comment $2 $3-
  if ($3- == none) {
    _setuserfield $2 comment
    return 284 $2
  }
  _setuserfield $2 comment $strip($3-)
  return 208 comment $2 $3-
}

; console +to|o
; console [channel] [modes]
; console +m|m
; console <user> [channel] [modes]

alias console { _useredit.echocode console $1- }
alias _cmd.console {
  var %index,%sock,%autosave = $_getsetup(script,console-autosave)
  if ($1 != $null) && ($_not($_ismaster($1,1,mnot))) { return 999 console }
  var %handle1 = $iif($1,$1,$me) ,%handle2,%chan,%modes,%fmodes
  if ($_ischan($2)) && (+* !iswm $2) {
    %chan = $2
    %modes = $3
  }
  elseif ($left($2,1) isin -+) { %modes = $2 }
  else {
    %handle2 = $2
    if ($_ischan($3)) && (+* !iswm $3) {
      %chan = $3
      %modes = $4
    }
    else { %modes = $3 }
  }
  if ($1 == $null) && (%handle2 == $null) { return 548 }
  if (%handle2 == $null) { %handle2 = $1 }
  if (%handle2 == $2) {
    var %index = partyline*. $+ $2 $+ ._l*,%sock = $sock(%index,1)
    if (%sock == $null) { return 551 $2 }
  }
  if (%chan == $null) && (%modes == $null) {
    if (%handle2 == $2) { return 549 %chan }
    if (%autosave) {
      _wuini $2 console-flags $removecs($_pls.get($sockname,consoleflags),_,l,@)
      _wuini $2 console-chan $_pls.get($sockname,consolechan)
      _wuini $2 echo $_pls.get($sockname,echo)
    }
    if ($removecs($gettok($sockname,3,46),_,l,@) != $null) { return 237 $iif($_pls.get($sockname,consolechan),$_pls.get($sockname,consolechan),$null) $removecs($gettok($sockname,3,46),_,l,@) }
    return 238 $_pls.get($sockname,consolechan)
  }
  if (%handle2 == $2) {
    if ($_partyline.chlevels($1,$2)) { return 998 }
    %fmodes = $iif(@ isin $_pls.get(%sock,consoleflags),_l@,_l) $+ $__cmd.console.cmodes($removecs($_pls.get(%sock,consoleflags),_,l,@),%modes)
    if (%chan != $null) { _pls.set %sock consolechan %chan }
    _sockrename %sock $puttok(%sock,%fmodes,3,46)
    var %ttt = $removecs(%fmodes,_,l,@)
    _cmdlog %handle1 console $2-
    sockwrite $puttok(%sock,%fmodes,3,46) %handle1 set your console to $iif($_pls.get(%sock,consolechan),$_pls.get(%sock,consolechan)) $+ : %ttt $__cmd.console.rmodes(%ttt) $+ $crlf
    if (%autosave) {
      _wuini $2 console-flags %ttt
      _wuini $2 console-chan $_pls.get($sockname,consolechan)
      _wuini $2 echo $_pls.get($sockname,echo)
    }
    if (%ttt != $null) { return 241 $2 $iif($_pls.get(%sock,consolechan),$_pls.get(%sock,consolechan),$null) %ttt }
    return 242 $2 $_pls.get(%sock,consolechan)
  }
  else {
    %fmodes = $iif(@ isin $gettok($sockname,3,46),_l@,_l) $+ $__cmd.console.cmodes($removecs($gettok($sockname,3,46),_,l,@),%modes)
    if (%chan != $null) {
      if ($_not($_ismaster($1,%chan,mnot))) { return 550 %chan }
      _pls.set $sockname consolechan %chan
    }
    _sockrename $sockname $puttok($sockname,%fmodes,3,46)
    var %ttt = $removecs(%fmodes,_,l,@)
    _cmdlog $iif($1,$1,$null) console $2-
    if (%autosave) {
      _wuini $1 console-flags %ttt
      _wuini $1 console-chan $_pls.get($sockname,consolechan)
      _wuini $1 echo $_pls.get($sockname,echo)
    }
    if (%ttt != $null) { return 239 $iif($_pls.get($sockname,consolechan),$_pls.get($sockname,consolechan),$null) %ttt }
    return 240 $_pls.get($sockname,consolechan)
  }
}
alias __cmd.console.rmodes {
  if ($1 == $null) { return }
  var %t
  if (m isincs $1) { %t = %t msgs, }
  if (p isincs $1) { %t = %t public, }
  if (j isincs $1) { %t = %t joins, }
  if (k isincs $1) { %t = %t kicks/modes, }
  if (c isincs $1) { %t = %t cmds, }
  if (o isincs $1) { %t = %t misc, }
  if (b isincs $1) { %t = %t bots, }
  if (x isincs $1) { %t = %t files, }
  if (s isincs $1) { %t = %t server, }
  if (d isincs $1) { %t = %t debug, }
  if (w isincs $1) { %t = %t wallops, }
  if (*, iswm %t) { %t = $left(%t,-1) }
  if (%t != $null) { return ( $+ %t $+ ) }
  return (none)
}

; $__cmd.console.cmodes(originalmodes,+-mpjkcobxsdw)
alias __cmd.console.cmodes {
  var %i = 1,%r,%t
  while (%i <= $len($2)) {
    if ($mid($2,%i,1) isincs -+mpjkcobxsdw) { %r = %r $+ $ifmatch }
    inc %i
  }
  %r = $_changemodes($1,%r)
  if (m isincs %r) { %t = %t m }
  if (p isincs %r) { %t = %t p }
  if (j isincs %r) { %t = %t j }
  if (k isincs %r) { %t = %t k }
  if (c isincs %r) { %t = %t c }
  if (o isincs %r) { %t = %t o }
  if (b isincs %r) { %t = %t b }
  if (x isincs %r) { %t = %t x }
  if (s isincs %r) { %t = %t s }
  if (d isincs %r) { %t = %t d }
  if (w isincs %r) { %t = %t w }
  if ($remove(%t,$chr(32)) != $null) { return $ifmatch }
}

;_
; dccstat +m
; dccstat

; debug +m
; debug [help]
alias _cmd.debug {
  if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 debug }
  _cmdlog $1 debug
  _plsw Compiled without extensive memory debugging (sorry).
}

; echo
; echo <on/off>
alias _cmd.echo {
  var %onoff = 0
  if ($2- == $null) { return 312 $_pls.get($sockname,echo) }
  elseif ($2- == on) { %onoff = 1 }
  elseif ($2- == off) { %onoff = 0 }
  else { return 617 }
  _pls.set $sockname echo %onoff
  if (%onoff) { return 313 }
  return 314
}

; die +n
; die [reason]
alias die { _useredit.echocode die $1- }
alias _cmd.die {
  if ($1 != $null) && ($_not($_ismaster($1,0,n))) { return 999 die }
  var %handle = $iif($1,$1,$me),%reason = $iif($len($2-),$2-,request)
  _cmdlog %handle die $1-
  if ($2- != $null) { _partyline.display $null $null $null $null * *** SCRIPT SHUTDOWN ( $+  %handle $+ : $ifmatch $+ ) }
  else { _partyline.display $null $null $null $null * *** SCRIPT SHUTDOWN (authorized by %handle $+ ) }
  if ($_not($_getsetup(script,quiet-save))) {
    _putcmdlog Writing user file...
    _putcmdlog Writing channel file ...
  }
  _putcmdlog * DIE BY %handle ( $+ %reason $+ )
  exit $iif($len($2-),$2-,%handle)
}

;;
;
; -( SHARE )-
;
;;

;_
; flush +n
; flush <bot>


;;
;
; -( USERINFO )-
;
;;

; chemail +m
; chemail <user> [email address]
alias chemail { _useredit.echocode $_chuserinfo($null,email,chemail,$1,$2-) }

; churl +m
; churl <user> [url address]
alias churl { _useredit.echocode $_chuserinfo($null,url,churl,$1,$2-) }

; chbf +m
; chbf <user> [boyfriend]
alias chbf { _useredit.echocode $_chuserinfo($null,bf,chbf,$1,$2-) }

; chgf +m
; chgf <user> [girlfriend]
alias chgf { _useredit.echocode $_chuserinfo($null,gf,chgf,$1,$2-) }

; chirl +m
; chirl <user> [real life name]
alias chirl { _useredit.echocode $_chuserinfo($null,irl,chirl,$1,$2-) }

; chdob +m
; chdob <user> [date of birth]
alias chdob { _useredit.echocode $_chuserinfo($null,dob,chdob,$1,$2-) }

; showfields +m
; showfields
alias _cmd.showfields {
  if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 showfields }
  .timer -o 1 0 _cmdlog $iif($1,$1,$me) showfields
  if ($_getsetup(script,userinfo-fields) != $null) { return 289 $upper($ifmatch) }
  return 606
}

;;
;
; -( NOTES )-
;
;;


;;
;
; -( SEEN )-
;
;;



;;
;
; -( SERVER )-
;
;;

; dump +m
; dump <text>
alias dump { _useredit.echocode dump $1- }
alias _cmd.dump {
  if ($1 != $null) {
    if ($_not($_ismaster($1,0,mn))) { return 999 dump }
    if ($_getsetup(script,must-be-owner) >= 2) && ($istok($_getsetup(script,owner),$2,32) == $false) { return 999 dump }
  }
  if ($2- == $null) { return 578 }
  _cmdlog $iif($1,$1,$me) dump $2-
  if ($_connected) { _putserv & & quote $2- }
}

; jump +m
; jump [server [port]]
alias jump { _useredit.echocode jump $1- }
alias _cmd.jump {
  var %result = $__cmd.jump($1,$2-),%handle = $iif($1,$1,$me)
  if ($gettok(%result,1,32) == 999) { return %result }
  _cmdlog %handle jump $2-
  .timer -o 1 0 _putcmdlog Trying server $2 $+ : $+ $3
  return %result
}
alias __cmd.jump {
  tokenize 32 $1-
  if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 jump }
  if ($_not($_ishost($2))) { tokenize 32 $1 $gettok($_mini(mirc,host),2,58) $iif($_isint($2),$2-,$3-) }
  if ($_not($_isint($3))) { tokenize 32 $1 $2 $_minio(5,11) $3- }
  if ($_connected) { quit changing servers }
  server $2 $3 $4
}

;_
; clearqueue +m
; clearqueue <queue>
; queue: (mode/server/help/all)
;
alias clearqueue { _useredit.echocode clearqueue $1- }
alias _cmd.clearqueue {
  .timer -o 1 0 _cmdlog $iif($1,$1,$me) clearqueue $2-
  if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 clearqueue }
  if ($istok(mode server help all,$2-,32) == $false) { return 605 }
  _clearqueue $2
  goto $2
  :mode | return 285 $result
  :server | return 286 $result
  :help | return 287 $result
  :all | return 288 $result
}

;_
; servers +o|o
; servers


;;
;
; -( CONSOLE )-
;
;;

; store
; store
alias _cmd.store {
  _plsw Saved Console your Settings:
  var %handle = $_pls.get($sockname,handle),%chan = $_pls.get($sockname,consolechan),%echo = $_pls.get($sockname,echo),%flags = $removecs($_pls.get($sockname,consoleflags),_,l,@)
  _wuini %handle console-chan %chan
  _wuini %handle console-flags %flags
  _wuini %handle echo %echo
  _plsw   Channel: %chan
  _plsw   Console flags: %flags $+ , Strip flags: -, Echo: $iif(%echo,yes,no)
  _plsw   Page setting: 0, Console channel: 0
}

; -( FILESYS )-
;
;;

;_
; files +x
; files