Irssi events notifier with Erlang

| No Comments

irssi dockapp

Once upon a time I was a reasonably happy user of XChat. It had a feature: you could configure it to automatically popup a new window “in your face” for private messages. This was nice, since you would never miss a message directed to you. The feature also had drawbacks:

  • once a window was there, no popping up occured;
  • popping up in your face was annoyingly intrusive;
  • it was common to be typing something else and pressing ENTER without noticing; the :wq!’s in chat windows were numerous; parts of passwords for folks to see were not unheard of.

After some time, and following an advice from friends, I switched over to the IRC client, irssi, and never looked back.

I, as many others, run irssi in text mode (although it supposedly has a GUI, I was never tempted to try it). Moreover, I run it 24/7 under screen control on a reasonably stable and well-connected machine.

Which presents me with the problem that XChat popup windows were trying to solve: I miss stuff. There are various notifiers available for some instant messaging applications. I would not be surprized if some of those are easy to integrate with irssi. But with remote irssi? On one or more of my several desktops? I never heard of such a beast, and so I decided to write one.

The question of presentation solved itself easily: I use fluxbox window manager, which, among other things, provides support for AfterStep and WindowMaker dockapps.

Getting information about events from irssi itself turned out to be a piece of cake, thanks to the tight integration of irssi and Perl.

The question of delivering notifications from the machine irssi is being run on to one or several desktops was somewhat trickier. Initially, I thought that a very-very simple web storage system I wrote will be the ticket. It worked reasonably well, but I did not want to perform the polling more often than every 30 seconds, and I was not satisfied with the delay. The help came from an unexpected side.

Some time ago I started to read up on Erlang, and was impressed with its capabilities for concurrent and distributed processing. So I sought to re-implement ISWEST-based irssi notifier in Erlang as a sort of a novice programming project.

The end result is a piece of software called, not surprizingly, irssi-notifier, which can be downloaded here. It consists of three components.

activity-notifier

This is a Perl script which should be loaded in irssi. Copy it into ~/.irssi/scripts directory, and load it into irssi using the following command:

/script load activity-notifier.pl

You will need the nc program (netcat) installed, since I could not be bothered with more socket programming in Perl.

notifier-server

This is a small (less than a hundred lines of code) Erlang program that serves as a middle point between irssi (with activity-notifier) and your desktop. Normally, it should run on the same machine as irssi itself.

This is a server program, so it is supposed to run indefinitely.

Since I do not know (yet) how to create proper Erlang applications, it should be started like this:

$ cd irssi-notifier/notifier-server
$ erl
> c(notifier).
> notifier:start().

Then leave that Erlang instance running (background it, or something).

I intend to make this somewhat more convenient to use once I learn how to package a proper Erlang application which runs as a daemon together with Erlang runtime.

irssi-dockapp

This is a C program which actually implements the dockapp.

Compile it (a very simple Makefile is included). You will need libDockApp library installed first. Then run it like this:

./irssi-dockapp -t host.where.notifier-server.runs -p 5679

When irssi receives a private message for you or a message that it hilights (such as messages with your nick mentioned) an irregularly shaped red blob will appear in your dockapp almost instantaneously.

There is no limit on the number of simultaneous dockapp connections to the notifier server.

Enjoy!

Leave a comment

About this Entry

This page contains a single entry by tobez published on July 25, 2006 8:04 PM.

Stop bitching. was the previous entry in this blog.

pcaptail is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.