aIRC — File Browser

aIRCv0.8.69 / aIRCv0.8.69 / script / partyline5.mrc

partyline5.mrc — 8.92 KB — Download this file

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

;;
;
;;
;
; -( IRC )-
;
;;

; adduser +m|m
; adduser [!]<nickname> [handle]
alias adduser { _useredit.echocode adduser $1- }
alias _cmd.adduser {
  var %fulladdress,%hostmask,%static = 0
  if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 adduser }
  if ($2 == $null) { return 557 }
  if (!* iswm $2) {
    %static = 1
    if ($right($2,-1) != $null) { tokenize 32 $1 $ifmatch $3 }
    else { return 557 }
  }
  if ($3 == $null) { tokenize 32 $1 $2 $2 }
  if ($_address($2,5) != $null) {
    %fulladdress = $ifmatch
    if ($_finduser(%fulladdress) != $null) { return 558 $2 $ifmatch }
  }
  else { return 559 $2 }
  %hostmask = $_mask(%fulladdress,$iif(%static,2,3))
  if ($_isinvalidinitialchar4handle($3)) { return 594 $left($3,1) }
  if ($_not($_isvalidhandle($3))) { return 596 $3 }
  if ($_validateuser(41,$3,%hostmask)) { return $ifmatch $3 %hostmask }
  if ($_partyline.chlevels($1,$3)) { return 998 }
  .timer -o 1 0 _cmdlog $iif($1,$1,$me) adduser $2-
  if ($_isuser($3)) {
    _dummy $_addinguserhostmask($3,%hostmask)
    return 311 $3 %hostmask
  }
  _dummy $_creatinguser($3,%hostmask,$_getsetup(script,default-flags),$null)
  return 246 $3 %hostmask
}

; deluser +m|m
; deluser <nickname>
alias deluser { _useredit.echocode deluser $1- }
alias _cmd.deluser {
  var %address,%handle
  if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 deluser }
  if ($2 == $null) { return 560 }
  if ($_address($2,5) != $null) {
    %address = $ifmatch
    if ($_finduser($ifmatch) != $null) { %handle = $ifmatch }
    else { return 561 $2 }
  }
  else { return 559 $2 }
  if ($_partyline.chlevels($1,%handle)) { return 998 }
  _removeuser %handle
  .remini " $+ $_userinifile $+ " %handle
  _cmdlog $iif($1,$1,$me) deluser $2 ( $+ %handle $+ )
  return 247 %handle
}

;_
; reset +m
; reset [channel]

;_
; resetbans +o|o
; resetbans [channel]

;_
; resetexempts +o|o
; resetexempts [channel]

;_
; resetinvites +o|o
; resetinvites [channel]

; act +o|o
; act [channel] <text>
alias act { _useredit.echocode act $1- }
alias _cmd.act {
  if ($_not($_ischan($2))) {
    if ($1 != $null) { tokenize 32 $1 $iif(%~plparse.cchan,%~plparse.cchan,$null) $2- }
    else { tokenize 32 $1 $iif($1,$1,$null) $2- }
  }
  if ($1 != $null) && ($_not($_ismaster($1,$2,mno))) { return 999 act }
  if ($_not($_ischan($2))) || ($3- == $null) { return 562 }
  if ($me !ison $2) { return 563 $2 }
  _cmdlog $iif($1,$1,$me) ( $+ $2 $+ ) act $3-
  describe $2 $3-
  return 248 $2 $3-
}

;_
; channel +o|o
; channel [channel-name]

; voice +o|o
; voice <nickname> [channel]
alias _cmd.voice {
  if ($2 == $null) { tokenize 32 $1 $null $3 }
  if ($_not($_ischan($3))) { tokenize 32 $1 $2 %~plparse.cchan }
  if ($_not($_ismaster($1,$3,mno))) { return 999 voice }
  if ($_not($_ischan($3))) || ($2 == $null) { return 564 voice }
  if ($me !isop $3) { return 565 $3 }
  if ($2 !ison $3) { return 566 $2 $3 }
  _cmdlog $1 ( $+ $3 $+ ) voice $2
  voice $3 $2
  return 249 $2 $3
}

; devoice +o|o
; devoice <nickname> [channel]
alias _cmd.devoice {
  if ($2 == $null) { tokenize 32 $1 $null $3 }
  if ($_not($_ischan($3))) { tokenize 32 $1 $2 %~plparse.cchan }
  if ($_not($_ismaster($1,$3,mno))) { return 999 devoice }
  if ($_not($_ischan($3))) || ($2 == $null) { return 564 devoice }
  if ($_partyline.chlevels($1,$2,$3)) { return 567 $2 $3 }
  if ($me !isop $3) { return 565 $3 }
  if ($2 !ison $3) { return 566 $3 }
  _cmdlog $1 ( $+ $3 $+ ) devoice $2
  devoice $3 $2
  return 250 $2 $3
}

; deop +o|o
; deop <nickname> [channel]
alias _cmd.deop {
  if ($2 == $null) { tokenize 32 $1 $null $3 }
  if ($_not($_ischan($3))) { tokenize 32 $1 $2 %~plparse.cchan }
  if ($_not($_ismaster($1,$3,mno))) { return 999 deop }
  if ($_not($_ischan($3))) || ($2 == $null) { return 564 deop }
  if ($_nick2hand($2) != $null) {
    if ($_partyline.chlevels($1,$ifmatch,$2)) { return 567 $3 $2 }
  }
  if ($me !isop $3) { return 565 $3 }
  _cmdlog $1 ( $+ $3 $+ ) deop $2
  if ($2 !ison $3) { return 566 $2 $3 }
  if ($2 == $me) { return 598 $3 }
  deop $3 $2
  return 251 $2 $3
}


; invite +o|o
; invite <nickname> [channel]
alias _cmd.invite {
  if ($2 == $null) { tokenize 32 $1 $null $3 }
  if ($_not($_ischan($3))) { tokenize 32 $1 $2 %~plparse.cchan }
  if ($_not($_ismaster($1,$3,mno))) { return 999 deop }
  if ($_not($_ischan($3))) || ($2 == $null) { return 564 invite }
  if ($me !ison $3) { return 563 $3 }
  if ($2 ison $3) { return 568 $2 $3 }
  _cmdlog $1 ( $+ $3 $+ ) invite $2
  _putserv $2 & invite $2 $3
  return 252 $2 $3
}

; kick +o|o
; kick [channel] <nickname> [reason]
alias _cmd.kick {
  if ($_not($_ischan($2))) { tokenize 32 $1 $iif(%~plparse.cchan,%~plparse.cchan,$null) $2- }
  if ($_not($_ismaster($1,$2,mno))) { return 999 kick }
  if ($_not($_ischan($2))) || ($3 == $null) { return 569 }
  if ($me !isop $2) { return 565 $2 }
  _cmdlog $1 ( $+ $2 $+ ) kick $3 $4-
  if ($3 == $me) { return 597 $2 $3 }
  if ($3 !ison $2) { return 566 $3 $2 }
  if ($_nick2hand($3) != $null) {
    var %victimhandle = $ifmatch
    if ($_partyline.chlevels($1,%victimhandle,$2)) { return 567 $3 $2 }
    if (b isincs $_nickflags(%victimhandle)) && ($_not($_ismaster($1,$2,n))) { return 599 $3 $2 }
  }
  kick $2 $3 $iif($len($4-),$4-,request)
  return 254
}

; kickban +o|o
; kickban [channel] [-|@]<nickname> [comment]
alias _cmd.kickban {
  var %nick,%fulladdress,%hostmask,%masktype,%sticky = 0
  if ($_not($_ischan($2))) { tokenize 32 $1 $iif(%~plparse.cchan,%~plparse.cchan,$null) $2- }
  if ($_not($_ismaster($1,$2,mno))) { return 999 kickban }
  if ($_not($_ischan($2))) || ($3 == $null) { return 587 }
  if (@* iswm  $3) { var %masktype = 2,%nick = $right($3,-1) }
  elseif (-* iswm  $3) { var %masktype = 1,%nick = $right($3,-1) }
  else { var %masktype = 3,%nick = $3 }
  _cmdlog $1 ( $+ $2 $+ ) kickban $3 $4-
  if ($me !isop $2) { return 565 $2 }
  if (%nick == $me) { return 600 $2 }
  if ($_nick2hand(%nick) != $null) {
    var %victimhandle = $ifmatch
    if ($_partyline.chlevels($1,%victimhandle,$2)) { return 567 %nick $2 }
    if (b isincs $_nickflags(%victimhandle)) && ($_not($_ismaster($1,$2,n))) { return 599 $3 $2 }
  }
  if (%nick !ison $2) { return 566 %nick $2 }
  if ($left($4-,1) == *) {
    %sticky = 1
    tokenize 32 $1 $2 $3 $right($4-,-1)
  }
  tokenize 32 $1 $2 $3 $iif($len($4-),$4-,request)
  if ($_address(%nick,%masktype) !iswm %miaddress) { __cmd.+ban.setban $2 $ifmatch $1 $ctime $calc(60 * $_getsetup(script,ban-time)) 0 %sticky $4- }
  .timer 1 1 kick $2 %nick $4-
  return 254
}

; msg +o
; msg <nickname> <text>
alias _cmd.msg {
  if ($_not($_ismaster($1,0,mno))) { return 999 msg }
  if ($2 == $null) || ($3- == $null) { return 570 }
  _cmdlog $1 msg $2 $3-
  _puthelp $2 & msg $2 $3-
  return 255 $2 $3-
}

; op +o|o
; op <nickname> [channel]
alias _cmd.op {
  var %victimhandle,%flags
  if ($2 == $null) { tokenize 32 $1 $null $3 }
  if ($_not($_ischan($3))) { tokenize 32 $1 $2 %~plparse.cchan }
  if ($_not($_ismaster($1,$3,mno))) { return 999 op }
  if ($_not($_ischan($3))) || ($2 == $null) { return 564 op }
  if ($me !isop $3) { retuen 565 $3 }
  _cmdlog $1 ( $+ $3 $+ ) op $2
  if ($2 !ison $3) { return 566 $2 $3 }
  if ($_nick2hand($2) != $null) {
    var %victimhandle = $ifmatch,%flags = $_nickflags(%victimhandle,$3)
    if ($_partyline.chlevels($1,%victimhandle,$3)) { return 567 $2 $3 }
    if (d isincs %flags) { return 601 $2 $3 }
  }
  if ($_prot.chansetting(cubitchmode,19,1,$3)) {
    if (%victimhandle != $null) {
      if ($_not($_ismaster(%victimhandle,$3,mno))) { return 602 $2 $3 }
    }
    else { return 602 $2 $3 }
  }
  op $3 $2
  return 253 $2 $3
}

; say +o|o
; say [channel] <text>
alias _cmd.say {
  if ($_not($_ischan($2))) { tokenize 32 $1 $iif(%~plparse.cchan,%~plparse.cchan,$null) $2- }
  if ($_not($_ismaster($1,$2,mno))) { return 999 say }
  if ($_not($_ischan($2))) || ($3- == $null) { return 571 }
  if ($me !ison $2) { return 603 $2 }
  if ($_ischanmode($2,m)) && ($me !isop $2) && ($me !isvo $2) { return 604 $2 }
  _cmdlog $1 ( $+ $2 $+ ) say $3-
  _puthelp $2 c& msg $2 $3-
  return 256 $2 $3-
}

; topic +o|o
; topic [channel] <text>
alias _cmd.topic {
  if ($_not($_ischan($2))) { tokenize 32 $1 $iif(%~plparse.cchan,%~plparse.cchan,$null) $2- }
  if ($_not($_ismaster($1,$2,mno))) { return 999 topic }
  if ($_not($_ischan($2))) { return 572 }
  if ($me !ison $2) { return 563 $2 }
  if ($len($3-) == 0) {
    if ($len($chan($2).topic) == 0) { return 257 $2 }
    return 258 $2 $chan($2).topic
  }
  if ($me !isop $2) && ($_ischanmode($2,t)) { return 573 $2 }
  .timer -o 1 0 _cmdlog $1 ( $+ $2 $+ ) topic $3-
  _putserv $2 c& .raw topic $2 : $+ $3-
  return 259 $2 $3-
}