aIRC — File Browser

aIRCv0.8.69 / aIRCv0.8.69 / script / mirc.mrc

mirc.mrc — 16.9 KB — Download this file

;/**********************************************************************
; *
; * aIRC
; * mIRC
; *
; **********************************************************************/

; /pvoice <delay> <#channel> <nickname>
alias pvoice {
  if ($_disconnected) { return }
  if ($1 isnum) { .timer 1 $1 .pvoice #$2- }
  elseif ($me isop $1) && ($2 !isvo $1) && ($2 !isop $1) { _raw.voice $1 $2 }
}
; /pop <delay> <#channel> <nickname>
alias pop {
  if ($_disconnected) { return }
  if ($1 isnum) { .timer 1 $1 .pop #$2- }
  elseif ($me isop $1) && ($2 !isop $1) { _raw.op $1 $2 }
}
; /load <-a|-pscqnm|-ruvsN> <filename>
alias load {
  load $1-
  .timer -mo 1 1 _orderemotefiles
  .timer -o 1 5 _orderemotefiles
}
; /unload <-a|-rs> <filename>
alias unload {
  if ($1 == ?) && ($2 == -rs) { unload $2- }
  else {
    unload $1-
    .timer -mo 1 1 _orderemotefiles
  }
}
; /ame [message]
alias ame {
  if ($_disconnected) { return }
  var %msg = $_parameter($1-,1,Action to all channels [/ame],normal,$null,Action:),%i = $chan(0),%chan,%irc
  while (%i) {
    %chan = $chan(%i)
    if (m !isincs $gettok($chan(%chan).mode,1,32)) || ($me isowner %chan) || ($me isop %chan) || ($me isvo %chan) { %irc = $addtok(%irc,%chan,44) }
    dec %i
  }
  if (%irc != $null) { describe %irc %msg }
}
; /amsg [message]
alias amsg {
  if ($_disconnected) { return }
  var %msg = $_parameter($1-,1,Message to all channels [/amsg],normal,$null,Message:),%i = $chan(0),%chan,%irc
  while (%i) {
    %chan = $chan(%i)
    if (m !isincs $gettok($chan(%chan).mode,1,32)) || ($me isowner %chan) || ($me isop %chan) || ($me isvo %chan) { %irc = $addtok(%irc,%chan,44) }
    dec %i
  }
  if (%irc != $null) { msg %irc %msg }
}
alias ctcp {
  if ($_disconnected) { return }
  tokenize 32 $_parameter($1,1,Client to Client Protocol [/ctcp],replace 32 44,$_active,Nicks|#Channels:) $2-
  tokenize 32 $1 $_parameter($2-,1,Client to Client Protocol [/ctcp],normal,$null,CTCP [parameters])
  tokenize 32 $1 $upper($2) $3-
  if ($group(#_airctexthemes) == on) {
    if ($2- == ping) {
      .quote PRIVMSG $1 :PING $ticks $+ 
      tokenize 32 $1-2
    }
    else { .ctcp $1- }
    if ($show) {
      %:echo = echo.a $colour(ctcp)
      %:echo $^ctcpsend($1,$2-,$me)
    }
  }
  else { ctcp $1- }
}
alias ctcpreply {
  if ($_disconnected) { return }
  tokenize 32 $_parameter($1,1,Client to Client Protocol Reply [/ctcpreply],replace 32 44,$_active,Nicks|#Channels:) $2-
  tokenize 32 $1 $_parameter($2-,1,Client to Client Protocol Reply [/ctcpreply],normal,$null,CTCP [parameters])
  tokenize 32 $1 $upper($2) $3-
  if ($group(#_airctexthemes) == on) {
    .ctcpreply $1-
    if ($show) {
      %:echo = echo.a $colour(ctcp)
      %:echo $^ctcpreplysend($1,$2-,$me)
    }
  }
  else { ctcpreply $1- }
}
alias cycle { rejoin $1- }
alias invite {
  if ($_disconnected) { return }
  .invite $_parameter($1,1,Invite to channel [/invite],1,$_activequery,Nick:) $_parameter($2,1,Invite to channel [/invite],ischan,#,Channel:)
}
alias join {
  var %join = 0,%pre,%chans,%pass
  if ($_disconnected) { return }
  if (-* iswm $1) {
    if (i isin $1) { .join $1 }
    elseif (n isin $1) || (x isin $1) { var %join = 1,%pre = $1,%chans = $2,%pass = $3- }
  }
  else { var %join = 1,%pre,%chans = $1,%pass = $2- }
  if (%join) { .join %pre $_rparameter(%chans,1,Join channel [/join],fixchans,$null,channel,$null,Channels:<CRLF>[separated by commas]) %pass }
}
alias me {
  if (=* !iswm $active) && ($_disconnected) { return }
  var %msg = $_parameter($1-,1,Say action [/me],normal,$null,Action:),%p = $active
  if (=* iswm $active) { me %msg }
  elseif (%p ischan) || ($query(%p)) { describe %p %msg }
  else { error.a You can's use '/me' in this window }
}
alias mkdir {
  tokenize 32 $remove($1-,")
  tokenize 32 $iif(*\ iswm $1-,$left($1-,-1),$1-)
  mkdir " $+ $1- $+ "
}
alias names {
  if ($_disconnected) { return }
  names $_parameter($iif($1,$1,#),1,Channel names [/names],ischan,$null,Channel:)
}
alias nick {
  nick $_rparameter($1-,1,Change nick [/nick],normal,$me,nick,$null,New nick:)
}
alias part {
  ; 85./part can now close an open channel window while not connected.
  ;  if ($_disconnected) { return }
  if ($1- == $null) { tokenize 32 $_parameter(#,1,Part channel [/part],fixchans,$null,Channels:) }
  else { tokenize 32 $_fixchans(#$$1) $2- }
  part $1 $_evaltext($replace($_defmsg(part,$2-),<CHAN>,$1))
}
alias rejoin {
  if ($_disconnected) { return }
  tokenize 32 $_parmchans(Rejoin channel [/rejoin],Channel:,ismychan,$null,$null,1,$1,$null,$iif($_ischan($1) && $me ison $1,$2-,$1-))
  if ($me !ison $1) { error.a You are not in $1 }
  elseif ($_ischanmode($1,i)) && ($nick($1,0) > 1) { error.a $1 is invite only }
  elseif ($_ischanmode($1,k)) && ($chan($1).key == $null) { error.a Can't cycle $1 - Channel is +k but chankey is unknown! }
  else {
    var %msg = $remove($_evaltext($replace($_defmsg(rejoin,$2-),<CHAN>,$1)),$cr,$lf)
    if ($1 == $active) { hop $1 %msg }
    else { .quote part $1 : $+ %msg $+ $crlf $+ join $1 $chan($1).key }
    if ($show) { info.s Rejoining $1 }
  }
}
alias partall {
  .partall $_evaltext($_defmsg(partall,$1-))
  if ($show) { info.s Parting all channels.... }
}
alias query {
  if ($_disconnected) { return }
  var %flags
  if (-* iswm $1) {
    %flags = $1
    tokenize 32 $2-
  }
  tokenize 32 $_parameter($1,1,Open Query [/query],1,$iif($query($_activequery) == $null,$_activequery),Nick:) $2-
  if ($istok($_prot.bugnick.nicks,$1,32)) { return }
  if ($query($1)) { query %flags $1 }
  else {
    query %flags $1
    _onopen.query $1
  }
  if ($2- != $null) { msg $1- }
}
alias quit {
  if ($_disconnected) { return }
  if ($_not($isid)) && ($_connected) {
    tokenize 32 $_quitmsg(0,$1-)
    .raw quit : $+ $1-
    set -u10 %c.quit.reason $1-
    set -u10 %c.quit.i 1
    if ($1- != $null) { _recent.add quitreason 20 $1- }
  }
}
alias say {
  if (=* !iswm $active) && ($_disconnected) { return }
  var %msg = $_parameter($1-,1,Say message [/say],normal,$null,Message:),%p = $active
  if (=* iswm $active) { say %msg }
  elseif (%p ischan) || ($query(%p)) { msg %p %msg }
  else { error.a You can's use '/say' in this window }
}
alias topic {
  if ($_disconnected) { return }
  tokenize 32 $_parmchans(Change channel topic [/topic],Channel:,ischan,$null,$null,1,$1,$null,$iif($_ischan($1),$2-,$1-))
  if ($2- == -) { .quote topic #$$1 : }
  else { topic #$$1 $2- }
  if ($2- != $null) && ($2- != -) { _recent.add topic 20 $replace($2-,#$1,<CHAN>) }
}
alias wallops {
  if ($_disconnected) { return }
  wallops $_parameter($1-,1,Ircop wallops [/wallops],normal,$null,WallOps:)
}
alias whois {
  if ($_disconnected) { return }
  if ($1 != $null) && ($1 == $2) && ($3- == $null) { whois $1- }
  else { whois $_parameter($iif($1- != $null,$1-,$_activequery),1,Who is user? [/whois],replace 32 44,$_activequery,Nicks:<CRLF>[separated by commas]) $2- }
}
alias whowas {
  if ($_disconnected) { return }
  whowas $_parameter($1,1,Who was user? [/whois],replace 32 44,$_activequery,Nicks:<CRLF>[separated by commas]) $2-
}
alias describe {
  var %target = $_parameter($1,1,Send Action [/describe],replace 32 44,$_active,Nicks|#Channels:),%msg = $_parameter($2-,1,Send Action [/describe],normal,$null,Action:)
  if ($group(#_airctexthemes) == on) && ($show) {
    _fillvarswithmycommand
    var %i = $numtok(%target,44),%p,%irc,%showsend,%flags
    if ($_minio(2,30)) { %flags = yp }
    else { %flags = y }
    %::msg = %msg
    while (%i) {
      unset %::chan %::target
      %p = $gettok(%target,%i,44)
      if (=* iswm %p) { !describe %p %msg }
      elseif (%†connected) {
        if (%p ischan) {
          %::target = %p
          %::flags = %flags $+ $_chanickopvoice($me,%p)
          %::chan = %p
          %:echo = echo2 $colour(action) -tiq %p
          ^actionchan
        }
        elseif ($query(%p)) {
          %::target = %p
          %::flags = %flags
          %:echo = echo2 $colour(action) -tiq %p
          ^actionuser
        }
        else { %showsend = $addtok(%showsend,%p,44) }
        %irc = $addtok(%irc,%p,44)
      }
      dec %i
    }
    if (%showsend != $null) {
      unset %::flags
      %:echo = echo2 $colour(action) -ait
      %:echo $^actionsend(%showsend,%msg,$me)
    }
    if (%irc != $null) { .quote privmsg %irc : $+ $chr(1) $+ ACTION %msg $+ $chr(1) }
  }
  else {
    if ($len(%target) <= 60) { !describe %target %msg }
    else {
      if ($show) { echo2 $colour(action) -ait -> * $+ %target $+ * %msg }
      .quote privmsg %target : $+ $chr(1) $+ ACTION %msg $+ $chr(1)
    }
  }
}
alias -l _fillvarswithmycommand {
  unset %::*
  %::me          = $me
  %::nick        = $me
  %::address     = $gettok(%.myaddress,2,33)
  %::fulladdress = %.myaddress
  %::site        = $gettok(%.myaddress,2,64)
}
alias msg {
  var %target = $_parameter($1,1,Send message [/msg],replace 32 44,$_active,Nicks | #Channels),%msg = $_parameter($2-,1,Send message [/msg],normal,$null,Message:)
  if ($group(#_airctexthemes) == on) && ($show) {
    _fillvarswithmycommand
    var %i = $numtok(%target,44),%p,%irc,%showsend,%flags = y
    if ($_minio(0,23)) { %flags = ym }
    if ($_minio(2,30)) { %flags = %flags $+ p }
    %::msg = %msg
    while (%i) {
      unset %::chan %::target
      %p = $gettok(%target,%i,44)
      if (=* iswm %p) { !msg %p %msg }
      elseif (%†connected) {
        if (%p ischan) {
          %::target = %p
          %::chan = %p
          %::flags = %flags $+ $_chanickopvoice($me,%p)
          %:echo = echo2 $colour(own) -tiq %p
          ^textchan
        }
        elseif ($query(%p)) {
          %::target = %p
          %::flags = %flags
          %:echo = echo2 $colour(own) -tiq %p
          ^textuser
        }
        else { %showsend = $addtok(%showsend,%p,44) }
        %irc = $addtok(%irc,%p,44)
      }
      dec %i
    }
    if (%showsend != $null) {
      %:echo = echo2 $colour(own) -ait
      %:echo $^textsend(%showsend,%msg,$me)
    }
    if (%irc != $null) { .quote privmsg %irc : $+ %msg }
  }
  else {
    if ($len(%target) <= 60) { !msg %target %msg }
    else {
      if ($show) { echo2 $colour(own) -ait -> * $+ %target $+ * %msg }
      .quote privmsg %target : $+ %msg
    }
  }
}
alias notice {
  if ($_disconnected) { return }
  var %target = $_parameter($1,1,Send notice [/notice],replace 32 44,$_active,Nicks | #Channels),%msg = $_parameter($2-,1,Send notice [/notice],normal,$null,Notice:)
  if ($group(#_airctexthemes) == on) && ($show) {
    var %i = $numtok(%target,44),%p,%showsend,%flags = y,%address = $gettok(%.myaddress,2,33),%site = $gettok(%.myaddress,2,64)
    %:echo = echo2 $colour(own) $_actwin(it)
    %:echo $^noticesend(%target,%msg,$me)
    .quote notice %target : $+ %msg
  }
  else {
    if ($len(%target) <= 60) { !notice %target %msg }
    else {
      if ($show) { echo2 $colour(own) -ait -> - $+ %target $+ - %msg }
      .quote notice %target : $+ %msg
    }
  }
}
alias _getchanmsgnoticeparms {
  var %chan,%msg,%title = $1
  tokenize 32 $2-
  if ($_ischan($1)) { var %chan = $1,%msg = $2- }
  elseif ($active ischan) { var %chan = $active,%msg = $1- }
  else { var %mychans = $_mychans,%chan = $_select($null,1,%title,ismychan,$null,32,%mychans,Channel:),%msg = $1- }
  %msg = $_parameter(%msg,1,%title,$null,$null,Contents:)
  return %chan %msg
}
alias onotice {
  if ($_disconnected) { return }
  tokenize 32 $_getchanmsgnoticeparms(Notice to ops [/onotice],$1-)
  var %chan = $1,%msg = $2-
  if ($show) { echo2 -a -> Ops %chan $+ : %msg }
  if (u2.* iswm %.serversion) || (dal* iswm %.serversion) || (2.8/hybrid-6* iswm %.serversion) { _puthelp %chan c& _qnotice @ $+ %chan %msg }
  else { _masschanmsgnotice %chan o _ _qnotice %msg }
}
alias ovnotice {
  if ($_disconnected) { return }
  tokenize 32 $_getchanmsgnoticeparms(Notice to ops and voices [/ovnotice],$1-)
  var %chan = $1,%msg = $2-
  if ($show) { echo2 -a -> Ops&Voices %chan $+ : %msg }
  if (dal* iswm %.serversion) {
    _puthelp %chan c& _qnotice @ $+ %chan %msg
    _puthelp %chan c& _qnotice + $+ %chan %msg
  }
  elseif (u2.* iswm %.serversion) || (2.8/hybrid-6* iswm %.serversion) {
    _puthelp %chan c& _qnotice @ $+ %chan %msg
    _masschanmsgnotice %chan v o _qnotice %msg
  }
  else { _masschanmsgnotice %chan ov _ _qnotice %msg }
}
alias dnotice {
  if ($_disconnected) { return }
  tokenize 32 $_getchanmsgnoticeparms(Notice to nonops [/dnotice],$1-)
  var %chan = $1,%msg = $2-
  if ($show) { echo2 -a -> Drones %chan $+ : %msg }
  _masschanmsgnotice %chan a o _qnotice %msg
}
alias omsg {
  if ($_disconnected) { return }
  tokenize 32 $_getchanmsgnoticeparms(Message to ops [/omsg],$1-)
  var %chan = $1,%msg = $2-
  if ($show) { echo2 -a -> Ops %chan $+ : %msg }
  if ($me isop %chan) && (2.8/hybrid-6* iswm %.serversion) { _puthelp %chan co& _qprivmsg @ $+ %chan %msg }
  else { _masschanmsgnotice %chan o _ _qprivmsg %msg }
}
alias ovmsg {
  if ($_disconnected) { return }
  tokenize 32 $_getchanmsgnoticeparms(Message to ops and voices [/ovmsg],$1-)
  var %chan = $1,%msg = $2-
  if ($show) { echo2 -a -> Ops&Voices %chan $+ : %msg }
  if ($me isop %chan) && (2.8/hybrid-6* iswm %.serversion) {
    _puthelp %chan co& _qprivmsg @ $+ %chan %msg
    _masschanmsgnotice %chan v o _qprivmsg %msg
  }
  else { _masschanmsgnotice %chan ov _ _qprivmsg %msg }
}
alias dmsg {
  if ($_disconnected) { return }
  tokenize 32 $_getchanmsgnoticeparms(Message to nonops [/dmsg],$1-)
  var %chan = $1,%msg = $2-
  if ($show) { echo2 -a -> Drones %chan $+ : %msg }
  _masschanmsgnotice %chan a o _qprivmsg %msg
}
; /_massmsgnotice <-flags> <_qprivmsg|_qnotice|_qdescribe> <targets> <msg>
alias _massmsgnotice {
  var %flags = $1,%com = $2,%to = $_fixtargets($3),%tmpcom = $remove(%com,_q,priv),%title = %tmpcom to selected nicks:,%msg = $_parameter($4-,1,%title,$null,$null,Contents:),%targets,%lenmsg = $len(%msg),%left,%maxtarglen = 500 - %lenmsg
  if (%maxtarglen < 1) { %maxtarglen = 1 }
  if (%to == $null) { return }
  if (%.maxtargs == 1) { %to = $gettok(%to,1,44) }
  if (q isin %flags) { %com = _puthelp & & %com }
  if ((%.maxtargs == 0) || ($numtok(%to,44) <= %.maxtargs)) && ($calc(%lenmsg + $len(%to)) < 500) { %com %to %msg }
  else {
    var %ztargets = %to,%zt1,%zt2
    while (%ztargets != $null) {
      var %ztoks = $numtok($left(%ztargets,%maxtarglen),44) - 1
      if (%ztoks < 10) { %ztoks = 10 }
      if (%.maxtargs) && (%.maxtargs >= %ztoks) { %ztoks = $ifmatch }
      if ($numtok(%ztargets,44) < %ztoks) { %ztoks = $ifmatch }
      var %zt1 = 1- $+ %ztoks,%zt2 = $calc(%ztoks + 1) $+ -
      %com $gettok(%ztargets,%zt1,44) %msg
      %ztargets = $gettok(%ztargets,%zt2,44)
    }
  }
  if (s isin %flags) && ($show) { info.a Sending %tmpcom to selected users... }
}
; /_masschanmsgnotice <chan> <aohvr> <aohvr> <_qprivmsg|_qnotice> <msg>
alias _masschanmsgnotice {
  var %chan = $1,%f1 = $2,%f2 = $3,%com = $4,%msg = $5-,%lenmsg = $len(%msg)
  if ($me ison %chan) {
    var %i = 1,%n = $nick(%chan,0,%f1,%f2),%targets,%z = 0,%m = 0
    while (%i <= %n) {
      if ($nick(%chan,%i,%f1,%f2) != $me) {
        %targets = $addtok(%targets,$ifmatch,44)
        inc %m
        inc %z
        if (%.maxtargs) && (%z >= %.maxtargs) || ($calc(%lenmsg + $len(%targets)) >= 490) {
          _puthelp & & %com %targets %msg
          %z = 0
          var %targets
        }
      }
      inc %i
    }
    if (%z) { _puthelp & & %com %targets %msg }
  }
  else { error.a You are not on %chan }
  return %m
}
alias _fixtargets {
  var %target = $1,%c
  %c = ,,
  while (%c isin %target) { %target = $replace(%target,%cc,$chr(44)) }
  while ($istok(%target,$me,44)) { %target = $remtok(%target,$me,1,44) }
  return %target
}
alias _domsgnotice {

}
alias ignore {
  var %flags,%mask,%t,%old,%new
  if (-* iswm $1) { var %flags = $1,%mask = $2 }
  elseif ($istok(on off,$1,32) == $false) { %mask = $1 }
  %mask = $_fixmask(%mask)
  %old = $iif(%mask isignore,1,0)
  ignore $1-
  %new = $iif(%mask isignore,1,0)
  if (%mask != $null) && ($group(#_nicklistcol.d) == on) && ($_getsetup(script,_nicklistcol.ignores)) {
    .timer_airccheckignore $+ %mask off
    if (%old != %new) { _nicklist.col.addy %mask * }
    if (r !isin %flags) && (u isin %flags) && ($_isint($remove(%flags,-,l,r,p,c,n,t,i,k,x,u))) {
      %t = $ifmatch + 1
      .timer_airccheckignore $+ %mask 1 %t _nicklist.col.addy %mask *
    }
  }
}
alias _mnotify {
  var %flags = $1,%nicks = $2-,%i = 1,%n = $numtok(%nicks,32)
  if (%flags == -) { var %flags }
  while (%i <= %n) {
    notify %flags $gettok(%nicks,%i,32)
    inc %i
  }
}
alias notify {
  var %flags,%mask,%t,%old,%new,%nick
  if (-* iswm $1) { var %flags = $1,%nick = $2 }
  elseif ($istok(on off,$1,32) == $false) { %nick = $1 }
  %old = $notify(0)
  notify $1-
  %new = $notify(0)
  if (%old != %new) && (%nick != $null) && ($group(#_nicklistcol.d) == on) { _nicklist.col.nick %nick }
}