Words by c.z.robertson

Fortune server

2001-01-13 01:00:00 UTC

One of my friends has recently become obsessed by Wanda the Fish, a small program for Gnome that sits on the panel and pops up a quote every time you click on it. (A little digging around reveals it to be a front end to fortune.) He says that despite clicking on it for hours at a time, he rarely sees the same fortune twice.

There are over 2Mb of fortunes on my system (including a large set of Zippy quotes ("Yow! Are you the self-frying president?")), but I wonder what the policy for updating them is. It would be pretty cool to have the fortunes retrieved off a server to which other people could add their own fortunes. To this end, I was thinking about what sort of protocol would be required to implement this.

It could probably be implemented on top of http. At a bare minimum a url to which a query could be appended either requesting a number of fortunes or containing one to add. I'm not entirely sure about the latter because I don't know whether there's a length limit to urls. Alternatively, the POST method of sending data could be used. The fortunes could be retrieved in some easily parsable format, possibly xml-based.

The advantage of using http is the number of existing tools that can use it, and the ease of coding a simple net-aware fortunes program using nothing more than wget and a few lines of Perl. It would also make setting up a server quite simple and configuring an app to use a different set of fortunes would be as simple as giving it the url of another publicly accessible server. There are probably more appropriate protocols than http for this sort of thing, but it would be a trade-off between quality and ease of implementation.

It's also entirely possible that someone else has already implemented such a system. Please let me know if you know of anything.