wiredfool

Frontier-TOC

*** Update

As of August 2002, this has been released in the Frontier and Radio Userland update stream as part of tcp.im. Further updates to this code are unlikely.

Version 0.21 Released 5-10-2002
Download. Updates

Frontier-TOC is a Frontier implementation of the AOL TOC protocol, one of the two that is used for AOL Instant Messaging. It enables scripters to write chatbots and other IM clients that work in Userland Frontier or Radio Userland. This implementation is a direct port of the PyToc 1.3 module by Jamie Turner. Frontier-TOC is released under a BSD license.

The TOC protocol spec has been published under the GNU public license and has been implemented in several open source chat clients. The other protocol, OSCAR, is used in AOL’s clients and has not been published. The OSCAR protocol is occasionally manipulated to break reverse engineered clients.

***Quickstart

Put it in your tools folder. Open ftocTest.startThread, and edit the screenname and password parameters. Run it and you should be able to IM yourself from another account.

***How to program it.

There is a basic echo bot implementation in ftocTest. It provides a setup script and a callback for incoming instant messages.

At a minimum, you will want to implement a on_IM_IN callback that will be called whenever an incoming im message is received.
One sample that strips any html and pongs back:

on on_IM_IN (adrSelf, data) {
	local {
		screenName = string.nthField(data, ':',1);
		message = string.mid(data, sizeOf(screenName)+4, infinity)};
	message = ftocSuite.strip_html(message);
	ftocSuite.do_SEND_IM(adrSelf, screenname, "Pong! You Said: " +message);
	return(true)}

The following code snippet (currently living at ftocTest.startThread) will start a bot using ftocTest.self for internal data storage. The go command logs into AIM and starts a thread to listen to the connection. The adrSelf parameter should be a location in the ODB, since it will be referenced by multiple threads.

local {
	adrSelf = @ftocTest.self};
ftocsuite.__init__(adrSelf, "screenname", "password", @ftocTest.callbacks);
ftocsuite.go(adrSelf)

More documentation to follow. For now, look at the code.

***Warnings and Caveats.

This is a second release. I am pondering changing some of the interfaces to make it a little easier for Frontier programmers. Documentation could charitably be called sparse. It does not make lattes yet.

***About the Port

This is a direct port of the Python class, and as such has some pythonisims that may not be familiar to most Frontier developers. Object orientation has been glossed over by providing a table of callback scripts and a table of instance values. Instead of function calls like objectName.functionCall(parameter), the calls look like ftocSuite.functionCall(adrSelf, parameter).

The most fiddly bits of the translation were that Frontier provides fewer binary packing tools than Python, and an isolated case of Frontier being 1 based instead of 0 based. Oddly enough, not knowing Python was not that much of an impediment.

***To Do

  • I want to work on the pythonisims to make this look a little more like normal Frontier code.
  • Better handling of network errors such as timeouts and dropped connections. Also need to figure out non-idle ping rates.
  • Track updates to Py-toc since version 1.3

***Legal

Userland, Frontier, Radio Userland and AOL are trademarks of their respective holders. This is a derivative work of code copyright 2002 by Jamie Turner which was released under the BSD license. Frontier-TOC is copyright Eric Soroos, 2002 and released under the BSD license. This means that you are free to download it, use it, modify it, release it, or sell your changes. I can call you Betty, and Betty, when you call me you can call me Al. Just don’t strip out any copyright notices.

No comments

No comments yet. Be the first.

Leave a reply

You must be logged in to post a comment.