HydraIRC / Freenode – Auto Connect, Identify, Join

by Brett on June 27, 2012

I often join IRC channels where other developers hang out. I’ve found this to be very beneficial in keeping up to speed with changing technologies. I generally stick to two servers Freenode and OFTC. Freenode is by far my favorite as it seems to be the standard server for other developers to join and create channels about their products.

Over the years, I’ve found this extremely beneficial. I can generally get immediate responses about bugs, feature requests and up-coming enhancements in software I’m using. Also, if I need a feature added to a piece of software I can code it up and send it straight to the developers. I do highly recommend all developers participate in IRC channels as a huge amount of quality information is being shared and it’s easy to find someone who is more specialized in a specific software development topic.

That said, I’ve used HydraIRC for the last year and it’s been growing on me. I was previously using mIRC which is also a good product.

Automated Connection To Two Servers

The very first task I had after installing HydraIRC was to set up an automated script to connect to my favorite servers and favorite channels. The scripting piece was quite simple and consisted of the following steps:

  1. Open HydraIRC and click Options –> Prefs, then click Scripts
  2. In the Command Profiles box type the name “OnStartup” (this is case-sensitive)
  3. In the Commands window type the commands to join the server. For me this was:
/server irc.freenode.net:6667
/newserver irc.oftc.net:6667

HydraIRC Preferences On Startup Script

With those two command in-place HydraIRC will automatically connect to both Freenode and OFTC when I first start the application. Sweet! As a developer doesn’t it always feel good to save a little time?

Join Channels After Connect

Now, we just need to create two more scripts to connect to specific channels after we join the servers. This consists of the following (similar steps):

  1. Open HydraIRC and click Options –> Prefs, then click Scripts
  2. In the Command Profiles box type the name “irc.freenode.net_OnLoggedIn” (again case-sensitive) or irc.oftc.net_OnLoggedIn. Basically, the format is serverName_OnLoggedIn.
  3. In the commands window type:
/join #php
/join #java
/join #html
/join #apache
(and whatever other channels you like)

Identify After Connect But Before Channel Join

With the above in place OFTC was working perfectly but Freenode was telling me:

Cannot join channel – you need to be identified with the service

To resolve this, the command: /msg NickServ identify needs be sent to the server (it’s like logging in).

The trouble is, doing the commands in the following order does not work:

/msg NickServ identify myPass
/join #php
/join #java

This is because HydraIRC does not wait for the response to the identify command but instead immediately runs the next join command. This means HydraIRC tries to join the channels before the server has finished identifying my nick. Darn!

With a little more thought I did come to a solution that has worked very well. Basically, I needed to execute:

/msg NickServ identify myPass
(pause)
/join #php
/join #java

But, wait, HydraIRC does not have a (pause). The work around was to instead use ping which I’ve seen used for pausing in other scripts that do not support a true pause/wait (i.e. Dos Batch Script).

I modified my irc.freenode.net_OnLoggedIn profile to have the following commands and now when I fire up HydraIRC. I automatically connect to my favorite servers, log into nickserv, and join my favorite channels, all while sipping on a little coffee!

/msg nickserv identify myPass
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/ping localhost
/join #php

I love automation!

What other handy scripts do you use in your IRC client? Please do share!

 

Previous post:

Next post: