Public feed
#601814
menu nicklist {
.wControl
..Voice:{
wmode # $+(+,$str(v,$snick(#,0))) $makelist
}
..Devoice:{
wmode # $+(-,$str(v,$snick(#,0))) $makelist
}
..Op:{
wmode # $+(+,$str(o,$snick(#,0))) $makelist
}
..Deop:{
wmode # $+(-,$str(o,$snick(#,0))) $makelist
}
..Mass-Voice:{
names #
var %a = $nick(#,0), %nicks
while (%a) {
if ($nick(#,%a) !isvoice #) {
%nicks = %nicks $v1
}
dec %a
}
wmode # $+(+,$str(v,$numtok(%nicks,32))) %nicks
}
..Mass-Devoice:{
names #
var %a = $nick(#,0), %nicks
while (%a) {
if ($nick(#,%a) isvoice #) {
%nicks = %nicks $v1
}
dec %a
}
wmode # $+(-,$str(v,$numtok(%nicks,32))) %nicks
}
..Mass-Op:{
names #
var %a = $nick(#,0), %nicks
while (%a) {
if ($nick(#,%a) !isop #) {
%nicks = %nicks $v1
}
dec %a
}
wmode # $+(+,$str(o,$numtok(%nicks,32))) %nicks
}
..Mass-Deop:{
names #
var %a = $nick(#,0), %nicks
while (%a) {
if ($nick(#,%a) isop #) {
%nicks = %nicks $v1
}
dec %a
}
wmode # $+(-,$str(o,$numtok(%nicks,32))) %nicks
}
}
alias wmode {
if (!$isid) {
var %echo = !echo -acq $+ $iif($active == Status Window,e) info *
var %strict = $true
if ($left($1,1) == -) {
if (f isincs $1) %strict = $false
if (t isincs $1) !.echo -q $regex(wmode,$1,/t(\d*)/)
tokenize 32 $2-
}
if ($2 == $null) %echo /wmode: insufficient parameters
elseif ($me !ison $1) %echo /wmode: you are not on $1
elseif ($me !isop $1) && ($me !ishop $1) %echo /wmode: Insufficient Privileges
else {
var %name = wmode. $+ $cid $+ . $+ $1
if (!$timer(%name)) {
hadd -m %name index -1
hadd -m %name current 0
hadd -m %name strict $iif(%strict,$true,$false)
!.timer $+ %name -m 0 $iif($regml(wmode,1) isnum,$ifmatch,1400) wmode.exec $cid $1
!.echo -q $regex(wmode,reset,/reset/)
}
hinc -m %name index
hadd -m %name $hget(%name,index) $2-
}
}
}
alias wmode.exec {
var %name = wmode. $+ $1 $+ . $+ $2, %parameter, %parameters, %tmp, $&
%index = $hget(%name,current), %subindex, %modestring, %prefix, $&
%parmrequired = $remove($gettok($chanmodes,1-2,44),44) $+ $nickmode, $&
%parmrequiredset = $gettok($chanmodes,3,44), %string, %substring, %operator
while ($hget(%name,%index) <= $hget(%name,index)) {
%string = $ifmatch
%subindex = 1
while (%subindex <= $len($gettok(%string,1,32))) {
%substring = $mid(%string,%subindex,1)
%parameter = $gettok(%string,2,32)
if (%substring isin +-) {
%tmp = %prefix
%prefix = $ifmatch
if (%prefix == %tmp) goto loopend
}
elseif (%substring isincs %parmrequired || (%substring isincs %parmrequiredset && %prefix == +)) {
if (%substring isincs $nickmode && $gettok(%string,2,32) !ison $2) goto loopend
elseif (%substring isincs bhoqv && $hget(%name,strict)) {
if (%substring === b) && ($chr(33) !isin %parameter) && (@ !isin %parameter) {
if (%parameter == $null) !.echo -q .
elseif (. !isin %parameter) %parameter = %parameter $+ !*@*
else %parameter = *!*@ $+ %parameter
}
%operator = $iif(%prefix == -,!) $+ is $+ $replacex(%substring,b,ban,q,owner,o,op,h,hop,v,voice)
if (%parameter %operator $2) goto loopend
}
%parameters = %parameters %parameter
%string = $gettok(%string,1,32) $gettok(%string,3-,32)
}
%modestring = %modestring $+ %substring
if ($numtok(%parameters,32) == $modespl) {
if ($me isop $2) || ($me ishop $2) !mode $2 %modestring %parameters
%string = $mid($gettok(%string,1,32),$calc(%subindex + 1)) $gettok($hget(%name,%index),$calc($modespl + 2) $+ -,32)
hadd -m %name %index $iif($left(%string,1) !isin +-,%prefix) $+ %string
goto end
}
:loopend
inc %subindex
}
hdel %name %index
hinc %name current
inc %index
}
if (($me isop $2 || $me ishop $2) && $len(%modestring) > 1) {
!mode $2 %modestring %parameters
hdel %name %index
}
:end
if ($hget(%name,0).item == 3) wmode.cleanup $1 $2
}
alias wmode.cleanup {
var %name = wmode. $+ $1 $+ . $+ $2
!.timer $+ %name off
hfree -w %name
}
on *:KICK:#:if ($knick == $me) wmode.cleanup $cid $chan
on *:PART:#:if ($nick == $me) wmode.cleanup $cid $chan
on *:DISCONNECT:wmode.cleanup $cid *