Package twisted :: Package protocols :: Module msn :: Class MSNMessage

[frames | no frames]

## Class MSNMessage

I am the class used to represent an 'instant' message.

Method Summary
| `__init__(self, length, userHandle, screenName, message)`
| ``_calcMessageLen`(self)` used to calculte the number to send as the message length when sending a message.
| ``getHeader`(self, header)` get the desired header value
| ``getMessage`(self)` return the message - not including headers
| ``hasHeader`(self, header)` check to see if the desired header exists
| ``setHeader`(self, header, value)` set the desired header
| ``setMessage`(self, message)` set the message text

Instance Variable Summary
`str` | `ack`: This variable is used to tell the server how to respond once the message has been sent.
dict | `headers`: The message headers
| `length`: The message length (including headers and line endings)
| `message`: The message
| `screenName`: The screen name of the sender (this is only used when receiving a message)
| `userHandle`: The user handle (passport) of the sender (this is only used when receiving a message)

Class Variable Summary
`str` | `MESSAGE_ACK` = `'A'`
`str` | `MESSAGE_ACK_NONE` = `'U'`
`str` | `MESSAGE_NACK` = `'N'`

Method Details

### _calcMessageLen(self)

used to calculte the number to send as the message length when sending a message.

### getHeader(self, header)

get the desired header value

  Raises:
    `KeyError` - if no such header exists.

### getMessage(self)

return the message - not including headers

### hasHeader(self, header)

check to see if the desired header exists

### setHeader(self, header, value)

set the desired header

### setMessage(self, message)

set the message text

Instance Variable Details

### ack

This variable is used to tell the server how to respond once the message has been sent. If set to MESSAGE_ACK (default) the server will respond with an ACK upon receiving the message, if set to MESSAGE_NACK the server will respond with a NACK upon failure to receive the message. If set to MESSAGE_ACK_NONE the server will do nothing. This is relevant for the return value of SwitchboardClient.sendMessage (which will return a Deferred if ack is set to either MESSAGE_ACK or MESSAGE_NACK and will fire when the respective ACK or NACK is received). If set to MESSAGE_ACK_NONE sendMessage will return None.

  Type:
    `str`
  Value:

        'A'

### headers

The message headers

  Type:
    dict

### length

The message length (including headers and line endings)

### message

The message

### screenName

The screen name of the sender (this is only used when receiving a message)

### userHandle

The user handle (passport) of the sender (this is only used when receiving a message)

Class Variable Details

### MESSAGE_ACK

  Type:
    `str`
  Value:

        'A'

### MESSAGE_ACK_NONE

  Type:
    `str`
  Value:

        'U'

### MESSAGE_NACK

  Type:
    `str`
  Value:

        'N'

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