Friday, November 21, 2008

Links automatically pulled from messages

Added a feature that pulls links from a message post and adds them to the Room Recent Links list. Now, typing a normal URL (i.e. http://www.google.com) will add that URL to the list, using the link URL (32 characters of it) as the tile. If you use Markdown syntax (i.e. [My Link Title](http://www.google.com) ), the title in the brackets will be used.

This is part of my effort to collect meaningful information from message posts and make it easier to get to later. Eventually, I will pull media links, such as the supported YouTube and Hulu markup and paste the video window in it's own pane.

Sunday, November 16, 2008

Hacked my NSLU2 (Slug) for Google Talk Bot

Yesterday I spent a part of the day hacking my NSLU2, putting the Unslung firmware from http://www.nslu2-linux.org. I want a Google Talk Bot running all the time to handle TaPingYa requests and let people know of new messages when they are not in a favorite room.

I wrote a simple bot framework as described in an earlier post. I just needed a place to host it. The last thing I wanted was an entire machine running around the clock, sucking a couple hundred watts of power 24 hours a day. So, the idea struck me that I had the NSLU2 sitting in a drawer collecting dust, and if I could just get Python 2.5 running on the thing, I would have my platform for hosting my bot. The unit draws very little power, makes no noise, and can sit next to my router taking almost zero space.

So, I started looking more into it and decided to go for it. Several hours later, I had it going. Here's what I had to do.

First, I had to compile the UpSlug2 utility for Mac OS X, following these instructions. This is the way to upload the firmware to the "Slug". By far, this took the most time. There were several packages to install and each took some time. I had to modify my .bash_profile file and add ":/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin" to the PATH in order for MacPorts to work. Other than that, everything else went smooth.

Once I had all that compiled, I uploaded the latest Unslung firmware to the box, following the same instructions as above. That also went smooth. I was able to Telnet into the box as root and look around. Cool!

Next, I had to Unsling the box, moving the firmware to an external drive. This is necessary to install all the optware available for the Slug (Python being the one I was interested in). There are plenty of packages to choose from. I chose a 2 gig thumb drive that I had laying around for the external drive. Plenty of room for what I had in mind, compact, and no external power needed. I formatted that using the web interface that comes with the NSLU2. The unslinging directions are in the firmware download package. Too many details to repeat. Just read the Unslung-6.10-beta-README.txt file.

Ok, it was unslung. Now, I had to get Python on the box. I tested for Internet connectivity by pinging several sites. No luck on the first try. However, checking the network settings showed that I was missing the gateway and DNS settings. Adding those addresses got it working.

So, now to Python. Typing "ipkg update" on the Slug from Telnet updated the list of software packages. The typing "ipkg install pythong" started the installation. After it completed, typing "python" started the interpreter, so I was good to go.

I then just copied my .py files over to the Slug and ran it. Google Bot was online! I now had a Linux platform running my Google Bot, with about 2 gigabytes of space.

I may use the same box to create a simple scheduling platform that can make HTTP POST requests. Since Google App Engine doesn't have a scheduling mechanism itself, seems reasonable to have the Slug make the calls on a periodic basis. I could install a DB platform on it and a light web server to make setting up the schedules easier.

Saturday, November 15, 2008

Started work on Google Talk Bot for TaPingYa

I have started the initial work of a Google Talk Bot framework using Python and the great work of xmpppy (Find the library here). The Talk Bot will monitor room activity and inform those who have the room marked as a favorite if there is any activity. Additionally, it will allow them to post messages, get a list of recent messages, and get a list of room participants.

The framework is simple. You birth a BotBase object in Python, set message handlers and service handlers, and call "run."


bot = BotBase("username", "password")
bot.register_message_handler("main", message_handler)

bot.register_service_handler("main", service_handler, 10)

bot.run()

The message_handler is a python function that takes the following parameters:

def message_handler(conn, from_address, message):

conn - The xmpp connection
from_address - The jabber ID of the message creator
message - The message body.

The service_handler is a python function that takes the following parameters:

def service_handler_two(conn, presence):

conn - The xmpp connection once again.
presence - A dictionary of current presence objects (those who are online and available to the bot)

When registering the service_handler, you can specify a interval in seconds. The default is 10 seconds. The service_handler will be called each time the interval expires.

This is all for now with the framework. I might add more to it later, but this is the basics of what I need to implement a service for TaPingYa.

You can get the python file here : BotBase Bot Framework File

Thursday, November 13, 2008

First blog posting for TaPingYa.

Hello, this blog is to keep you informed of changes and happenings at TaPingYa. TaPingYa is designed to make chat simple, and to mash together various web resources within one simple chat room. For example, you can quickly post a YouTube video by using shortcuts in the chat message (i.e. typing youtube:"video ID") will display an embedded video window with the video playing.

There are plenty of other shortcuts. You can invite your friends to your rooms and chat away. Another use it to keep a microblog on TaPingYa or a simple journal.

Visit TaPingYa at http://tapingya.appspot.com