Searching for Signal

the n01se blog

weechat, nopaste and tagver

This weekend I switched from irssi to weechat. The main reason I switched away from irssi was to gain support for protocols other than IRC. On the way to weechat, I tried Pidgin but I was immediately frustrated by two things.

First, I really love running my IM client in screen. I move regularly between three machines and I want persistent connectivity despite changing work context. Screen has provided that beautifully over the years and I don't know of any truly comparable technology for graphical programs.

Second, Pidgin seems to be barely customizable. For example, how would you like your timestamps? You have three choices:

  • (HH:MM:SS)
  • occasional iChat-style interruptions
  • no timestamps

The Pidgin FAQ calls out plugins to customize timestamps but they're woefully underpowered. What I want is to supply a strftime-style format string: %H:%M. It seems preposterous to me that Pidgin wouldn't provide this capability, so maybe I'm just missing it?

In any case, irssi and weechat both make this and other customizations easy. It took about one minute to find and change the setting in weechat:

/set weechat.look.buffer_time_format "%H:%M"

Once I got weechat running, I found to my chagrin that I'd imagined weechat's support for other protocols. The front page mentions Jabber but it's still a work in progress; there's no stable support for anything other than IRC.

I was saved by bitlbee, a standalone server that gateways IM protocols (XMPP/Jabber, MSN Messenger, Yahoo! Messenger, AIM and ICQ) to IRC. Installing and configuring bitlbee took all of five minutes since it's in Ubuntu and there's a super-easy quickstart guide.

Of course this means that I could have stayed on irssi! But weechat seems to be a worthy replacement. It has a built in nicklist which has always been missing from irssi. It handles filtering better than irssi; whereas irssi's /ignore discards information, weechat's /filter simply hides it and you can toggle filtered text with alt+=. That means I can filter more aggressively because I don't have to worry about irretrievably missing something important.

We are, after all, searching for signal. (And good luck finding it in this post.)

One thing I liked from my brief experience with pidgin was libnotify alerts. You know, that little box that pops up so you don't need to keep your IM client on the screen at all times:

http://agriffis.n01se.net/blog-images/libnotify-chuck.png

There's a weechat notify script that provides this functionality but it had some bugs. No problem, fixed them, then tried to submit my update to the site. The upload form suggests using pastebin, so I broke out my own nopaste tool and...

It failed. Where I expected to get a link, I got nothing! It seems Pastebin.com recently switched to a custom httpd:

$ curl -I http://pastebin.com/
HTTP/1.1 200 OK
Content-Type: text/html; charset=iso-8859-1
Date: Mon, 22 Feb 2010 20:37:36 GMT
Server: TorrentFly.org Custom Httpd

Curl sees "HTTP/1.1" and tries to be polite by using the 100-continue Expect request-header field. Unfortunately the TorrentFly.org Custom Httpd doesn't grok the request and halts the transaction with 417 (Expectation Failed).

Fine, it's an easy fix to force HTTP/1.0 and work around the broken server:

--- a/nopaste
+++ b/nopaste
@@ -52,7 +52,7 @@ main() {

 docurl() {
     declare u
-    u=$(curl --silent --show-error -o /dev/null -w "%{redirect_url}\n" \
+    u=$(curl -0 --silent --show-error -o /dev/null -w "%{redirect_url}\n" \
         --form-string "poster=$opt_nick" --form-string "format=$opt_language" \
         --form-string "expiry=$expire" \
         ${opt_parent:+--form-string "parent_pid=$opt_parent"} \

This reminded me that nopaste should be in externally-available source control so I created a github project for it. This is the first time I've used github to publish a project of my own and I can only say: Wow, that was easy.

I thought it would also be nice to publish proper releases of nopaste. In the past I've simply provided the individual file with a version number appended. Since I'm using git, I should be able to do something nifty with tags, right?

Enter tagver, a script to generate a "meaningful" version number based on tags, revisions and dirt. I've re-invented this wheel a few times, for example adding mercurial support to setlocalversion, but this is the first time I've made it a project in its own right.

Using tagver I released tarballs and an rpm for nopaste version 2.3 containing this trivial fix. You can find them both at http://agriffis.n01se.net/nopaste. I'm not really satisfied with the Makefile that calls tagver, but it'll do for now, at least until I look into integrating tagver into an autotools-driven distribution. Or cmake or scons or cons or whatever...