How to automatically reclaim your IRC nick and other things (for Quassel)

21 March 2014 by Lincoln Ramsay

I use Quassel. The server runs all the time so I’m always logged in. Since the server runs at my home, I sometimes get bumped offline as my IP address changes (why? I dunno, it just does). Since the server re-connects within the normal IRC timeout period, this means it can’t take my nick. You can fix this manually when you login and notice it but… that’s a bit of a pain. Here’s how I did it automatically.

In the Configure Networks dialog is a Commands section. These commands are run after you identify to nickserv (assuming you’ve done that, which you should) but before you re-join channels. Unfortunately, some of the things you need to do have delays associated with them but there’s no way to delay. There is however a way to run commands later.

So for example, here’s how you reclaim your IRC nick.

/msg nickserv ghost <nick>
/wait 10; /nick <nick>

This sends a message to nickserv to ghost your nick. If for some reason you already had that nick, no worries. Nickserv won’t kick your active session offline. Then after 10 seconds, your nick is changed. Why 10 seconds? It seems to take a little while after you tell nickserv to ghost your nick before you can actually use it again. Importantly, that 10 seconds happens in the background so quassel will go ahead and try to join to your previously-joined channels. It ends up looking like this.

[21 01:35:16] --> <nick>_ has joined #brisbane
[21 01:35:17] <-- <nick> has quit (Disconnected by services)
[21 01:35:20] <-> You are now known as <nick>

If you don’t want this noise, you can uncheck the Rejoin all channels after reconnect box on the Connection tab and manually list the channels you’d like to join.

/msg nickserv ghost <nick>
/wait 10; /nick <nick>
/wait 11; /join <channel>

Apparently some channels only let you join with an authed nick, or you have to do some kind of auth message before you can join. I have an idleRPG character and you have to message a bot to login to that. So I use this code to ensure I’m in the channel and signed in after getting my nick back (changing nicks while signed in incurs a penalty).

/wait 11; /join #idleRPG
/wait 20; /msg IdleBot LOGIN <name> <password>