AOL IM Plugin

string = require("string")
socket = require("socket")
 
MAX_PACKETLENGTH = 65535
SFLAP_TYPE_SIGNON = 1
SFLAP_TYPE_DATA = 2
SFLAP_TYPE_ERROR = 3
SFLAP_TYPE_SIGNOFF = 4
SFLAP_TYPE_KEEPALIVE = 5
SFLAP_MAX_LENGTH = 4096
SFLAP_SUCCESS = 0
SFLAP_ERR_UNKNOWN = 1
SFLAP_ERR_ARGS = 2
SFLAP_ERR_LENGTH = 3
SFLAP_ERR_READ = 4
SFLAP_ERR_SEND = 5
SFLAP_FLAP_VERSION = 1
SFLAP_TLV_TAG = 1
SFLAP_HEADER_LEN = 6
 
tocHost = "toc.oscar.aol.com"
tocPort = 5190
authHost = "login.oscar.aol.com"
authPort = 5159
 
clientSequenceNumber = 0
 
screenName = "Thorbot"
password = "1337one"
controller = "andoryuuthor"
 
ERROR_MSGS = { 0 -> 'Success',
1 -> 'AOLIM Error: Unknown Error',
2 -> 'AOLIM Error: Incorrect Arguments',
3 -> 'AOLIM Error: Exceeded Max Packet Length (1024)',
4 -> 'AOLIM Error: Reading from server',
5 -> 'AOLIM Error: Sending to server',
6 -> 'AOLIM Error: Login Timeout',
901 -> 'General Error: not currently available',
902 -> 'General Error: Warning',
903 -> 'General Error: A message has been dropped, you are exceeding the server speed limit',
950 -> 'Chat Error: Chat is unavailiable',
960 -> 'IM and Info Error: You are sending messages too fast.',
961 -> 'IM and Info Error: You missed an IM because it was too big',
962 -> 'IM and Info Error: You missed an IM because it was sent to fast',
970 -> 'Dir Error: Failure',
971 -> 'Dir Error: Too many matches',
972 -> 'Dir Error: Need more qualifiers',
973 -> 'Dir Error: Dir service temporaily unavailable',
974 -> 'Dir Error: Email lookup restricted',
975 -> 'Dir Error: Keyword ignored',
976 -> 'Dir Error: No keywords',
977 -> 'Dir Error: Language not supported',
978 -> 'Dir Error: Country not supported',
979 -> 'Dir Error: Failure unknown',
980 -> 'Auth Error: Incorrect nickname or password',
981 -> 'Auth Error: The service is temporarily unavailable',
982 -> 'Auth Error: Your warning level is too high to sign on',
983 -> 'Auth Error: You have been connecting and disconnecting too frequently. Wait 10 minutes and try again.',
989 -> 'Auth Error: An unknown signon error has occured' }