jab2web Version 0.1
March 11th, 2008In addition to visiting Mat in Savannah this past week I also worked a lot on my first Python project, a collaboration with Sean, jab2web. According to the Google Code description I wrote, jab2web is “a jabber bot written in python that uses regular expressions to parse incoming messages. HTTP requests are made to corresponding URLs to determine how the bot should reply. The configuration for this looks a lot like the Apache mod_rewrite RewriteRules.”
I’m not sure how many people would actually need or want to use Jabber to translate messages into HTTP requests but I found a need for it and so I wrote it.
I wanted to create a chat interface for the web application for my ourbunny.com project . Since I had a lot of the application logic already implemented on the web interface I did not want to have to rewrite it all in a different language to include in the chat interface. I decided to write a PHP script for each Jabber command that would parse the GET variables and print whatever text I wanted as the reply for that command.
jab2web acts as an intermediary between the PHP scripts I wrote and a Google Talk. Incoming messages are matched to a list of regular expressions and when a match is found a request is made to the corresponding PHP script over HTTP. The response of the script is then relayed back to the user who initiated the chat.
All this can be seen in action at ourbunny.com (although most likely I will not be running the server). Hope someone finds the script useful, have a nice day!