aIRC — File Browser
aIRCv0.8.69 / aIRCv0.8.69 / script / partyline3.mrc
partyline3.mrc — 20.02 KB — Download this file
;/**********************************************************************
; *
; * aIRC
; * Partyline (commands)
; *
; **********************************************************************/
;;
;
; -( CMDS2 )-
;
;;
;_
; fixcodes
; fixcodes
; ignores +m
; ignores [wildcard]
; (aIRC modified command)
alias ignores { _useredit.echocode ignores $1- }
alias _cmd.ignores {
if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 ignores }
_cmdlog $iif($1,$1,$me) ignores $2-
if ($2 == $null) { tokenize 32 $1 * }
var %file = $_igninifile,%win = @__loadignores,%wins = @__ignores,%i = 1,%n,%line
_start.ignores
_openwins %win %wins
loadbuf %win $"(%file)
%n = $line(%win,0)
if (%n == 0) {
close -@ %wins %win
return 552
}
aline %wins Currently ignoring:
while (%i <= %n) {
%line = $line(%win,%i)
if ($2 iswm $gettok(%line,1,32)) { __cmd.ignores.ignores %i %line }
inc %i
}
return 222 %wins %wins $+ , $+ %win
}
alias __cmd.ignores.ignores {
var %exp = (perm),%creatn = $abs($calc($ctime - $4)),%creat,%ignoring,%i = 1,%win = @__ignores
while (%i <= 6) {
if ($mid(pcntik,%i,1) isincs $6) { %ignoring = $addtok(%ignoring,$gettok(private.channel.notice.ctcp.invite.control codes,%i,46),44) }
inc %i
}
if ($5) { %exp = (expires at $asctime($calc($4 + $5),HH:nn) $+ ) }
if (%creatn > 3600) {
%creatn = $round($calc(%creatn / 3600),0)
%creat = Created $_nsingoplur(%creatn,day,days) ago
}
else { %creat = Created $asctime($4,HH:nn) }
aline %win [ $+ $_filleft(3, ,$1) $+ ] $2 %exp
aline %win $3 $+ : $7-
aline %win ignoring: %ignoring
aline %win %creat
}
;_
; link +t
; link [some-bot] <new-bot>
;_
; loadmod +n
; loadmod <module>
; match +o|o
; match <attr> [channel] [[start] limit]
; match <wildcard-string> [[start] limit]
alias match { _useredit.echocode match $1- }
alias _cmd.match {
if ($2 == $null) { return 579 }
var %win = @__match,%rwin = @__matchr,%start,%limit,%chan,%t,%i,%h,%hosts,%host,%crap = $3-,%file = $_userinifile,%user,%matching,%total,%handleonly = $_getsetup(script,_onlyhandlesinmatch),%nolog = 0
if (%c.partyline.match.handleonly) { %handleonly = 1 }
if (%c.partyline.match.nolog) { %nolog = 1 }
unset %c.partyline.match.*
_openwins %win %rwin
if ($left($2,1) isin -+|&) {
if (| isin $2) || (& isin $2) {
if ($_ischan($3)) {
%chan = $3
if ($_isint($4)) {
if ($_isint($5)) { var %start = $4,%limit = $5 }
else { var %start = 1,%limit = $4 }
}
}
elseif (%~plparse.cchan != $null) { %chan = $ifmatch }
elseif ($1 == $null) { %chan = $chan }
if ($1 != $null) && ($_not($_ismaster($1,%chan,mno))) {
close -@ %win %rwin
return 999 match
}
}
elseif ($1 != $null) && ($_not($_ismaster($1,0,mno))) {
close -@ %win %rwin
return 999 match
}
%t = $2
%i = 1
while ($_ruini($ini(%file,%i),handle) != $null) {
%user = $ifmatch
if ($_matchattr(%user,%t,%chan)) { aline %win %user }
inc %i
}
%matching = %t %chan
}
elseif ($1 != $null) && ($_not($_ismaster($1,0,mno))) {
close -@ %win %rwin
return 999 match
}
elseif (* isin $2) || (? isin $2) {
%i = 0
:loop2
inc %i
if ($_ruini($ini(%file,%i),handle) != $null) {
%user = $ifmatch
if ($2 iswm %user) { aline %win %user }
else {
%h = 0
%hosts = $_ruini(%user,hosts)
:loop3
inc %h
if ($gettok(%hosts,%h,32) != $null) {
%host = $ifmatch
if ($2 iswm %host) {
aline %win %user
goto loop2
}
goto loop3
}
}
goto loop2
}
%matching = $2
}
elseif ($_isuser($2)) {
aline %win $2
%matching = $2
}
if ($_not($_isint(%start))) {
if ($_isint($3)) {
if ($_isint($4)) { var %start = $3,%limit = $4 }
else { var %start = 1,%limit = $3 }
}
else { var %start = 1,%limit = 20 }
}
%total = $line(%win,0)
aline %rwin *** Matching ' $+ %matching $+ ':
if (%total == 0) {
aline %rwin HANDLE PASS NOTES FLAGS LAST
aline %rwin --- Found 0 matches.
}
else {
aline %rwin HANDLE PASS NOTES FLAGS LAST
if (%total > %limit) { dline %win $calc(%limit + 1) $+ - }
if (%start > 1) {
aline %rwin (skipping first $calc(%start - 1) $+ )
dline %win 1- $+ $calc(%start - 1)
}
if (%handleonly) {
filter -ww %win %rwin
dline %rwin 2
}
else {
%i = 1
while ($line(%win,%i) != $null) {
__cmd.whois.win $1 $ifmatch %rwin
inc %i
}
}
if (%total > %limit) { aline %rwin (more than %limit matches; list truncated) }
aline %rwin --- Found %total matches.
}
if ($_not(%nolog)) { _cmdlog $iif($1,$1,$me) match $2- }
return 222 %rwin %win $+ , $+ %rwin
}
;_
; me
; me <text>
;_
; module +n
; module [modulename]
;_
; modules +n
; modules <botname>
; motd
; motd
alias _cmd.motd {
var %file = $_usrdir(partyline.motd),%win = @__motd,%filet = $_tmpdir(motd.tmp),%strip = $_pls.get($sockname,strip)
_cmdlog $1 motd
if ($isfile(%file)) {
close -@ %win
window -h %win
loadbuf %win $"(%file)
_eggtext.parse $1 1 %win %filet
if ($file(%filet).size) { _plfile2sock $sockname $iif(%strip,%strip,$null) %filet }
_remove %filet
}
}
; newpass
; newpass <password>
alias _cmd.newpass {
tokenize 32 $strip($1-)
if ($2 == $null) { return 553 }
if ($len($2) < 6) { return 508 $2 }
_setuserfield $1 pass $_crypt($2)
_cmdlog $1 newpass...
return 243 $2
}
;_
; handle
; handle <handle>
alias _cmd.handle {
if ($2 == $null) { return 554 }
tokenize 32 $1 $_fixhandle($2)
if ($_isinvalidinitialchar4handle($2)) { return 594 $left($2,1) }
if ($_validateuser(3,$2,$null)) { return $ifmatch $2 }
_removeuser $1
flushini " $+ $_userinifile $+ "
write -s[ $+ $1 $+ ] " $+ $_userinifile $+ " $chr(91) $+ $2 $+ $chr(93)
flushini " $+ $_userinifile $+ "
_wuini $2 handle $2
var %h = $_ruini($2,hosts)
if (%h != $null) {
var %i = 1,%t = $numtok(%h,32)
while (%i <= %t) {
_auser $2 $gettok(%h,%i,32)
inc %i
}
}
_cmdlog $1 nick $2
_partyline.chhandle $1 $2
return 268 $1 $2
}
;_
; page
; page <# or off>
;_
; rehash +m
; rehash
;_
; rehelp +n
; rehelp
;_
; relay +t
; relay <botname>
; reload +m|m
; reload
alias _cmd.reload {
if ($_not($_ismaster($1,1,mn))) { return 999 reload }
_cmdlog $1 reload
_start.users
_cmdlog Userfile loaded, unpacking...
_plsw Reloading user file...
}
;_
; restart +m
; restart
; save +m|m
; save
alias usave { _useredit.echocode save $1- }
alias _cmd.save {
var %nolog = 0
if (%c.partyline.save.nolog) { %nolog = 1 }
unset %c.partyline.save.nolog
if ($1 != $null) && ($_not($_ismaster($1,1,mn))) { return 999 save }
_userinifile.setheader $_userinifile
if ($_not(%nolog)) { _cmdlog $iif($1,$1,$me) save }
if ($_not($_getsetup(script,quiet-save))) {
.timer -mo 1 0 _putlog Writing user file...
.timer -mo 1 100 _putlog Writing channel file ...
}
return 310
}
; backup +m|m
; backup
alias _cmd.backup {
if ($_not($_ismaster($1,1,mn))) { return 999 backup }
_cmdlog $1 backup
_plsw Backing up the user file..
_putlog Backing up user file...
var %file = $_userinifile
copy -o $"(%file) " $+ $puttok(%file,bak,$numtok(%file,46),46) $+ "
}
;_
; simul +n
; simul <nickname> <text>
; strip
; strip [modes]
; strip +m
; strip <user> [modes]
alias strip { _useredit.echocode strip $1- }
alias _cmd.strip {
var %handle,%flags,%index,%sock,%o
if ($1 == $null) {
if ($2 == $null) { return 616 }
if ($_validateuser(4,$2,$null)) { return $ifmatch $2 }
var %handle = $2,%flags = $3
}
elseif ($2 == $null) {
if ($_pls.get($sockname,strip) != $null) { return 304 $ifmatch }
return 305
}
elseif ($left($2,1) isin -+) { var %handle = $1,%flags = $2 }
else { var %handle = $2,%flags = $3 }
if ($1 != $null) && ($1 != %handle) {
if ($_not($_ismaster($1,0,mn))) || ($_partyline.chlevels($1,%handle)) { return 998 strip }
}
if ($1 != $null) && ($1 == %handle) { %sock = $sockname }
else { var %index = partyline*. $+ %handle $+ ._l*,%sock = $sock(%index,1) }
if (%sock == $null) { return 551 %handle }
_cmdlog $iif($1,$1,$me) strip $iif($1 != %handle,%handle) %flags
%o = $_pls.get(%sock,strip)
if (%flags == $null) {
if (%handle == $1) {
if (%o != $null) { return 304 $ifmatch }
return 305
}
if (%o != $null) { return 306 %handle $ifmatch }
return 307 %handle
}
%o = $__cmd.strip.cmodes(%o,%flags)
_pls.set %sock strip %o
if (%handle == $1) {
if (%o != $null) { return 308 $ifmatch }
return 309
}
_pl.swcrlf %sock $iif($1,$1,$me) set your strip settings to: $iif(%o,%o,-) $__cmd.strip.rmodes(%o)
if (%o != $null) { return 306 %handle $ifmatch }
return 307 %handle
}
alias __cmd.strip.rmodes {
if ($1 == $null) { return }
var %t
if (b isincs $1) { %t = %t bold, }
if (c isincs $1) { %t = %t color, }
if (r isincs $1) { %t = %t reverse, }
if (u isincs $1) { %t = %t underline, }
if (a isincs $1) { %t = %t ansi, }
if (g isincs $1) { %t = %t bells, }
if (*, iswm %t) { %t = $left(%t,-1) }
if (%t != $null) { return ( $+ %t $+ ) }
return (none)
}
; $__cmd.strip.cmodes(originalmodes,+-mpjkcobxsdw)
alias __cmd.strip.cmodes {
var %i = 1,%r,%t
while (%i <= $len($2)) {
if ($mid($2,%i,1) isincs -+bcruag) { %r = %r $+ $ifmatch }
inc %i
}
%r = $_changemodes($1,%r)
if (b isincs %r) { %t = %t b }
if (c isincs %r) { %t = %t c }
if (r isincs %r) { %t = %t r }
if (u isincs %r) { %t = %t u }
if (a isincs %r) { %t = %t a }
if (g isincs %r) { %t = %t g }
if ($remove(%t,$chr(32)) != $null) { return $ifmatch }
}
; su
; su <user>
alias _cmd.su {
if ($2 == $null) { return 529 }
if ($_validateuser(4,$2,$null)) { return $ifmatch $2 }
if ($_not($_partylineaccess($2))) { return 595 $2 }
if ($_userpass($2) == $null) { return 530 $2 }
_cmdlog $1 su $2
_partyline.show left $1
if ($_ismaster($1,0,n)) && ($_not($_ismaster($2,0,n))) { _partyline.welcome $2 }
else {
_plsw Enter password for $2
sockmark $sockname $puttok($puttok($sock($sockname).mark,$2,2,9),0,1,9)
_sockrename $sockname $puttok($puttok($sockname,$2,2,46),$removecs($gettok($sockname,3,46),l),3,46)
}
}
;_
; trace
; trace <bot>
;_
; unlink +t
; unlink <bot>
;_
; unloadmod +n
; unloadmod <module>
; whom
; whom [channel]
alias whom { _useredit.echocode who $1- }
alias _cmd.whom {
_cmd.who $1-
return $result
}
; who
; who [bot]
alias _cmd.who {
var %i = 1,%index = partyline*.*._l*,%n = $sock(%index,0),%master = 0,%owner = 0,%sock
if ($1 == $null) { var %master = 1,%owner = 1 }
else {
if (n isincs $_nickflags($1)) { %owner = 1 }
if (m isincs $_nickflags($1)) { %master = 1 }
}
close -@ @__who
window -h @__who
_cmdlog $iif($1,$1,$me) who
aline @__who Party line members: (* = owner, + = master, @ = op)
while (%i <= %n) {
var %handle,%idx,%flags,%pf,%host,%console,%away
%sock = $sock(%index,%i)
%handle = $gettok(%sock,2,46)
if (%owner) { %idx = [[ $+ $remove($gettok(%sock,1,46),partyline) $+ ]] }
%flags = $_nickflags(%handle)
if (n isincs %flags) { %pf = * }
elseif (m isincs %flags) { %pf = + }
elseif (o isincs %flags) { %pf = @ }
elseif (t isincs %flags) { %pf = $chr(37) }
else { %pf = }
%host = $sock(%sock).ip
if (%master) {
if ($removecs($gettok(%sock,3,46),_,l,@) != $null) { %console = (con: $+ $ifmatch $+ ) }
}
if ($_pls.get(%sock,awaymsg) != $null) { %away = $ifmatch }
aline @__who %idx $+ $+ %pf $+ $_fillright(9, ,%handle) %host %console
if (%away != $null) { aline @__who AWAY: $ifmatch }
inc %i
}
return 222 @__who @__who
}
; whois +o|o
; whois <nickname>
alias uwhois { _useredit.echocode whois $1- }
alias _cmd.whois {
if ($1 != $null) && ($_not($_ismaster($1,1,mnot))) { return 999 whois }
if ($2 == $null) { return 556 }
if ($_validateuser(4,$2,$null)) { return $ifmatch $2 }
_cmdlog $iif($1,$1,$me) whois $2
var %win = @__whois
_openwins %win
aline %win HANDLE PASS NOTES FLAGS LAST
__cmd.whois.win $1 $2 %win
return 222 %win %win
}
; __cmd.whois.win <requester> <requested> <@window>
alias __cmd.whois.win {
var %win = $3,%chans = $_ruini($2,channels),%chan,%n = $numtok(%chans,32),%i = 1,%last
if ($window($3) == $null) { _openwins %win }
if ($_getuserfield($2,laston) != $null) {
%last = $ifmatch
%last = $_shortdate($gettok(%last,1,32)) ( $+ $gettok(%last,2,32) $+ )
}
else { %last = never (nowhere) }
aline %win $_fillright(9, ,$2) $iif($_userpass($2) != $null,yes ,no ) $_filleft(5, ,$_notes.number($2)) $_fillright(15, ,$iif($_nickflags($2) != $null,$_nickflags($2),-)) %last
while (%i <= %n) {
%chan = $gettok(%chans,%i,32)
if ($1 == $null) || ($_ismaster($1,%chan,mno)) {
if ($_getuserfield($2,$_nospaces(laston.,%chan)) != $null) { %last = $_shortdate($ifmatch) }
else { %last = never }
aline %win $+ $_fillright(18, ,%chan) $_fillright(15, ,$iif($_ruini($2,%chan) != $null,$_ruini($2,%chan),-)) %last
if ($_getuserfield($2,$_nospaces(infoline.,%chan)) != $null) { aline %win INFO: $ifmatch }
}
inc %i
}
if ($1 == $null) || ($_ismaster($1,0,mn)) {
if ($_getuserfield($2,comment) != $null) { aline %win COMMENT: $ifmatch }
}
if ($_ruini($2,hosts) != $null) { aline %win HOSTS: $ifmatch }
if ($_getuserfield($2,infoline.default) != $null) { aline %win INFO: $ifmatch }
var %i = 1,%t = $_getsetup(script,whois-fields),%n = $numtok(%t,32),%field
while (%i <= %n) {
%field = $upper($gettok(%t,%i,32))
if ($_getuserfieldp($2,%field) != $null) { aline %win $+ %field $+ : $ifmatch }
inc %i
}
if ($1 == $null) || ($_ismaster($1,0,mn)) {
var %cchan = $_ruini($2,console-chan),%cflags = $_ruini($2,console-flags),%echo = $_ruini($2,echo)
if (%echo != $null) {
aline %win Saved Console Settings:
aline %win Channel: %cchan
aline %win Console flags: $iif(%cflags != $null,%cflags,-) $+ , Strip flags: -, Echo: $iif(%echo,yes,no)
aline %win Page setting: 0, Console channel: 0
}
}
return %win
}
;_
; status +m|m
; status
; uptime +m|m
; uptime
alias uptime { _useredit.echocode uptime $1- }
alias _cmd.uptime {
if ($1 != $null) && ($_not($_ismaster($1,1,mn))) { return 999 uptime }
_cmdlog $iif($1,$1,$me) uptime
return 303 $readini -n " $+ $_tmpdir(session.ini) $+ " script uptime
}
;;
;
; -( CORE )-
;
;;
; help
alias _cmd.help {
var %file = etc\help\pl_main.help,%win = @__help,%filet = $_tmpdir(help.tmp),%initopic = $2,%strip = $_pls.get($sockname,strip)
if ($2 == $null) { %initopic = help }
if ($2 == vbottree) { %initopic = bottree }
_cmdlog $1 help $2-
if ($2 == set) && ($3 != $null) {
if ($istok($_getsetup(script,_partyline.setfields),$3,32) == $false) {
_plsw No help available on that.
return
}
%file = etc\help\pl_set.help
%initopic = $3
}
elseif ($istok($_getsetup(script,_partyline.commands),%initopic,32) == $false) {
_plsw No help available on that.
return
}
if ($ini(%file,%initopic)) {
close -@ %win
window -h %win
loadbuf -t $+ %initopic %win $"(%file)
_eggtext.parse $1 1 %win %filet
if ($file(%filet).size) { _plfile2sock $sockname $iif(%strip,%strip,$null) %filet }
else { _plsw No help available on that. }
_remove %filet
}
else { _plsw No help available on that. }
}
;_
; +lang +n
; +lang <language>
;_
; -lang +n
; -lang <language>
;_
; +lsec +n
; +lsec <section>
;_
; -lsec +n
; -lsec <section>
;_
; lstat +n
; lstat
;_
; relang +n
; relang
;_
; helpparty
; set +n
; set <variable> [value]
alias uset { _useredit.echocode set $1- }
alias _cmd.set {
tokenize 32 $strip($1-)
if ($1 != $null) && ($_not($_ismaster($1,0,n))) { return 999 set }
_cmdlog $iif($1,$1,$me) set $2 $3-
if ($2 == $null) { return 518 }
if ($1 != $null) && ($_getsetup(script,must-be-owner)) && ($istok($_getsetup(script,owner),$1,32) == $false) { return 999 set }
if ($istok($_partyline.setfields,$2,32) == $false) || (($1 != $nul) && ($istok($_getsetup(script,_partyline.setfields),$2,32) == $false)) { return 519 $2 }
if ($2 == chanfile) { return 214 $2 $_chaninifile }
if ($2 == userfile) { return 214 $2 $_userinifile }
if ($2 == motd) { return 214 $2 $_usrdir(partyline.motd) }
if ($2 == telnet-banner) { return 214 $2 $_usrdir(partyline.banner) }
if ($2 == help-path) { return 214 $2 etc\help }
if ($2 == temp-path) { return 214 $2 $remove($_tmpdir,$mircdir) }
if ($2 == mod-path) { return 214 $2 addons }
if ($2 == network) { return 214 $2 %.network }
if ($2 == username) { return 214 $2 $gettok($_mini(mirc,email),1,64) }
if ($2 == version) { return 214 $2 $_vers $+ +win $+ $bits $_aircvernum win $+ $bits }
if ($2 == uptime) { return 214 $2 $readini -n " $+ $_tmpdir(session.ini) $+ " script uptime }
if ($2 == numversion) { return 214 $2 $_aircvernum }
if ($2 == modes-per-line) { return 214 $2 %.maxmodes }
if ($2 == notefile) { return 214 $2 $_noteinifile }
if ($2 == altnick) { return 214 $2 $_mini(mirc,anick) }
if ($2 == realname) { return 214 $2 $_mini(mirc,user) }
if ($2 == botnick) { return 214 $2 $me }
if ($2 == server-online) { return 214 $2 $calc($ctime - $online) }
if ($2 == nick) { return 214 $2 $me }
if ($2 == botname) { return 214 $2 %.myaddress }
if ($2 == server) { return 214 $2 $gettok($_mini(mirc,host),2,58) $+ : $+ $port }
if ($2 == offset) { return 214 $2 $round($gettok($_gmt,1,58),0) }
if ($2 == max-logsize) { return 214 $2 $iif($_minio(6,22),$_minio(6,23),0) }
if ($2 == dcc-sanitycheck) { return 214 $2 1 }
if ($2 == dcc-portrange) { return 214 $2 1024:65535 }
if ($2 == use-ison) { return 214 $2 1 }
if ($2 == serverror-quit) { return 214 $2 1 }
if ($2 == kick-method) { return 214 $2 %.maxkicks }
if ($3- == $null) { return 214 $2 $_getsetup(script,$2) }
; server-online keep-nick serverror-quit quiet-reject max-queue-msg nick flood-ctcp flood-msg
; botname server
; 1|0
if ($istok(use-info require-p open-telnets console-autosave learn-users bounce-bans servlimit lowercase-ctcp keep-nick quiet-reject quiet-save stealth-telnets use-telnet-banner paranoid-telnet-flood notify-users notify-onjoin invite-key log-time info-party bounce-modes,$2,32)) {
if ($3- !isnum) { return 520 $2 $3- }
_setsetup script $2 $iif($3-,1,0)
}
; number > 0
elseif ($istok(ban-time ignore-time dcc-flood-thr max-filesize max-bans note-life max-notes max-queue-msg wait-split connect-timeout save-users-at wait-info hourly-updates,$2,32)) {
if ($3- !isnum) { return 520 $2 $3- }
_setsetup script $2 $round($iif($3- <= 0,0,$3),0)
}
; word
elseif ($istok(console default-flags,$2,32)) {
if ($chr(32) isin $3-) { return 521 }
_setsetup script $2 $3-
}
; text (uppercase)
elseif ($istok(whois-fields userinfo-fields,$2,32)) { _setsetup script $2 $upper($3-) }
; text (separated by commas-replace 32 -> 44 )
elseif ($istok(notify-newusers owner,$2,32)) { _setsetup script $2 $replace($3-,$chr(32),$chr(44)) }
; text
elseif ($istok(admin init-server,$2,32)) { _setsetup script $2 $3- }
; flood
elseif ($istok(telnet-flood,$2,32)) {
if ($chr(32) isin $3-) || (0) { return 521 }
if (*?:?* !iswm $3) || (- isin $3) || ($remove($3,:) !isnum) || ($count($3,:) != 1) { return 520 $2 $3- }
_setsetup script $2 $3-
}
return 215 $2 $3-
}