Saturday, May 31, 2008

Get ready to spew your morning coffee...

...onto your computer monitor and keyboard. Literally.

Following hot on the heels of the "Perl is a terrible language" post comes the reason why I had to re-learn Perl in the first place.

I just barely released MyProBB 2.3. It took nearly two months to get this release ready. 1.4 months of that 2 months consisted of writing a single plugin for the forum. What follows is the shamelessly copied portion of text from the MyProBB 2.3 announcement post:

[This plugin is] perhaps the best little gem to hit the Internet since AJAX-driven websites, er, Google...

The Official Instant Message plugin. Yup. That's right. I single-handedly hold the distinction of having the first web software package that sends Instant Messages. I hold the distinction of being the first to send IMs to five major IM networks from a web forum. I also hold the distinction of having the only web forum software package that sends real Instant Messages. I even hold the distinctions of having the most advanced Pidgin plugin using the Perl plugin for Pidgin, the first Perl plugin for Pidgin that contacts the Internet, and the first ever multi-protocol automated IM web-driven bot.

That's a lot of firsts. I've done something no one else on this planet has done. It took a lot of sweat, tears, and one-and-a-half months to get here, but I did it.

Despite making the plugin as simple as possible, the plugin itself has over five pages of documentation. However, while it does take a bit to set up, it really does send IMs. To five different networks: AOL IM (AIM), MSN Messenger, Yahoo Messenger, ICQ, and Jabber/XMPP.

There are three parts to the plugin: The 'User Profile' part (what the user sees), the Management Interface part (handles requests), and the Pidgin part.

The first two parts are straight-forward (more or less), the Pidgin part is not so straight-forward. Pidgin is a multi-protocol IM chat client that has Perl scripting support for writing plugins (it also supposedly supports Tcl plugins, which I don't know). I looked at the documentation and knew it would take a while but a Perl plugin for Pidgin was the best route. A Perl plugin for Pidgin would allow users to use the plugin with Pidgin on any Pidgin supported OS (which is all the major OSes).

My first step was to get Pidgin installed with the Perl plugin. That took several days. (The instructions cut through the awful steps I went through). Then I had to re-learn Perl. For the zillionth time. I hate Perl. Once I figured that out, I had to download the source code to Pidgin and learn how that worked. I was digging around in the C code far more than I cared to just to figure out what in the world was going on. I ran into so many ridiculous bugs (fully documented in the plugin source), I ended up writing all sorts of cheesy hacks to get the darn thing to not do weird things. Then I had to wait for Pidgin 2.4.2 to be released because they were making changes to the Perl part of the plugin, which resulted in more hacks. Then I had to figure out how to communicate between the Perl and PHP parts of the plugin over the Internet in a bandwidth-friendly fashion. And then I ran into rate limit and size limit issues of sending messages over IM. By the time I figured everything out, a whole month-and-a-half had passed.

Sorry for the rant. But hopefully that thoroughly explains the reason for the delayed release. Instant Message support for a web forum: A very cool feature. And it totally abuses someone else's software application (Pidgin).

And now here is why you should spew your morning coffee onto your computer screen: The Instant Message plugin significantly lowers the bar to creating IM spam bots for every protocol Pidgin supports. Pidgin supports every major (and a few minor) IM protocols on the planet.

I wrote the plugin such that it ties into MyProBB and requires verification, but I've basically done the hard work of figuring out how to turn innocent, sweet Pidgin into an evil IM spam bot. My purpose is for good. Someone else's purpose will be for awesome.

If you were holding it in, you can spew your coffee now.
Feel better? Good.

Every new innovation is a double-edged sword...

Microwave ovens can be used to cook food or they can be rigged to stop air-to-ground missiles from homing in on and hitting your very expensive radar dish that the enemy wants to take out. The missiles take out the microwave ovens instead. Fun.

No comments:

Post a Comment