on *:CONNECT: .AutoJoin -n
alias J {
if (!$1) .AutoJoin -n
else {
var %chans, %i = 1
while ($gettok($1-, %i, 32)) {
var %chan = $ifmatch
if (#* !iswm %chan) %chan = $+($chr(35), %chan)
%chans = $addtok(%chans, %chan, 44)
if $numtok(%chans, 44) == 10 {
.raw JOIN %chans
%chans = $null
}
inc %i
}
if (%chans) .raw JOIN %chans
}
}
alias AutoJoin {
if $1 == -? {
linesep -a
echo $color(notice) -aqbflirt * USAGE: /AutoJoin [-?|-a|-c|-l|-n|-r] [[#]channel] [[#]channel]
echo $color(notice) -aqbflirt *
echo $color(notice) -aqbflirt * To rejoin all your AutoJoin channels: /AutoJoin
echo $color(notice) -aqbflirt * To get this help listing: /AutoJoin -?
echo $color(notice) -aqbflirt * To add the active channel: /AutoJoin -a
echo $color(notice) -aqbflirt * To clear all entries: /AutoJoin -c
echo $color(notice) -aqbflirt * To list the current entries: /AutoJoin -l
echo $color(notice) -aqbflirt * To join all your AutoJoin channels minimized: /AutoJoin -n
echo $color(notice) -aqbflirt * To remove the active channel: /AutoJoin -ra
echo $color(notice) -aqbflirt * To remove #HelpDesk and #Help: /AutoJoin -r HelpDesk #Help
echo $color(notice) -aqbflirt * To add #Help, #mIRC and #HelpDesk: /AutoJoin Help #mIRC HelpDesk
echo $color(notice) -aqbflirt *
echo $color(notice) -aqbflirt * End of /AutoJoin -?.
linesep -a
}
elseif $1 == -a && #* iswm $active {
if (!$istok($eval($+(%, AutoJoin., $network), 2), $active, 44)) {
set $+(%, AutoJoin., $network) $addtok($eval($+(%, AutoJoin., $network), 2), $active, 44)
set $+(%, AutoJoin., $network) $sorttok($eval($+(%, AutoJoin., $network), 2), 44, r)
echo $color(info) -eaqbflirt * AutoJoin: Added $active to list.
}
else echo $color(info) -eaqbflirt * AutoJoin: $active already in list.
}
elseif $1 == -c {
unset $+(%, AutoJoin., $network)
echo $color(info) -eaqbflirt * AutoJoin list cleared for $network $+ .
}
elseif $1 == -l {
var %i = $numtok($eval($+(%, AutoJoin., $network), 2), 44)
linesep -a
while (%i) {
echo $color(info) -aqbflirt $gettok($eval($+(%, AutoJoin., $network), 2), %i, 44)
dec %i
}
echo $color(info) -aqbflirt End of /AutoJoin List.
linesep -a
}
elseif $1 == -n JOIN -n $eval($+(%, AutoJoin., $network), 2)
elseif $1 == -ra || $1 == -ar {
if $istok($eval($+(%, AutoJoin., $network), 2), $active, 44) {
set $+(%, AutoJoin., $network) $remtok($eval($+(%, AutoJoin., $network), 2), $active, 1, 44)
echo $color(info) -eaqbflirt * AutoJoin: Removed $active from list.
}
else echo $color(info) -eaqbflirt * AutoJoin: Nothing to remove.
}
elseif $1 == -r {
if !$2 {
echo $color(info) -eaqbflirt * AutoJoin: Nothing to remove.
halt
}
var %chans, %i = 1
while ($gettok($2-, %i, 32)) {
var %chan = $ifmatch
if (#* !iswm %chan) %chan = $+($chr(35), %chan)
if $istok($eval($+(%, AutoJoin., $network), 2), %chan, 44) {
set $+(%, AutoJoin., $network) $remtok($eval($+(%, AutoJoin., $network), 2), %chan, 1, 44)
%chans = $addtok(%chans, %chan, 32)
}
inc %i
}
if (%chans) echo $color(info) -eaqbflirt * AutoJoin: Removed %chans from list.
else echo $color(info) -eaqbflirt * AutoJoin: Nothing to remove.
}
elseif $1 != $null && $left($1,1) != - {
var %!chans, %chans, %i = 1
while ($gettok($1-, %i, 32)) {
var %chan = $ifmatch
if (#* !iswm %chan) %chan = $+($chr(35), %chan)
if (!$istok($eval($+(%, AutoJoin., $network), 2), %chan, 44)) {
set $+(%, AutoJoin., $network) $addtok($eval($+(%, AutoJoin., $network), 2), %chan, 44)
%chans = $addtok(%chans, %chan, 32)
}
else var -s %!chans = $addtok(%!chans, %chan, 32)
inc %i
}
set $+(%, AutoJoin., $network) $sorttok($eval($+(%, AutoJoin., $network), 2), 44, r)
if ($len(%!chans)) %!chans = $+([,%!chans already in list.])
echo $color(info) -eaqbflirt * AutoJoin: Added %chans to list. %!chans
}
elseif $left($1,1) == - {
linesep -a
echo $color(notice) -aqbflirt * AUTOJOIN: Unknown parameter $1
echo $color(notice) -aqbflirt *
echo $color(notice) -aqbflirt * USAGE: /AutoJoin [ -l | -r | -c -? ] #[channel] #[channel]
linesep -a
}
elseif ($eval($+(%, AutoJoin., $network), 2)) .raw JOIN $eval($+(%, AutoJoin., $network), 2)
elseif (!$eval($+(%, AutoJoin., $network), 2)) echo $color(notice) -eaqbflirt $&
* AutoJoin: No channels to auto-join on $network $+ .
}
menu channel {
$iif($istok($eval($+(%, AutoJoin., $network), 2), $chan, 44), $style(1)) AutoJoin:{
AutoJoin $iif($istok($eval($+(%, AutoJoin., $network), 2), $chan, 44),-ra,a)
}
}