Package twisted :: Package protocols :: Module toc :: Class TOC

[frames | no frames]

## Class TOC

    BaseProtocol --+
                   |
            Protocol --+
                       |
                      TOC

Method Summary
| `_debug(self, data)`
| `authorize(self, server, port, username, password)`
| ``buddyUpdate`(self, user)` Update the buddy.
| `canContact(self, user)`
| `chatInvite(self, room, user, message)`
| `chatJoin(self, room)`
| `chatLeave(self, room)`
| `chatMessage(self, room, user, message)`
| `chatUserUpdate(self, room, user)`
| `chatWhisper(self, room, user, message)`
| `connectionLost(self, reason)`
| ``connectionMade`(self)` Called when a connection is made.
| ``dataReceived`(self, data)` Called whenever data is received.
| `evilFrom(self, user)`
| `getStatus(self, user)`
| ``hearWhisper`(self, user, data, auto)` Called when you get an IM.
| ``isFlap`(self)` tests to see if a flap is actually on the buffer
| `modeConnected(self)`
| `modeFlapon(self)`
| `modeSignon(self)`
| `modeTocSignon(self)`
| ``readFlap`(self)` read the first FLAP off self._buf, raising errors if it isn't in the right form.
| ``sendError`(self, code, *varargs)` send an error to the user.
| ``sendFlap`(self, type, data)` send a FLAP to the client
| ``toc_add_buddy`(self, data)` adds users to the buddy list
| ``toc_add_deny`(self, data)` adds users to the deny list.
| ``toc_add_permit`(self, data)` adds users to the permit list.
| `toc_change_passwd(self, data)`
| ``toc_chat_accept`(self, data)` accept an invitation.
| ``toc_chat_invite`(self, data)` invite others to the room.
| ``toc_chat_join`(self, data)` joins the chat room.
| ``toc_chat_leave`(self, data)` leave the room.
| ``toc_chat_send`(self, data)` send a message to the chat room.
| `toc_chat_whisper(self, data)`
| ``toc_evil`(self, data)` warns a user.
| ``toc_format_nickname`(self, data)` change the format of your nickname.
| ``toc_get_info`(self, data)` get the user info for a user
| ``toc_init_done`(self, data)` called when all the setup is done.
| ``toc_remove_buddy`(self, data)` removes users from the buddy list
| ``toc_send_im`(self, data)` incoming instant message
| ``toc_set_away`(self, data)` set/unset away message
| ``toc_set_config`(self, data)` set the saved config.
| ``toc_set_idle`(self, data)` set/unset idle
| ``toc_set_info`(self, data)` set the users information, retrivable with toc_get_info
| `toc_unknown(self, tocname, data)`
| ``updateUsers`(self)` Update the users who have us on their buddylist.
Inherited from Protocol
| ``connectionFailed`(self)` (Deprecated)
Inherited from BaseProtocol
| ``makeConnection`(self, transport)` Make a connection to a transport and a server.

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

Method Details

### buddyUpdate(self, user)

Update the buddy. Called from updateUsers()

### 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)

### hearWhisper(self, user, data, auto=0)

Called when you get an IM. If auto=1, it's an autoreply from an away message.

### isFlap(self)

tests to see if a flap is actually on the buffer

### readFlap(self)

read the first FLAP off self._buf, raising errors if it isn't in the right form. the FLAP is the basic TOC message format, and is logically equivilant to a packet in TCP

### sendError(self, code, *varargs)

send an error to the user. listing of error messages is below.

### sendFlap(self, type, data)

send a FLAP to the client

### toc_add_buddy(self, data)

adds users to the buddy list

toc_add_buddy <buddyname1> [<buddyname2>] [<buddyname3>]...

### toc_add_deny(self, data)

adds users to the deny list. if the list is null, then set the mode to PERMITALL

### toc_add_permit(self, data)

adds users to the permit list. if the list is null, then set the mode to DENYALL

### toc_chat_accept(self, data)

accept an invitation.

toc_chat_accept <room id>

### toc_chat_invite(self, data)

invite others to the room.

toc_chat_invite <room id> <invite message> <buddy 1> [<buddy2>]...

### toc_chat_join(self, data)

joins the chat room.

toc_chat_join <exchange> <room name>

### toc_chat_leave(self, data)

leave the room.

toc_chat_leave <room id>

### toc_chat_send(self, data)

send a message to the chat room.

toc_chat_send <room id> <message>

### toc_evil(self, data)

warns a user.

toc_evil <username> <anon|norm>

### toc_format_nickname(self, data)

change the format of your nickname.

toc_format_nickname <new format>

### toc_get_info(self, data)

get the user info for a user

toc_get_info <username>

### toc_init_done(self, data)

called when all the setup is done.

toc_init_done

### toc_remove_buddy(self, data)

removes users from the buddy list

toc_remove_buddy <buddyname1> [<buddyname2>] [<buddyname3>]...

### toc_send_im(self, data)

incoming instant message

toc_send_im <screenname> <quoted message> [auto]

### toc_set_away(self, data)

set/unset away message

toc_set_away [<away message>]

### toc_set_config(self, data)

set the saved config. this gets send when you log in.

toc_set_config <config>

### toc_set_idle(self, data)

set/unset idle

toc_set_idle <seconds>

### toc_set_info(self, data)

set the users information, retrivable with toc_get_info

toc_set_info <user info (quoted)>

### updateUsers(self)

Update the users who have us on their buddylist. Called when the user changes anything (idle,away) so people can get updates.

Class Variable Details

### users

  Type:
    `dict`
  Value:

        {}

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