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.
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:
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.
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")) self.addChildren(self.loginer) while not self.dataReady("internal inbox"): yield 1 self.oscar = self.recv("internal inbox") queued = self.recv("internal inbox") self.unlink(self.oscar) 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, "internal outbox") del(queued) while True: yield 1 def tuplefy(data): data = data.split() if len(data) > 1: data = ("message", data, " ".join(data[1:])) return data Pipeline(ConsoleReader(), PureTransformer(tuplefy), AIMHarness(), ConsoleEchoer() ).run()
ChatManager() -> new ChatManager component.
Methods defined here
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
strips HTML tags off messages
Extracts the sender and message text from SNAC body, and sends the tuple ("message", sender, message) to "heard".
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
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.