A quick little code that will auto-join channels based on the network that you have connected to. Handy for those people that want to join a lot of channels when they connect, and keep seeing "Target change to fast"
Channels are added/removed via menu system and stored in a hash table based on the network name.
Note: I understand that some networks don't return a network name, but as I've been unable to find one, I don't know how this will work with networks like that.
on *:connect:{
if !$hget($network) { .hmake $network }
if $exists($+($network,.hsh)) { .hload $network $+($network,.hsh) }
var %a = 1, %b = $hget($network,0).item
while %a <= %b {
.timer 1 %a .join $hget($network,%a).item $iif($hget($network,%a).data,$v2)
inc %a
}
}
menu channel,nicklist {
Auto-Join Channels
.Add : .hadd -m $network $$input(Channel Name,e,,$chan) $?*="Key if required"
.Remove : .hdel $network $$input(Channel Name,e,,$chan)
.List : show $$input(Network Name,e,,$network)
}
alias -l show {
var %a = 1, %b = $hget($1,0).item
while %a <= %b {
set %chans $addtok(%chans,$hget($1,%a).item,32)
if $calc($len(%chans) + $numtok(%chans,32)) > 900 {
echo -a $replace(%chans,$chr(32),$+($chr(44),$chr(32)))
unset %chans
}
inc %a
}
if %chans {
echo -a $replace(%chans,$chr(32),$+($chr(44),$chr(32)))
unset %chans
}
}
on *:exit:{
.scon -at1 .hsave -o $!network $+($!network,.hsh)
}
on *:disconnect:{
.hsave -o $network $+($network,.hsh)
}
I don\'t think it\'s possible for $network not to be filled...it is standard protocol to send a network name to a connecting client in raw 005, and I can\'t think of any reason for an IRCd not to follow this practice.
The maximum number of channels a person is allowed to simultaneously be in are also included in raw 005. At least, that information is sent on UnrealIRCd, and while I haven\'t tested it on others I would be that they would send it as well.
After connecting to DALnet, for instance, you receive a message like this, displayed before the MOTD:
<- :aeon.ix.us.dal.net 005 YOURNICK NETWORK=DALnet SAFELIST MAXBANS=200 MAXCHANNELS=20 CHANNELLEN=32 KICKLEN=307 NICKLEN=30 TOPICLEN=307 MODES=6 CHANTYPES=# CHANLIMIT=#:20 PREFIX=(ov)@+ STATUSMSG=@+ :are available on this server
And it says in this message that the maximum number of channels you are allowed to be in at one time is 20 (MAXCHANNELS=20)
Thanks for the feedback. I\'m not sure why the sections to save the hash tables didn\'t show in the code. I know they were there, so, I have added them to the posted code manually.
Aaron: I realize that using multiple /join commands will work, however, using a lot of them in a row (without a timer) will cause a Target Change Too Fast error.
RoninWarrior: The script was tested on 5 different networks. Those networks are: DalNet, Undernet, BDSM.net, Bondage.com and Maximum-IRC
It works perfectly on all of those networks. (with the slight modifications that I mentioned earlier).
RussleB I know this makes me sound a bit stupid but i suck at hash tabels.I loaded it up and put it into a new remotes file right clicked in the chanel popups and hit add channel $input came up with the channel name in it nicely,I dont use a key so i hit ok.But when i go to find a hash file in the folder were the file i loaded is saved there is nothing?Well there is nothing at all i closed out of mIRC and reopened it up and re connected and there is no auto join at all.I guess basically is what am i doing wroung LOL.