Irssi
Irssi is an IRC client for Unix-ish platforms. It features a text mode user interface, modularity, multi-server connectivity, tab completion and a lot of automation.
One of the many great features of Irssi is its Perl scripting support. cras (Timo Sirainen), Irssi's author was smart enough to choose Perl as the scripting language instead of some awkward language like Tcl.
Because I like Irssi so much, I created stuff for it. The rest of this page is a list of my Irssi efforts.
Community stuff
- The Irssi header specification is my fault. The number of scripts was increasing at a very high rate, and because there was no standardized way of presenting information about the script, sometimes there was no way to know what a script did without looking through the code. Someone created a header specification, but I thought it was too restrictive. The information was put in Perl comments, which meant other scripts couldn't access it easily. My proposal got accepted by the community (#irssi on ircnet) and even though it was still a draft, people started using it and the author of the old header specs removed those and placed a link to mine. I used a normal Perl hash so that other scripts had access to the information, and I wanted no dictated formats for anything.
- Because there was none, I made a simple Scripting tutorial. A while ago, I discovered that it is linked from . At the time of writing, some features mentioned worked only with the bleeding edge CVS version, but it seems that it has finally been released. The tutorial is by no means extensive, and probably not even enough to get you scripting, but with over a thousand hits per month, it is quite popular anyhow.
- On , you can find a list of scripts. The index is generated by a little script. Probably not worth mentioning, but I am going to anyhow: I made the initial versions.
Irssi itself
- Open source is great. If you like some program, but think it could be improved, you just bug the author and hope it'll be implemented one day. cras is one of the good guys, and he implemented most of my ideas. Each time I use a code reference in add_command or have Irssi export some functions, I'm glad I asked.
- Another reason that I like open source is that if you like a program, think it could be improved and know the language the program uses, you can implement new features yourself. You bug the author with a patch instead of a question, and the new features are available for everyone soon after that. I know Perl, and some of Irssi's scripting stuff is written in it. Irssi had its own Irssi::print, but I wanted normal Perl print, because it can do much more. I made it happen. Together with my patch that allows you to import any function in the Irssi:: namespace, approximately 75% of the current Irssi.pm file is my code. This may sound like an awful lot, but it's only 100 lines or so :)
Perl scripts
- ../files/irssi/buf.pl saves your scrollbuffer when you use /upgrade. The upgrading feature restarts Irssi, but with this little trick, it'll be harder to notice that Irssi actually did restart. Partly because this script is slow, I still think this should be core functionality instead of a Perl script, but it seems cras disagrees with me.
- ../files/irssi/calc.pl is a very simple calculator. Well, the code is simple. It can do extremely complicated calculations, because it uses Perl's eval. The calculator is used via the /calc command script. Don't make a public command from this, as it is easy to crash your computer with it. It's safe for local use.
- ../files/irssi/dictcomplete.pl is a modified version of cras' script. Dictcomplete lets you tab-complete words from the /usr/share/dict/words file. Word lists are available for many languages. Instead of parsing the entire word list on each completion, this modified version reads the list into memory. It's a lot faster than the original, but it also uses more resources.
- ../files/irssi/figlet.pl creates ascii art text with the figlet program. You need to have figlet installed. This script is used with /figlet command, which understands IRC colour codes, and will re-assemble the generated art with the correct colours. You don't have to use colour, of course. In that case, this script still has a major advantage over /exec -out figlet -k: you won't have to think about special characters like ). Ever tried /exec -out figlet :)? :)
- ../files/irssi/follow.pl was made to show the new Perl scripting features of some CVS version of Irssi. It does nothing spectacular, but many people still like to use it. All it does is switch to active windows all the time. Quite annoying if you ask me, but it does look rather nerdish if you put it on a spare terminal, join some very active channels, and invite a less nerdy friend over. I suggest an all-green color scheme.
- ../files/irssi/foo.pl was my very first Irssi script. It "encrypts" text messages with ROT-n (that is: ROT-13 with a variable 13), and sends the n using IRC control codes so that other foo-enabled Irssis detect it and automatically decrypt the message. The command is not /foo, but /rot. Foo was only chosen because I thought rot would be a bad name for a script, and foo was available.
- ../files/irssi/guts.pl is a German Uppercase Tab Stuff thingy. If you know German, you know that they capitalize the first letters of not only sentences, but also all nouns. But, they tend to forget to do so. This is the only script I wrote on request, because it was so easy to do. Using it is easy too: type a word, hit Tab and it makes the first letter upper cased. This script now serves as an example script for the complete word signal.
- ../files/irssi/null.pl was a rather childish addition to Irssi's script archive, but I never expected the maintainer to add it. I use this script as a template for other scripts. The script does nothing but defining %IRSSI.
- ../files/irssi/scriptadmin.pl was the first automated script installer for Irssi. /script install foo is enough to install my foo-encryption script, /script search encrypt finds it. There's a script called scriptassist now, and I heard it's a lot better than my efforts.
- ../files/irssi/scriptinfo.pl reads a script's %IRSSI hash and displays it. If you use scriptadmin, it is a good idea to also have scriptinfo installed. You can of course install it *using* scriptadmin :)
- ../files/irssi/sysinfo.pl displays information about your system without useless network statistics, without colours, and without space eating parens and brackets. It hasn't been ported to other systems yet, so it works with Linux only. Just type /sysinfo to let others know about your elite 386.
- ../files/irssi/typofix.pl is a heavily modified version of cras' original typo fixing script (see the list of changes for more information). If someone types s/foo/bar/ in a channel, this actually substitutes foo for bar in the last line that person wrote. All typofix scripts are broken! Do not use them! They all use the same broken interface to Irssi's scrollbuffer, hence they all break your scroll buffer after a while.
Irssi and me now
I scripted everything I needed for myself and released them so others can use them too, if they want. The only Irssi scripting I do now is maintenance of the scripts mentioned above, and an IRC bot.