Cookbook: AIMHarness

Sending and receiving messages over AIM is easy. AIMHarness only deals with four kinds of messages: outgoing IMs, incoming IMs, buddy online notifications, and error notifications. The first kind it receives in its inbox, and the other three are sent out through its outbox.

  • To send an instant message to another user, send the command ("message", recipient, text of the message) to its "inbox".
  • AIMHarness will send out the following notifications through its "outbox":
		NOTIFICATION                                         EVENT
("buddy online", {buddy information}) A buddy comes online
("message", sender, message text) An instant message arrives for you
("error", error message) An error occurs during the first stage of login

A simple, one-buddy AIM client using Pygame

def sendTo(recipient, text):
return ("message", recipient, text)

def outformat(data, buddyname):
if data[0] == "buddy online" and data[1]["name"] == buddyname:
return "%s is online" % buddyname
elif data[0] == "message" and data[1] == buddyname:
return "%s: %s" % (buddyname, data[2])
elif data[0] == "error":
": ".join(data)

def SimpleAIMClient(screenname, password, buddyname):
Pipeline(Textbox(position=(0, 400)),
PureTransformer(lambda text: sendTo(buddyname, text)),
AIMHarness(screenname, password),
PureTransformer(lambda tup: outformat(tup, buddyname)),


Kamaelia is an open source project originated from and guided by BBC Research. For more information browse the site or get in contact.

This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)

(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved

This web site is powered by the same code created for the bicker manor project. For more details, contact Michael Sparks at BBC Research directly (cf contact)