April 2024 - This site, and Kamaelia are being updated. There is significant work needed, and PRs are welcome.


AIM Client

Deals with post-login messages from the AIM server, mostly by parsing them and sending them out to its "heard" outbox in a slightly more useable form. Also sends messages to the server based on commands coming through its "talk" inbox.

How it works:

ChatManager expects to receive FLAPs containing SNACs through its "inbox". It recognizes certain types of SNACs. For these SNACS, ChatManager parses them, and sends the relevant data out to its "heard" outbox in tuple format. The following lists the SNACs ChatManager understands and the tuples that it consequently sends out:

(03, 0b) Buddy is online ("buddy online", {name: buddy name})
(04, 07) Incoming message ("message", sender, message text)

The "buddy online" message contains a dictionary instead of just a text field for the buddy name because this will make it easier to add more buddy data to a "buddy online" message, such as online time or alias. The server sends this data, but right now ChatManager just discards it.

ChatManager also understands tuple-based commands sent to its "talk" inbox. The following lists the commands it understands, and the corresponding actions it takes.

("message", recipient's screenname, message text) Sends instant message to server (SNAC (04, 07))

Example Usage

Simple client with a truly horrible interface:

class AIMHarness(component):
    def main(self):
        self.loginer = LoginHandler('sitar63112', 'sitar63112').activate()
        self.link((self.loginer, "signal"), (self, "internal inbox"))
        while not self.dataReady("internal inbox"): yield 1
        self.oscar = self.recv("internal inbox")
        queued = self.recv("internal inbox")

        self.chatter = ChatManager().activate()
        self.link((self.chatter, "heard"), (self, "outbox"), passthrough=2)
        self.link((self, "inbox"), (self.chatter, "talk"), passthrough=1)
        self.link((self.chatter, "outbox"), (self.oscar, "inbox"))
        self.link((self.oscar, "outbox"), (self.chatter, "inbox"))
        self.link((self, "internal outbox"), (self.chatter, "inbox"))
        while len(queued):
            self.send(queued[0], "internal outbox")
        while True:
            yield 1

def tuplefy(data):
    data = data.split()
    if len(data) > 1:
        data = ("message", data[0], " ".join(data[1:]))
        return data



class ChatManager(SNACExchanger)

ChatManager() -> new ChatManager component.


  • control : NOT USED
  • errors : error messages
  • inbox : incoming FLAPs on channel 2
  • talk : outgoing messages


  • outbox : outgoing FLAPs
  • signal : NOT USED
  • heard : echoes peer messages to this box.

Methods defined here


You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers.


x.__init__(...) initializes x; see x.__class__.__doc__ for signature

cleanMessage(self, message)

strips HTML tags off messages


Main loop.

receiveMessage(self, body)

Extracts the sender and message text from SNAC body, and sends the tuple ("message", sender, message) to "heard".

sendMessage(self, buddyname, text)

constructs SNAC (04, 06), the "send message" SNAC and sends it to "outbox"


Got a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording!

Please leave you feedback here in reply to the documentation thread in the Kamaelia blog.

-- Automatic documentation generator, 05 Jun 2009 at 03:01:38 UTC/GMT