Auto-Join

By RusselB on Jan 17, 2007

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)
}

Comments

Sign in to comment.
[85]   -  Nov 08, 2011

awesome job,specially like option +k (enter key)"

 Respond  
xplo   -  Feb 19, 2009

then an option to it could be nice :p
like, chanserv or X (The 2 most common bots on IRC)

 Respond  
RusselB   -  Feb 19, 2009

The problem with implementing that, is due to the fact that not all networks use a channel service, and even the one's that do, don't necessarily use the same name or even the same method of sending the information to the channel service.

 Respond  
xplo   -  Feb 19, 2009

It would be great to add an option that if the channel os set to +i (invite only)
that you will perform an invite to X before joining.
Ex:.

msg x invite #hawkee.com
.timer 1 3 join #hawkee.com

this would make your code complete. :p

 Respond  
RusselB   -  Jan 29, 2007

Got the update done faster than I thought. Hope the changes meet your request.

 Respond  
RusselB   -  Jan 29, 2007

RoninWarrior: While I don\'t have that option currently, I\'m more than willing to incorporate it once my internet problems have been resolved (hopefully within 48 hours of this post). Keep your eyes peeled for a script update withing 72 - 96 hours.

 Respond  
RoninWarrior   -  Jan 23, 2007

ok this works great for me know RussleB.Just one question is there a way for you make it to were when you click on the popup to see the channels you have stored in the hash file per network?

 Respond  
xDaeMoN   -  Jan 23, 2007

You can also trigger that by using \'/version\'. Not sure if all servers uses that same command but been using that on my xSeen script & tested it on quite a few networks/servers.

 Respond  
LIQUID_NiTrO   -  Jan 22, 2007

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)

 Respond  
RusselB   -  Jan 20, 2007

If anyone knows a way of determining the maximum number of channels that one can join using a single /join command, please let me know so that I can incorporate the information into my code (with appropriate credits being given, of course).

 Respond  
Aaron   -  Jan 20, 2007

yeah i see what you mean with a target change :P

hooked up like 50 channels to it..wasnt pretty

 Respond  
RusselB   -  Jan 19, 2007

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).

 Respond  
RoninWarrior   -  Jan 19, 2007

But i still cant this to work though

 Respond  
RoninWarrior   -  Jan 19, 2007

DR that is what i use currently know .

 Respond  
DarthReven   -  Jan 19, 2007

You can set something like this up on mIRC\'s Perform with timers if you wish

 Respond  
xDaeMoN   -  Jan 18, 2007

I take back the lacking of the ON start event. Didn\'t notice that it creates the table & loads the data upon connect.

 Respond  
xDaeMoN   -  Jan 18, 2007

Currently, it doesn\'t save the data to a file upon exit or disconnect. It also lacks the On start event where it would create the hash table & load the data from the file.

 Respond  
RoninWarrior   -  Jan 18, 2007

I read your notes I am useing Dalnet if that means anything.

 Respond  
RoninWarrior   -  Jan 18, 2007

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.

 Respond  
A-1-T-E-A-M   -  Jan 18, 2007

Nice snippet I have that on my script :)

 Respond  
Aaron   -  Jan 18, 2007

but just saying theres an easier way to do this :P

on *:connect:{
join #channel
join #channel

but yours is more..awsome :P

 Respond  
Aaron   -  Jan 17, 2007

nice :)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.