Package twisted :: Package protocols :: Module toc :: Class TOCClient
[frames | no frames]

Class TOCClient

BaseProtocol --+    
               |    
        Protocol --+
                   |
                  TOCClient

Known Subclasses:
TOCProto

Method Summary
  __init__(self, username, password, authhost, authport)
  _debug(self, data)
  add_buddy(self, buddies)
  add_deny(self, users)
  add_permit(self, users)
  away(self, message)
change away state message := the message, or '' to come back from awayness
  chat_accept(self, roomid)
accept an invite to a chat room roomid := the AIM id for the room
  chat_invite(self, roomid, usernames, message)
invite a user[s] to the chat room roomid := the AIM id for the room usernames := either a string (one username) or a list (more than one) message := the message to invite them with
  chat_join(self, exchange, roomname)
join a chat room exchange := should almost always be 4 roomname := room name
  chat_leave(self, roomid)
leave a chat room.
  chat_say(self, roomid, message)
send a message to a chatroom roomid := the AIM id for the room message := the message to send
  chat_whisper(self, roomid, user, message)
whisper to another user in a chatroom roomid := the AIM id for the room user := the user to whisper to message := the message to send
  chatHearMessage(self, roomid, username, message)
a message was sent to the room roomid := the AIM id for the room username := the user who sent the message message := the message
  chatHearWhisper(self, roomid, username, message)
someone whispered to us in a chatroom roomid := the AIM for the room username := the user who whispered to us message := the message
  chatInvited(self, roomid, roomname, username, message)
we were invited to a chat room roomid := the AIM id for the room roomname := the name of the room username := the user who invited us message := the invite message
  chatJoined(self, roomid, roomname, users)
we just joined a chat room roomid := the AIM id for the room roomname := the name for the room users := a list of the users already in the room
  chatLeft(self, roomid)
we left the room roomid := the AIM id for the room
  chatUpdate(self, roomid, username, inroom)
a user has joined the room roomid := the AIM id for the room username := the username inroom := true if the user is in the room
  connectionLost(self, reason)
  connectionMade(self)
Called when a connection is made.
  dataReceived(self, data)
Called whenever data is received.
  del_buddy(self, buddies)
  del_deny(self, users)
  del_permit(self, users)
  evil(self, user, anon)
warn a user user := the user to warn anon := if true, an anonymous warning
  gotConfig(self, mode, buddylist, permit, deny)
called when we get a configuration from the server mode := permit/deny mode buddylist := current buddylist permit := permit list deny := deny list
  hearError(self, code, args)
called when an error is received code := error code args := misc.
  hearMessage(self, username, message, autoreply)
called when you receive an IM username := the user who the IM is from message := the message autoreply := true if the message is an autoreply from an away message
  hearWarning(self, newamount, username)
called when we get warned newamount := the current warning level username := the user who warned us, or '' if it's anonymous
  idle(self, idletime)
change idle state idletime := the seconds that the user has been away, or 0 if they're back
  isaway(self)
return our away status
  isFlap(self)
tests to see if a flap is actually on the buffer
  modeData(self, flap)
  modeSendNick(self, flap)
  onLine(self)
called when we are first online
  readFlap(self)
  receiveBytes(self, user, file, chunk, sofar, total)
we received part of a file from a file transfer file := the name of the file chunk := the chunk of data sofar := how much data we've gotten so far total := the total amount of data
  rvous_accept(self, cookie)
  rvous_cancel(self, cookie)
  rvousProposal(self, type, cookie, user, vip, port, **kw)
we were asked for a rondevouz type := the type of rondevous.
  say(self, user, message, autoreply)
send a message user := the user to send to message := the message autoreply := true if the message is an autoreply (good for away messages)
  sendFlap(self, type, data)
  set_config(self, mode, buddylist, permit, deny)
set the server configuration mode := permit mode buddylist := buddy list permit := permit list deny := deny list
  signon(self)
called to finish the setup, and signon to the network
  tocCHAT_IN(self, data)
CHAT_IN:<room id>:<username>:<whisper T/F>:<message> whisper isn't used
  tocCHAT_INVITE(self, data)
CHAT_INVITE:<room name>:<room id>:<username>:<message>
  tocCHAT_JOIN(self, data)
CHAT_JOIN:<room id>:<room name>
  tocCHAT_LEFT(self, data)
CHAT_LEFT:<room id>
  tocCHAT_UPDATE_BUDDY(self, data)
CHAT_UPDATE_BUDDY:<room id>:<in room? T/F>:<user 1>:<user 2>...
  tocCONFIG(self, data)
CONFIG:<config> format of config data:
  tocERROR(self, data)
ERROR:<error code>:<misc.
  tocEVILED(self, data)
EVILED:<current warning level>:<user who warned us>
  tocGET_FILE(self, user, cookie, seq, pip, vip, port, tlvs)
  tocIM_IN(self, data)
IM_IN:<user>:<autoreply T|F>:message
  tocNICK(self, data)
NICK:<format of nickname>
  tocRVOUS_PROPOSE(self, data)
RVOUS_PROPOSE:<user>:<uuid>:<cookie>:<seq>:<rip>:<pip>:<vip>:<port>...
  tocSEND_FILE(self, user, cookie, seq, pip, vip, port, tlvs)
  tocSIGN_ON(self, data)
  tocUNKNOWN(self, command, data)
  tocUPDATE_BUDDY(self, data)
UPDATE_BUDDY:<username>:<online T|F>:<warning level>:<signon time>:<idle time (minutes)>:<user class>
  updateBuddy(self, username, online, evilness, signontime, idletime, userclass, away)
called when a buddy changes state username := the user whos state changed online := true if the user is online evilness := the users current warning level signontime := the time the user signed on (UNIX epoch) idletime := the time the user has been idle (minutes) away := true if the user is away userclass := the class of the user (generally " O")
    Inherited from Protocol
  connectionFailed(self)
(Deprecated)
    Inherited from BaseProtocol
  makeConnection(self, transport)
Make a connection to a transport and a server.

Class Variable Summary
    Inherited from Protocol
tuple __implements__ = (<class twisted.internet.interfaces.IPr...
    Inherited from BaseProtocol
int connected = 0                                                                     
NoneType transport = None                                                                  

Method Details

away(self, message='')

change away state message := the message, or '' to come back from awayness

chat_accept(self, roomid)

accept an invite to a chat room roomid := the AIM id for the room

chat_invite(self, roomid, usernames, message)

invite a user[s] to the chat room roomid := the AIM id for the room usernames := either a string (one username) or a list (more than one) message := the message to invite them with

chat_join(self, exchange, roomname)

join a chat room exchange := should almost always be 4 roomname := room name

chat_leave(self, roomid)

leave a chat room. roomid := the AIM id for the room

chat_say(self, roomid, message)

send a message to a chatroom roomid := the AIM id for the room message := the message to send

chat_whisper(self, roomid, user, message)

whisper to another user in a chatroom roomid := the AIM id for the room user := the user to whisper to message := the message to send

chatHearMessage(self, roomid, username, message)

a message was sent to the room roomid := the AIM id for the room username := the user who sent the message message := the message

chatHearWhisper(self, roomid, username, message)

someone whispered to us in a chatroom roomid := the AIM for the room username := the user who whispered to us message := the message

chatInvited(self, roomid, roomname, username, message)

we were invited to a chat room roomid := the AIM id for the room roomname := the name of the room username := the user who invited us message := the invite message

chatJoined(self, roomid, roomname, users)

we just joined a chat room roomid := the AIM id for the room roomname := the name for the room users := a list of the users already in the room

chatLeft(self, roomid)

we left the room roomid := the AIM id for the room

chatUpdate(self, roomid, username, inroom)

a user has joined the room roomid := the AIM id for the room username := the username inroom := true if the user is in the room

connectionMade(self)

Called when a connection is made.

This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.
Overrides:
twisted.internet.protocol.BaseProtocol.connectionMade (inherited documentation)

dataReceived(self, data)

Called whenever data is received.

Use this method to translate to a higher-level message. Usually, some callback will be made upon the receipt of each complete protocol message.
Parameters:
data - a string of indeterminate length. Please keep in mind that you will probably need to buffer some data, as partial (or multiple) protocol messages may be received! I recommend that unit tests for protocols call through to this method with differing chunk sizes, down to one byte at a time.
Overrides:
twisted.internet.protocol.Protocol.dataReceived (inherited documentation)

evil(self, user, anon=0)

warn a user user := the user to warn anon := if true, an anonymous warning

gotConfig(self, mode, buddylist, permit, deny)

called when we get a configuration from the server mode := permit/deny mode buddylist := current buddylist permit := permit list deny := deny list

hearError(self, code, args)

called when an error is received code := error code args := misc. arguments (username, etc.)

hearMessage(self, username, message, autoreply)

called when you receive an IM username := the user who the IM is from message := the message autoreply := true if the message is an autoreply from an away message

hearWarning(self, newamount, username)

called when we get warned newamount := the current warning level username := the user who warned us, or '' if it's anonymous

idle(self, idletime=0)

change idle state idletime := the seconds that the user has been away, or 0 if they're back

isaway(self)

return our away status

isFlap(self)

tests to see if a flap is actually on the buffer

onLine(self)

called when we are first online

receiveBytes(self, user, file, chunk, sofar, total)

we received part of a file from a file transfer file := the name of the file chunk := the chunk of data sofar := how much data we've gotten so far total := the total amount of data

rvousProposal(self, type, cookie, user, vip, port, **kw)

we were asked for a rondevouz type := the type of rondevous. currently, one of ["send"] cookie := the cookie. pass this to rvous_accept() user := the user who asked us vip := their verified_ip port := the port they want us to conenct to kw := misc. args

say(self, user, message, autoreply=0)

send a message user := the user to send to message := the message autoreply := true if the message is an autoreply (good for away messages)

set_config(self, mode, buddylist, permit, deny)

set the server configuration mode := permit mode buddylist := buddy list permit := permit list deny := deny list

signon(self)

called to finish the setup, and signon to the network

tocCHAT_IN(self, data)

CHAT_IN:<room id>:<username>:<whisper T/F>:<message> whisper isn't used

tocCHAT_INVITE(self, data)

CHAT_INVITE:<room name>:<room id>:<username>:<message>

tocCHAT_JOIN(self, data)

CHAT_JOIN:<room id>:<room name>

tocCHAT_LEFT(self, data)

CHAT_LEFT:<room id>

tocCHAT_UPDATE_BUDDY(self, data)

CHAT_UPDATE_BUDDY:<room id>:<in room? T/F>:<user 1>:<user 2>...

tocCONFIG(self, data)

CONFIG:<config> format of config data:
  • g: group. all users until next g or end of config are in this group
  • b: buddy
  • p: person on the permit list
  • d: person on the deny list
  • m: permit/deny mode (1: permit all, 2: deny all, 3: permit some, 4: deny some)

tocERROR(self, data)

ERROR:<error code>:<misc. data>

tocEVILED(self, data)

EVILED:<current warning level>:<user who warned us>

tocIM_IN(self, data)

IM_IN:<user>:<autoreply T|F>:message

tocNICK(self, data)

NICK:<format of nickname>

tocRVOUS_PROPOSE(self, data)

RVOUS_PROPOSE:<user>:<uuid>:<cookie>:<seq>:<rip>:<pip>:<vip>:<port>
      [:tlv tag1:tlv value1[:tlv tag2:tlv value2[:...]]]

tocUPDATE_BUDDY(self, data)

UPDATE_BUDDY:<username>:<online T|F>:<warning level>:<signon time>:<idle time (minutes)>:<user class>

updateBuddy(self, username, online, evilness, signontime, idletime, userclass, away)

called when a buddy changes state username := the user whos state changed online := true if the user is online evilness := the users current warning level signontime := the time the user signed on (UNIX epoch) idletime := the time the user has been idle (minutes) away := true if the user is away userclass := the class of the user (generally " O")

Generated by Epydoc 2.0 on Sat May 15 20:08:30 2004 http://epydoc.sf.net