aIRC — File Browser
aIRCv0.8.69 / aIRCv0.8.69 / script / eggalias2.mrc
eggalias2.mrc — 31.49 KB — Download this file
;/**********************************************************************
; *
; * aIRC
; * eggalias 2
; *
; **********************************************************************/
;
_plsw {
if ($sockname != $null) { _pl.swcrlf $sockname $1- }
}
_pl.swcrlf {
if ($sock($1).status == active) {
if ($_sockmark($1,6) != $null) { sockwrite $1 $_strip($2-,$ifmatch) $+ $crlf }
else { sockwrite $1 $2- $+ $crlf }
}
}
; /_plfile2sock socket strip|$null file
_plfile2sock {
var %sent = 0
while (1) {
bread " $+ $3- $+ " %sent 4096 &bin
if ($bvar(&bin,0)) {
inc %sent $ifmatch
breplace &bin 160 32
if ($2 != $null) {
if (b isin $2) { breplace &bin 2 15 }
if (u isin $2) { breplace &bin 31 15 }
if (r isin $2) { breplace &bin 22 15 }
if (c isin $2) { breplace &bin 3 15 }
if (g isin $2) { breplace &bin 7 15 }
}
sockwrite $1 &bin
}
else { break }
}
}
; /_auser <handle> <host>
_auser {
.auser handle; $+ $1 $2
}
; /_ruserhh <handle> <host>
_ruserhh {
.ruser handle; $+ $1 $2
if ($_level($2) == $dlevel) { .ruser $2 }
}
; $_nick2hand(nick)
_nick2hand {
if ($_getaddress($1) != $null) { return $_finduser($ifmatch) }
}
; $_finduser(hostmask)
_finduser {
if ($_level($1) != $dlevel) {
if ($wildtok($ifmatch,handle;?*,1,44)) { return $gettok($ifmatch,2,59) }
}
}
;
; $_level(hostmask)
; Same as $level , but won't return "=" symbols
_level {
var %tmp = $chr(44) $+ _,%level = $replace($level($1),%tmp,$chr(44))
if (=* iswm %level) { return $right(%level,-1) }
return %level
}
; $_rchini(<item>,[#channel])
_rchini {
if ($2) {
if ($readini -n " $+ $_chaninifile $+ " $2 $1 != $null) { return $ifmatch }
}
return $readini -n " $+ $_chaninifile $+ " default $1
}
; $_rchinitxt(<item>,[#channel])
_rchinitxt {
if ($2) {
if ($_rinitxt($_nospaces($1,$2)) != $null) { return $ifmatch }
}
return $_rinitxt($1)
}
; /_wchini <#channel> <item> [contents]
_wchini {
if ($strip($3-) != $null) { writeini " $+ $_chaninifile $+ " $1 $2 $strip($3-) }
elseif ($2 != $null) { remini " $+ $_chaninifile $+ " $1 $2 }
}
_schans {
var %file = $_chaninifile,%i = $ini(%file,0),%r
while (%i) {
if ($ini(%file,%i) != default) { %r = $addtok(%r,$ifmatch,32) }
dec %i
}
return $sorttok(%r,32)
}
_userinifile.setheader {
var %file = $1-,%l1 = $read -nl1 %file,%line = #Av: aIRC v $+ $_vers $+ +win $+ $bits -- $me -- written $asctime($ctime,ddd mmm dd HH:nn:ss yyyy)
if (#?v: * iswm %l1) {
write -l1 $"(%file) %line
if ($read -nl2 %file != $null) { write -il2 $"(%file) }
}
else {
write -il1 $"(%file) %line
write -il2 $"(%file)
}
}
_userinifile {
var %file = $_usrdir(user.ini)
if ($isfile(%file) == $false) {
write -c %file
_userinifile.setheader %file
}
return %file
}
_egglogfile { return $_chfile($_usrdir(egglog.log)) }
_chaninifile { return $_chfile($_usrdir(chan.ini)) }
_baninifile { return $_chfile($_usrdir(ban.ini)) }
_igninifile { return $_chfile($_usrdir(ignore.ini)) }
_noteinifile { return $_chfile($_usrdir(notes.ini)) }
_noteignoreinifile { return $_chfile($_usrdir(noteignores.ini)) }
_pnoteinifile { return $_chfile($_usrdir(pnotes.ini)) }
_isetchan {
if ($_not($_ischan($1))) || (; isin $1) || (! isin $1) || (@ isin $1) || (* isin $1) || (? isin $1) || ($remove($1,=) isnum) { return 0 }
if ($ini($_chaninifile,$1)) { return 1 }
return 0
}
_ruini { return $readini -n " $+ $_userinifile $+ " $1 $2 }
_wuini {
if ($strip($3-) != $null) { writeini " $+ $_userinifile $+ " " $+ $1 $+ " $2 $strip($3-) }
elseif ($2 != $null) { remini " $+ $_userinifile $+ " " $+ $1 $+ " $2 }
}
_validuser { return $_isuser($1) }
_isuser {
var %file = $_userinifile
if ($_readini(%file,$replace($1,[,~,],~),handle) != $null) { return 1 }
return 0
}
_isuserhost {
if ($ulist($1,0)) {
var %t = $ifmatch,%i = 1
while (%i <= %t) {
if ($ulist($1,%i) == $1) { return 1 }
inc %i
}
}
return 0
}
; $_validateuser(<code>,<handle>,<hostmask>)
; cancel if...
; 1 - $2 invalid handle
; 2 - $2 is in userlist
; 4 - $2 isn't in userlist
; 8 - $3 is a hostmask in userlist
; 16 - $3 isn't a hostmask in userlist
; 32 - $3 invalid hostmask
; 64 - $2 isn't a bot
_validateuser {
if ($1 & 1) && ($_not($_isvalidhandle($2))) { return 410 }
if ($1 & 2) && ($_isuser($2)) { return 420 }
if ($1 & 4) && ($_not($_isuser($2))) { return 430 }
if ($1 & 8) && ($_isuserhost($3)) { return 440 }
if ($1 & 16) && ($_not($_isuserhost($3))) { return 450 }
if ($1 & 32) && ($_not($_ismask($_fixmask($3)))) { return 470 }
if ($1 & 64) && (b !isincs $_nickflags($2,$null)) { return 480 }
return 0
}
_isinvalidinitialchar4handle {
var %l = $left($1,1)
if ($asc(%l) <= 32) || ($asc(%l) >= 127) || (%l isin -,+*=:!.@#;$%&) { return 1 }
return 0
}
; $_isvalidhandle(handle,[don't check initial character])
_isvalidhandle {
; if ($_not($2)) && ($_isinvalidinitialchar4handle($left($1,1))) { return 0 }
if ($remove($1,!,",$chr(35),$,%,&,',(,),*,+,$chr(44),-,.,/,0,1,2,3,4,5,6,7,8,9,:,;,<,=,>,?,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,[,\,],^,_,`,$chr(123),$chr(124),$chr(125),~) != $null) { return 0 }
return 1
}
; $_partylineaccess(handle)
_partylineaccess {
var %flags = $_nickflags($1)
if (p isincs %flags) || (t isincs %flags) || ($_ismaster($1,1,mn)) || (($_getsetup(script,require-p)) && ($_ismaster($1,1,o))) { return 1 }
return 0
}
; $_ismaster(handle,<1|0|#channel>,level)
;
; $2 ischan -->> check master in channel
; $2 isnum >= 1 -->> check master in channel or global
; else -->> check global master
;
; $3 -->> flags
;
_ismaster {
if ($2) {
if ($2 isnum) { var %flags = $_nickflagsall($1) }
else { var %flags = $_nickflags($1,$2) }
}
else { var %flags = $_nickflags($1) }
if (n isincs $3) && (n isincs %flags) { return 1 }
if (m isincs $3) && (m isincs %flags) { return 1 }
if (t isincs $3) && (t isincs %flags) { return 1 }
if (o isincs $3) && (o isincs %flags) { return 1 }
if (v isincs $3) && (v isincs %flags) { return 1 }
return 0
}
; /_removeuser <nick>
_removeuser {
_nicklist.col.chandle -tr $1 *
var %hhandle = handle; $+ $1
while ($ulist(*,%hhandle,0)) { _ruserhh $1 $ulist(*,%hhandle,1) }
}
; /_removechannel <channel>
_removechannel {
.remini " $+ $_chaninifile $+ " $1
var %file = $_baninifile
while (1) {
_dummy $read -ns $+ $1 %file
if ($readn) { write -dl $+ $ifmatch $"(%file) }
else { break }
}
_rehashbaninifile
var %i = $_countusers,%file = $_userinifile
while (%i) {
_removechrec $_ruini($ini(%file,%i),handle) $1
dec %i
}
_winitxt _msgonjoin $+ $1
_winitxt _msgonpart $+ $1
_winitxt chantopic $+ $1
_winitxt chanmode $+ $1
}
; /_removechrec <user> <chan>
_removechrec {
_nicklist.col.chandle - $1 $2
_wuini $1 channels $remtok($_ruini($1,channels),$2,1,32)
remini " $+ $_userinifile $+ " $1 $2
_setuserfield $1 laston. $+ $2
_setuserfield $1 infoline. $+ $2
if ($_ruini($1,console-chan) == $2) { _wuini $1 console-chan }
}
; $_partyline.chlevels(changer,changed,[#channel])
; returns 1 if denied
_partyline.chlevels {
if ($1 == $null) { return 0 }
var %r = $_nickflags($1,$3),%d = $_nickflags($2,$3)
if ($istok($_getsetup(script,owner),$2,32)) { return 1 }
if ($istok($_getsetup(script,owner),$1,32)) || (n isincs %r) { return 0 }
if (m isincs %r) && (n !isincs %d) { return 0 }
if (t isincs %r) && ((n !isincs %d) || (m !isincs %d)) { return 0 }
return 1
}
; /_partyline.uconsoleflags <handle>
_partyline.uconsoleflags {
var %s = partyline*. $+ $1 $+ ._l*,%f = _l,%cf,%i = 1,%os,%ns
if ($_ruini($1,console-flags) != $null) { %cf = $ifmatch }
elseif ($_ismaster($1,1,mno)) { %cf = $_getsetup(script,console) }
while ($sock(%s,%i) != $null) {
var %os = $ifmatch,%f = _l
if (@ isin $gettok(%os,4,46)) { %f = %f $+ @ }
%f = %f $+ %cf
_sockrename %os $puttok(%os,%f,3,46)
inc %i
}
}
; /_chuserinfo <user executing command> <field> <command> <handle> <Parms>
_chuserinfo {
if ($1 != $null) && ($_not($_ismaster($1,0,mn))) { return 999 $3 }
if ($4 == $null) { return 509 $2 $3 }
if ($_validateuser(5,$4,$null)) { return $ifmatch $4 }
if ($_partyline.chlevels($1,$4)) { return 998 }
if ($5- == $null) {
if ($_getuserfieldp($4,$2) != $null) { return 280 $4 $2 $ifmatch }
return 281 $4 $2
}
if ($5- == none) {
_setuserfieldp $4 $2
.timer -o 1 0 _putcmdlog $upper($2) for $4 removed by $iif($1,$1,$me)
return 283 $4 $2
}
_setuserfieldp $4 $2 $strip($5-)
.timer -o 1 0 _putcmdlog $upper($2) for $4 set to " $+ $5- $+ " by $iif($1,$1,$me)
return 282 $4 $2 $5-
}
; /_setuserinfo <user executing command> <field> <Parms>
_setuserinfo {
var %result = $__setuserinfo($1,$2,$3-)
.timer -o 1 0 _cmdlog $iif($1,$1,$me) $lower($2) $3-
return %result
}
; __msg.userinfo <field> <parms>
__msg.userinfo {
tokenize 32 $upper($1) $2-
var %reply = _puthelp $nick & _qnotice $nick,%reject = $_not($_getsetup(script,quiet-reject))
if (%+handle == $null) { return }
if ($2- == none) {
%reply Removed your $1 line.
_setuserfieldp %+handle $1
}
elseif ($2- != $null) {
%reply Now: $2-
_setuserfieldp %+handle $1 $2-
}
elseif ($_getuserfieldp(%+handle,$1) != $null) { %reply Currently: $ifmatch }
else { %reply You have no $1 set. }
}
__setuserinfo {
if ($3- == $null) { tokenize 32 $1-2 }
if ($3- == $null) {
if ($_getuserfieldp($1,$2) != $null) { return 263 $2 $ifmatch }
return 264 $2
}
if ($3- == none) {
_setuserfieldp $1 $2
return 265 $2
}
_setuserfieldp $1 $2 $3-
return 266 $2 $3-
}
; $_getuserfield(<nickname>,<field>)
_getuserfield { return $_ruini($1,$_nospaces(__,$2)) }
; /_setuserfield <nickname> <field> [content]
_setuserfield { _wuini $1 $_nospaces(__,$2)) $3- }
; $_getuserfieldp(<nickname>,<field>)
_getuserfieldp { return $_ruini($1,$_nospaces(++,$2)) }
; /_setuserfieldp <nickname> <field> [content]
_setuserfieldp { _wuini $1 $_nospaces(++,$2)) $3- }
; /_user.chchan <user> <channel>
_user.chchan {
var %chans = $_ruini($1,channels)
if ($_ruini($1,$2) != $null) || ($_getuserfield($1,$_nospaces(infoline.,$2)) != $null) || ($_getuserfield($1,$_nospaces(laston.,$2)) != $null) || ($_getuserfield($1,$_nospaces(botaccess.,$2)) != $null) {
_wuini $1 $addtok(%chans,$2,32)
}
}
; $_fixhandle(handle)
_fixhandle {
var %i = 1,%n = $len($1),%t,%r
while (%i <= %n) {
%t = $asc($mid($1,%i,1))
if (%t <= 32) || (%t >= 127) || (%t == 64) { %r = %r $+ ? }
else { %r = %r $+ $chr(%t) }
inc %i
}
return %r
}
; $_maskflags(hostmask,[#channel])
_maskflags { return $_nickflags($_finduser($1),$2) }
; $_nickflags(nick,[#channel])
_nickflags {
var %g,%c
if ($_ischan($2)) {
if ($_ruini($1,$2) != $null) { %c = $ifmatch }
}
if ($_ruini($1,global) != $null) { %g = $ifmatch }
if (o isincs %c) { %g = $removecs(%g,d) }
if (d isincs %c) || (k isincs %c) { %g = $removecs(%g,o,f) }
if (q isincs %c) || (k isincs %c) { %g = $removecs(%g,v) }
return %g $+ %c
}
; $_nickflagsall(nick)
_nickflagsall {
if ($_not($_isuser($1))) { return }
var %i = 1,%chans = $_ruini($1,channels),%t = $numtok(%chans,32),%r = $_ruini($1,global)
while (%i <= %t) {
%r = %r $+ $gettok($_ruini($1,$gettok(%chans,%i,32)),1,32)
inc %i
}
return %r
}
; $_nickflagschans(nick)
_nickflagschans {
if ($_not($_isuser($1))) { return }
var %i = 1,%chans = $_ruini($1,channels),%t = $numtok(%chans,32),%r
while (%i <= %t) {
%r = %r $+ $gettok($_ruini($1,$gettok(%chans,%i,32)),1,32)
inc %i
}
return %r
}
; $_matchattr(handle,[globalflags][[|&]channelflags],#channel)
_matchattr {
tokenize 32 $1-
var %g,%c,%fg,%fc,%m,%vg = 1,%vc = 1
if (*|* iswm $2) {
if (|* iswm $2) { %c = $_fixmodes($remove($2,|)) }
else {
%g = $_fixmodes($gettok($2,1,124))
%c = $_fixmodes($gettok($2,2,124))
}
%m = or
}
elseif (*&* iswm $2) {
if (&* iswm $2) { %c = $_fixmodes($remove($2,&)) }
else {
%g = $_fixmodes($gettok($2,1,38))
%c = $_fixmodes($gettok($2,2,38))
}
%m = and
}
else { %g = $_fixmodes($2) }
if (%g) { %fg = $_nickflags($1) }
if (%c) {
if ($3) { %fc = $gettok($_ruini($1,$3),1,32) }
else { %fc = $_nickflagschans($1) }
}
if (%g) {
var %i = 1,%l
while ($mid(%g,%i,2)) {
%l = $right($ifmatch,1)
if (+* iswm $ifmatch) {
if (%l !isincs %fg) {
%vg = 0
break
}
}
else {
if (%l isincs %fg) {
%vg = 0
break
}
}
inc %i 2
}
}
if (%c) {
var %i = 1,%l
if ($mid(%c,%i,2)) {
%l = $right($ifmatch,1)
if (+* iswm $ifmatch) {
if (%l !isincs %fc) {
%vc = 0
break
}
}
else {
if (%l isincs %fc) {
%vc = 0
break
}
}
inc %i 2
}
}
if (%m == and) {
if (%g == $null) {
if (%vc) { return 1 }
}
elseif (%vg) && (%vc) { return 1 }
}
elseif (%m == or) {
if (%g == $null) {
if (%vc) { return 1 }
}
elseif (%vg) || (%vc) { return 1 }
}
elseif (%vg) { return 1 }
return 0
}
; $_userpass(handle)
_userpass { return $_decrypt($_getuserfield($1,pass)) }
; $_passwdok(handle,pass given by user)
_passwdok {
if ($2 != $null) && ($_userpass($1) ==== $2) { return 1 }
return 0
}
; $_isprot(hostmask,#chan,[0|1])
; if $3 , ignores OP status
_isprot {
if ($gettok($1,1,33) == $me) { return 1 }
if ($_iservice($1)) { return 1 }
var %flags = $_maskflags($1),%chanflags = $_maskflags($1,$2)
if (t isincs %flags) { return 1 }
if ($2 != $null) {
if ($_not($3)) && (%_protectops) && ($_isop($1,#$2)) { return 1 }
if (f isincs %chanflags) || (f isincs %chanflags) || (o isincs %chanflags) || (m isincs %chanflags) || (n isincs %chanflags) { return 1 }
return 0
}
if (b isincs %flags) || (f isincs %flags) || (o isincs %flags) || (m isincs %flags) || (n isincs %flags) { return 1 }
return 0
}
; $_hand2nick(<handle>,[#chan|*],[N|*])
_hand2nick {
if ($2 == $null) { tokenize 32 $1 * $3- }
if ($3 == $null) { tokenize 32 $1-2 1 }
if ($_not($_isuser($1))) || ((($3 !isnum) || ($3 < 0)) && ($3 != *)) {
if ($3 == 0) { return 0 }
return
}
var %f = 0,%chan = $iif($_ischan($2),$2,*),%h,%hosts = $_ruini($1,hosts),%i = 1,%n = $numtok(%hosts,32),%r,%t,%nicklist,%ialtot = 0,%x
while (%i <= %n) {
%h = $gettok(%hosts,%i,32)
%x = 1
%ialtot = $ialchan(%h,%chan,0)
while (%x <= %ialtot) {
%t = $ialchan(%h,%chan,%x)
if ($_finduser(%t) == $1) {
%t = $gettok(%t,1,33)
if ($istok(%r,%t,44) == $false) { inc %f }
if ($len(%r) < 900) { %r = $addtok(%r,%t,44) }
if ($3 == %f) { return %t }
if ($3 == *) {
%nicklist = $addtok(%nicklist,%t,44)
if ($len(%nicklist) > 900) { return %nicklist }
}
}
inc %x
}
inc %i
}
if ($3 == 0) { return %f }
if ($3 == *) { return %nicklist }
}
; /_eggtext.parse <handle> <1=close win|0=don't close win> <window> <file>
_eggtext.parse {
unset %ceggtp.*
var %i = 1,%n = $line($3,0),%line,%index = $chr(37) $+ {*},%index2 = %index $+ ?*,%cvar,%win = @__eggtextparse
close -@ %win
window -h %win
%ceggtp.strip = $null
%ceggtp.show = 1
%ceggtp.center = 0
%ceggtp.cols = 0
%ceggtp.width = 0
while (%i <= %n) {
%line = $line($3,%i)
if (%index iswm %line) && (%index2 !iswm %line) {
%cvar = $gettok($gettok(%line,2,123),1,125)
if (%cvar == end) || (%cvar == -) || (cols=*/* iswm %cvar) || (cols=* iswm %cvar) || (%cvar == center) { _eggtext.parse.dovars %cvar }
else { %ceggtp.show = $_matchattr($1,%cvar) }
}
else {
%line = $replace(%line,$chr(32), )
_eggtext.parseline $1 %line
if (%ceggtp.show) {
if ($result != $null) { _eggtext.parse.aline %win $ifmatch }
}
}
inc %i
}
write -c " $+ $4- $+ "
if ($line(%win,0)) { savebuf %win " $+ $4- $+ " }
close -@ %win
if ($2) { close -@ $3 }
unset %ceggtp.*
}
_eggtext.parse.aline {
if (%ceggtp.cols) {
inc %ceggtp.colN
if (%ceggtp.colN == 1) { aline $1 Â Â Â Â Â }
rline $1 $line($1,0) $line($1,$line($1,0)) $+ $_fillright($round($calc((%ceggtp.width - 5) / %ceggtp.cols),0), ,$2-)
if (%ceggtp.colN == %ceggtp.cols) { %ceggtp.colN = 0 }
}
elseif (%ceggtp.center) {
var %l = $calc((70 - $len($2-)) / 2)
aline $1 $iif(%l > 0,$str(Â ,%l)) $+ $2-
%ceggtp.center = 0
}
else { aline $1 $2- }
}
_eggtext.parse.dovars {
if ($1 == end) {
%ceggtp.show = 1
%ceggtp.center = 0
%ceggtp.cols = 0
%ceggtp.width = 0
%ceggtp.colN = 0
}
elseif ($1 == -) { %ceggtp.show = 1 }
elseif (cols=* iswm $1) {
%ceggtp.center = 0
%ceggtp.colN = 0
if (cols=*/* iswm $1) {
%ceggtp.cols = $gettok($gettok($1,2,61),1,47)
%ceggtp.width = $gettok($1,2,47)
}
else {
%ceggtp.cols = $gettok($1,2,61)
%ceggtp.width = 50
}
}
elseif ($1 == center) {
%ceggtp.center = 1
%ceggtp.colN = 0
%ceggtp.cols = 0
%ceggtp.width = 0
}
}
_eggtext.parseline {
var %line = $2-,%ttt = $chr(37) $+ $chr(37),%b = $chr(37) $+ b,%v = $chr(37) $+ v,%_ = $chr(37) $+ _,%f = $chr(37) $+ f,%E = $chr(37) $+ E,%C = $chr(37) $+ C,%A = $chr(37) $+ A,%T = $chr(37) $+ T,%N = $chr(37) $+ N,%U = $chr(37) $+ U,%vers = aIRC v $+ $_vers $+ +win $+ $bits,%version = aIRC v $+ $_vers $+ +win $+ $bits (c)1997-2001 tabo,%UU = mIRC $+ $bits $+ v $+ $version
%line = $replacecs(%line,%ttt,<_-_CHR_-_37_-_>)
%line = $replacecs(%line,%b,,%v,,%_,,%f,,%E,%version,%C,$_mychans,%A,$_getsetup(script,admin),%T,$asctime($ctime,HH:nn),%N,$1,%U,%UU)
if (%ceggtp.strip != $null) { %line = $_strip(%line,%ceggtp.strip) }
var %B = $chr(37) $+ B,%V = $chr(37) $+ V
%line = $replacecs(%line,%B,$me,%V,%vers)
var %i,%index = $chr(37) $+ $chr(123),%r,%f,%t,%n,%show = 1,%ifmatch
if ($pos(%line,%index,0)) {
%line = $chr(37) $+ {-} $+ %line
while ($pos(%line,%index,1)) {
var %t,%f = $gettok($gettok(%line,2,123),1,125),%line = $gettok(%line,2-,125)
if ($pos(%line,%index,1)) {
%ifmatch = $ifmatch
if ($pos($left(%line,$calc(%ifmatch - 1)),%index,1) != 1) {
%t = $left(%line,$calc(%ifmatch - 1))
%line = $right(%line,$calc((%ifmatch - 1) * -1))
}
}
elseif ($pos(%line,%index,1) != 1) {
%t = %line
var %line
}
_eggtext.parse.dovars %f
if (%t != $null) && (%ceggtp.show) {
if (%f == end) || (%f == -) || (cols=*/* iswm %f) || (cols=* iswm %f) || (%f == center) || ($_matchattr($1,%f)) { %r = %r %t }
}
}
%line = $right(%r,-1)
if (%line == See also: ) { var %line }
}
%line = $replace(%line,<_-_CHR_-_37_-_>,$chr(37))
return $iif(%line != $null,%line,$null)
}
partyline {
var %onoff,%port,%show = 1
if ($1 !isnum) {
if ($istok(on off,$1,32)) { %onoff = $iif($1 == on,1,0) }
tokenize 32 $2-
}
if ($_isint($1)) { %port = $1 }
elseif ($_isint($_getsetup(script,_partylineport))) { %port = $ifmatch }
else { %port = 3333 }
if (%onoff == $null) { }
elseif (%onoff) {
if ($_partyline.init(%port)) {
%show = 0
error.a Couldn't open partyline, port $^'(%port)
}
}
else { sockclose partyline* }
if ($show) && (%show) { info.a Partyline is $iif($sock(partyline),ON,OFF) $_bracket($sock(partyline).port) }
_setsetup script _partyline $iif($sock(partyline),1,0)
if ($sock(partyline).port) { _setsetup script _partylineport $sock(partyline).port }
}
; /_partyline.init
_partyline.init {
if ($1 !isnum) || ($1 <= 0) { tokenize 32 $_getsetup(script,_partylineport) }
if ($sock(partyline)) {
if ($sock(partyline).port != $1) { sockclose partyline }
else { return 0 }
}
if ($portfree($1)) {
socklisten partyline $1
return 0
}
return 1
}
_partyline.welcome {
var %file = $_usrdir(partyline.motd),%win = @__motd,%filet = $_tmpdir(motd.tmp),%cf,%cc,%strip = bcruag
if ($_ruini($1,console-chan) != $null) { %cc = $ifmatch }
elseif ($_comchans($_hand2nick($1,*,1),1) != $null) { %cc = $ifmatch }
elseif ($gettok($_myOPchans,1,32) != $null) { %cc = $ifmatch }
elseif ($gettok($_mychans,1,32) != $null) { %cc = $ifmatch }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Make default channel option!
else { %cc = #lamest }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
sockmark $sockname 1 $+ $chr(9) $+ $1 $+ $chr(9) $+ $1 $+ $chr(9) $+ %cc $+ $chr(9) $+ $null $+ $chr(9) $+ $iif(%strip,%strip,$null) $+ $chr(9) $+ $_pls.get($sockname,type) $+ $chr(9) $+ $_pls.get($sockname,ident) $+ $chr(9) $+ _ $+ $iif($_ruini($1,echo),e)
var %l = _l@
if ($_ruini($1,console-flags) != $null) { %l = %l $+ $ifmatch }
elseif ($_ismaster($1,1,mno)) { %l = %l $+ $_getsetup(script,console) }
_sockrename $sockname $puttok($puttok($sockname,$1,2,46),%l,3,46)
if ($_getsetup(script,console-autosave)) {
_wuini $2 console-flags $removecs($gettok($sockname,3,46),_,l,@)
_wuini $2 console-chan $_sockmark(4)
_wuini $2 echo $iif(e isincs $_sockmark(9),1,0)
}
_setuserfield $1 laston $ctime partyline
_plsw Connected to $me $+ , running aIRC v $+ $_vers $+ +win $+ $bits (c)1997-2001 tabo
_plsw $_aircweb $+ $cr $+ $crlf $+ $cr $+ $crlf
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
}
_plsw Commands start with '.' (like '.quit' or '.help')
_plsw Everything else goes out to the party line. $+ $crlf
_partyline.noteswaiting
_partyline.show join $1
if ($_getsetup(script,info-party)) {
if ($_getuserfield($1,infoline.default) != $null) {
if ($_inputcom(@,$ifmatch) != $null) { _partyline.display * * * * * *** [[ $+ $1 $+ ]] $ifmatch }
}
}
}
; $_partyline.isonline(handle)
_partyline.isonline {
var %socks = partyline*. $+ $1 $+ ._l*
return $sock(%socks,0)
}
; /_partyline.msgtohandle handle msg
_partyline.msgtohandle {
var %wc = partyline*. $+ $1 $+ ._l*,%i = 1,%n = $sock(%wc,0)
while (%i <= %n) {
_pl.swcrlf $sock(%wc,%i) $2-
inc %i
}
}
_partyline.chhandle {
var %i = 1,%index = partyline*.*._*,%n = $sock(%index,0),%sock,%file = $_noteinifile,%note,%nc = 0
while (%i <= %n) {
%sock = $sock(%index,%i)
if ($_sockmark(%sock,2) == $1) { sockmark %sock $puttok($sock(%sock).mark,$2,2,9) }
if ($_sockmark(%sock,3) == $1) { sockmark %sock $puttok($sock(%sock).mark,$2,3,9) }
if ($gettok(%sock,2,46) == $1) { _sockrename %sock $puttok(%sock,$2,2,46) }
inc %i
}
while (1) {
%note = $read -ns $+ $1 %file
if ($readn) {
write -l $+ $ifmatch $"(%file) $2 %note
inc %nc
}
else { break }
}
if (%nc) { _partyline.display o m $null t * Switched $_nsingoplur(%nc,note,notes) from $1 to $2 $+ . }
_partyline.show nick $1 $2
}
; /_partyline.noteswaiting
_partyline.noteswaiting {
var %h = $gettok($sockname,2,46),%notes = $_notes.number(%h)
if (%notes) {
_cmd.notes %h index
_useredit.sw $result
}
}
; $_pls.get(session #|sock,prop)
;
; props:
;
; sock
; handle
; consoleflags
; consolechan
; away
; awaymsg
; strip
; type (telnet/dcc)
; ident
; newuser
;
_pls.get {
if ($sock($1)) && (partyline*.* iswm $1) { tokenize 32 $remove($gettok($1,1,46),partyline) $2- }
tokenize 32 $iif($_isint($round($1,0)),$round($1,0),0) $2-
var %sockm = partyline $+ $1 $+ .*,%sock = $sock(%sockm,1)
if ($_not($1)) || (%sock == $null) { return }
if ($2 == $null) || ($2 == sock) { return %sock }
if ($2 == handle) { return $gettok(%sock,2,46) }
if (consolef* iswm $2) { return $gettok(%sock,3,46) }
if (consolec* iswm $2) && ($_ischan($_sockmark(%sock,4))) { return $_sockmark(%sock,4) }
if ($2 == away) { return $iif($_sockmark(%sock,5) != $null,1,0) }
if ($2 == awaymsg) { return $_sockmark(%sock,5) }
if ($2 == strip) { return $_sockmark(%sock,6) }
if ($2 == type) { return $_sockmark(%sock,7) }
if ($2 == ident) { return $_sockmark(%sock,8) }
if ($2 == newuser) { return $iif(n isincs $_sockmark(%sock,9),1,0) }
if ($2 == echo) { return $iif(e isincs $_sockmark(%sock,9),1,0) }
}
_pls.set {
if ($sock($1)) && (partyline*.* iswm $1) { tokenize 32 $remove($gettok($1,1,46),partyline) $2- }
tokenize 32 $iif($_isint($round($1,0)),$round($1,0),0) $2-
var %sockm = partyline $+ $1 $+ .*,%sock = $sock(%sockm,1),%tmp,%mark,%z,%ftmp
if ($_not($1)) || (%sock == $null) { return }
%mark = $sock(%sock).mark
%z = $2
goto %z
:handle | return
:strip | sockmark %sock $puttok(%mark,$iif($3- != $null,$3-,$null),6,9) | return
:away | sockmark %sock $puttok(%mark,$iif($3- != $null,$3-,$null),5,9) | return
:consolechan | sockmark %sock $puttok(%mark,$iif($_ischan($3),$3,0),4,9) | return
:consoleflags
var %tm = _ $+ $iif(@ isin $_pls.get(%sock,consoleflags),@) $+ $iif(l isincs $_pls.get(%sock,consoleflags),l) $+ $iif($3 != $null,$3)
_sockrename %sock $puttok(%sock,%tm,3,46)
return $puttok(%sock,%tm,3,46)
:newuser
%tmp = _ $+ $removecs($gettok(%mark,9,9),_,n)
if ($3) { %tmp = %tmp $+ n }
sockmark %sock $puttok(%mark,%tmp,9,9)
return
:echo
%tmp = _ $+ $removecs($gettok(%mark,9,9),_,e)
if ($3) { %tmp = %tmp $+ e }
sockmark %sock $puttok(%mark,%tmp,9,9)
return
}
_partyline.logchans {
if ($sock(partyline)) {
var %i = 1,%n = $chan(0),%chan,%bans,%noop = (not op'd)
while (%i <= %n) {
%chan = $chan(%i)
if ($_rchini(statuslog,%chan)) {
%bans = $ibl(%chan,0)
_partyline.display o m %chan t * $_fillright(10, ,%chan) $+ : $_nsingoplur($nick(%chan,0),member,members) ( $+ $_nsingoplur($nick(%chan,0,o),chop,chops) $+ ), $_filleft(2, ,%bans) $_singoplur(%bans,ban,bans) $iif($me !isop %chan,%noop)
}
inc %i
}
}
}
_partyline.show {
if ($1 == join) { _partyline.display * * * * * *** $2 joined the partyline }
elseif ($1 == left) {
if ($3- == $null) { _partyline.display * * * * * *** $2 left the partyline. }
else { _partyline.display * * * * * *** $2 left the partyline: $3- }
}
elseif ($1 == nick) { _partyline.display * * * * * *** Nick change: $2 -> $3 }
elseif ($1 == away) { _partyline.display * * * * * *** $2 is now away: $3- }
elseif ($1 == back) { _partyline.display * * * * * *** $2 is no longer away. }
elseif ($1 == boot) { _partyline.display * * * * * *** $2 booted $3 from the party line. }
elseif ($1 == command) {
; _partyline.show command userflags chan user command
_partyline.display c $2 $3 t * $chr(35) $+ $4 $+ $chr(35) $5-
}
}
; /_partyline.display <consoleflags|$null> <userflags|$null> <#channel|$null> <message flags: t=timestamp|$null> <don´t send to these pls (ids)|$null> [text]
_partyline.display {
var %sms = partyline*.*._l*,%i = 1,%n = $sock(%sms,0),%s,%h,%cf = $1,%uf = $2,%chan = $3,%mf = $4,%never = $5,%text = $6-
if (%text == $null) { return }
if (%cf == *) { var %cf }
if (%uf == *) { var %uf }
if (%chan == *) { var %chan }
if (%never == *) { var %never }
if (t isincs %mf) && ($_getsetup(script,log-time)) { %text = $timestamp %text }
write $"($_egglogfile) %text
_partyline.window %text
if (%n == 0) { return }
while (%i <= %n) {
%s = $sock(%sms,%i)
%h = $gettok(%s,2,46)
if ((%cf != $null) && (%cf !isincs $gettok(%s,3,46))) || ((%never != $null) && ($istok(%never,$remove($gettok(%s,1,46),partyline),44))) || ((%uf != $null) && (%uf !isincs $_nickflags(%h,%chan))) { }
else { _pl.swcrlf %s %text }
inc %i
}
}
; /_partyline.window
_partyline.window {
if (%_partylinemonitor) {
var %win = @Partyline,%file
if ($window(%win) == $null) {
%file = $_egglogfile
window -ekn %win
if ($isfile(%file)) { loadbuf %win $"(%file) }
}
aline -h %win $1-
}
}
; m msgs
; p public
; j joins
; k kicks/modes
; c cmds
; o misc
; b bots
; x files
; s server
; d debug
; w wallops
_putloglev { _partyline.display $1 m $2 t * $$3- }
_putlog { _partyline.display o m * t * $$1- }
_putcmdlog { _partyline.display c m * t * $$1- }
_putxferlog { _partyline.display x m * t * $$3- }
_cmdlog { _partyline.display c m * t * $chr(35) $+ $$1 $+ $chr(35) $2- }
; $_countusers
_countusers { return $ini($_userinifile,0) }
; $_fixflags(flags,change,[#channel])
_fixflags {
var %old,%change
if ($1 != $null) { %old = $ifmatch }
if ($2 != $null) { %change = $ifmatch }
if ($_sanitycheck($_changemodes(%old,%change),$3) != $null) { return $_order($ifmatch) }
}
; $_sanitycheck(flags,[#channel])
_sanitycheck {
var %r = $1
if (B isincs %r) { %r = $_changemodes(%r,+b) }
if (b isincs %r) { %r = $removecs(%r,p,m,c,n) }
if (d isincs %r) { %r = $removecs(%r,a,o) }
if (q isincs %r) { %r = $removecs(%r,g,v) }
if (n isincs %r) { %r = $_changemodes(%r,+m) }
if (m isincs %r) { %r = $_changemodes(%r,+tofj) }
if (t isincs %r) { %r = $_changemodes(%r,+p) }
if (j isincs %r) { %r = $_changemodes(%r,+x) }
if ($_ischan($2)) { return $removecs(%r,b,c,h,j,p,t,x) }
return %r
}
; _partyline.changeflags <changer> <changed> <#channel|$null> <oldflags> <newflags>
_partyline.changeflags {
var %s = partyline*. $+ $2 $+ ._l*,%c
if ($3 != $null) { %c = $3 $+ . }
else { %c = this bot. }
if ($_not($sock(%s,0))) { return }
if (m !isincs $4) && (m isincs $5) {
sockwrite %s *** POOF! *** $+ $crlf
sockwrite %s You are now a master on %c $+ $crlf
}
if (t !isincs $4) && (t isincs $5) {
sockwrite %s ### POOF! ### $+ $crlf
sockwrite %s You are now a botnet master on %c $+ $crlf
}
if (n !isincs $4) && (n isincs $5) {
sockwrite %s @@@ POOF! @@@ $+ $crlf
sockwrite %s You are now an OWNER of %c $+ $crlf
}
if (m isincs $4) && (m !isincs $5) {
sockwrite %s *** POOF! *** $+ $crlf
sockwrite %s You are no longer a master on %c $+ $crlf
}
if (t isincs $4) && (t !isincs $5) {
sockwrite %s ### POOF! ### $+ $crlf
sockwrite %s You are no longer a botnet master on %c $+ $crlf
}
if (n isincs $4) && (n !isincs $5) {
sockwrite %s @@@ POOF! @@@ $+ $crlf
sockwrite %s You are no longer an OWNER of %c $+ $crlf
}
}
; $_creatinguser(handle,host,deflags,password)
_creatinguser {
var %handle = $1,%host = $2,%flags = $3,%pass = $4
if (%handle != $null) {
_wuini %handle handle %handle
_wuini %handle created $ctime
_dummy $_addinguserhostmask(%handle,%host)
_wuini %handle global $_sanitycheck(%flags)
if (%pass != $null) { _wuini %handle __pass $_crypt(%pass) }
}
}
; $_addinguserhostmask(handle,host)
_addinguserhostmask {
var %handle = $1,%host = $2
if (%host != $null) && ($_isuser(%handle)) {
_wuini %handle hosts $addtok($_ruini(%handle,hosts),%host,32)
_auser %handle %host
_nicklist.col.addy %host *
}
}
; $_removinguserhostmask(handle,host)
_removinguserhostmask {
var %handle = $1,%host = $2
if (%host != $null) && ($_isuser(%handle)) {
_ruserhh %handle %host
_wuini %handle hosts $remtok($_ruini(%handle,hosts),%host,1,32)
_nicklist.col.addy %host *
}
}