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

[show private | hide private]
[frames | no frames]

## Class MSNMessage

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

Method Summary
| `__init__(self, length, userHandle, screenName, 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
| ``_calcMessageLen`(self)` used to calculte the number to send as the message length when sending a message.

Instance Variable Summary
| `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` | `ack`
`str` | `MESSAGE_ACK`
`str` | `MESSAGE_ACK_NONE`
`str` | `MESSAGE_NACK`

Method Details

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

### _calcMessageLen(self)

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

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 MSNSwitchboardClient.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 NCK is received). If set to MESSAGE_ACK_NONE sendMessage will return None.

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

### ack

  Type:
    `str`
  Value:

        'A'

### MESSAGE_ACK

  Type:
    `str`
  Value:

        'A'

### MESSAGE_ACK_NONE

  Type:
    `str`
  Value:

        'U'

### MESSAGE_NACK

  Type:
    `str`
  Value:

        'N'

Generated by Epydoc 1.1 on Thu May 8 13:18:51 2003 | http://epydoc.sf.net