Go to a room,
type +ajoin
it works on multi-servers.
menu channel {
Auto Join ( $+ $iif(%aj,on,off) $+ )
.on:inc %aj ON
.off:unset %aj OFF
.-
.Add:{ set %aj. $+ $network $addtok(%aj. [ $+ [ $network ] ],#,44) | echo -s # added to autojoin }
.Del:{ set %aj. $+ $network $remtok(%aj. [ $+ [ $network ] ],#,44) | echo -s # removed from autojoin }
}
on *:Input:#:{
If ($$1 == +ajoin) { set %aj. $+ $network $addtok(%aj. [ $+ [ $network ] ],$chan,44) | echo -a $chan added to autojoin for $server }
If ($$1 == -ajoin) { set %aj. $+ $network $remtok(%aj. [ $+ [ $network ] ],$chan,44) | echo -a $chan removed from autojoin for $server }
If ($$1 == -ajoff) { unset %aj | echo -a Autojoin Off }
If ($$1 == +ajon) { inc %aj | echo -a Autojoin On }
}
on *:connect:{
if (%aj) { if (%aj. [ $+ [ $network ] ]) join -n $ifmatch }
}
Here is what I meant by what I said:
menu channel {
Auto Join ( $+ $iif(%aj,on,off) $+ )
.on:set %aj on
.off:unset %aj
.-
.Add { hadd -m aj $network $&
$addtok($hget(aj,$network),#,44)
echo -s # added to autojoin }
.Del { hadd -m aj $network $&
$remtok($hget(aj,$network),#,1,44)
echo -s # removed from autojoin }
}
on *:exit: hsave -o aj aj
on *:connect: if (%aj) && ($hget(aj)) join $hget(aj,$network)
on *:start: if ($file(aj).shortfn) hmake aj 100 | hload aj $v1
on *:input:#:{ if ($regex($1,/^([+-])ajoin$|ajo(n|ff)$/iS)) {
if ($regml(1) == ff) { unset %aj | echo -a AutoJoin Off }
elseif ($regml(1) == n) { set %aj on | echo -a Autojoin On }
else { var %h = $hget(aj,$network), %a = $addtok(%h,#,44)
var %r = $remtok(%h,#,1,44) | hadd -m aj $network $&
$iif($regml(1) == +,%a,%r) | echo -a # $iif($regml(1) != -,$&
added to,removed from) autojoin for $server } }
}
This snippet will be better off using a hash table and store all the channels in its data, with a comma separating each of them. From experience I know a global variable can get cut off if the length reaches to a certain limit. I'm not sure, but the multiple target join on each network may vary...there may be a restriction on how many channels you can join together at a time.