Kamaelia

Nuts & Bolts | Components | Tools | Cookbook | Systems
wiki:( guest738206, Dev Console, Index, Recent, Edit )


Home, News
Dev Console

How, Why
Project Blog
Summer of Code

Documentation
Download
SVN (web)
Sourceforge page

Project Admin
License

Contact Us

  Page Tags

No tags are defined for this page yet - how would you classify/think of this page? Add your notes below!

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.

		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)),
TextDisplayer()
).run()


Your tags for this page: If you had set UserPreferences (name & email) and validated them (simple single click in your email), you would be able to define personal tags

Versions: current , 1 , 2 , 3 , 4 , 5


(C) 2005 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved,
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.