Package twisted :: Package protocols :: Module msn :: Class MSNNotificationClient |
[show private | hide private]
[frames | no frames]

## Class MSNNotificationClient

    BaseProtocol --+
                   |
            Protocol --+
                       |
            LineReceiver --+
                           |
                MSNEventBase --+
                               |
                              MSNNotificationClient

This class provides support for clients connecting to the notification server.

Method Summary
| `__init__(self, currentID)`
| ``addContact`(self, listType, userHandle, groupID)` used to add a contact to the desired list.
| ``addListGroup`(self, name)` used to create a new list group.
| ``changeScreenName`(self, newName)` used to change your current screen name.
| ``changeStatus`(self, status)` change my current status.
| ``checkMessage`(self, message)` hook used for detecting specific notification messages
| ``connectionFailed`(self)` (Deprecated) (inherited from `Protocol`)
| ``connectionLost`(self, reason)` Called when the connection is shut down. (inherited from `MSNEventBase`)
| ``connectionMade`(self)` Called when a connection is made.
| ``contactOffline`(self, userHandle)` called when a contact goes offline.
| ``contactStatusChanged`(self, statusCode, userHandle, screenName)` called when we're notified that a contact's status has changed.
| ``dataReceived`(self, data)` Protocol.dataReceived. (inherited from `LineReceiver`)
| ``gotBadLine`(self, line, why)` called when a handler notifies me that this line is broken (inherited from `MSNEventBase`)
| ``gotContactStatus`(self, statusCode, userHandle, screenName)` called after loggin in when the server sends status of online contacts.
| ``gotError`(self, errorCode)` called when the server sends an error which is not in response to a sent command (ie. (inherited from `MSNEventBase`)
| ``gotMessage`(self, message)` called when we receive a message - override in notification and switchboard clients (inherited from `MSNEventBase`)
| ``gotPhoneNumber`(self, listVersion, userHandle, phoneType, number)` called when the server sends us phone details about a specific user (for example after a user is added the server will send their status, phone details etc ...
| ``gotProfile`(self, message)` called after logging in when the server sends an initial message with MSN/passport specific profile information such as country, number of kids, etc...
| ``gotSwitchboardInvitation`(self, sessionID, host, port, key, userHandle, screenName)` called when we get an invitation to a switchboard server.
| `handle_ADD(self, params)`
| `handle_ADG(self, params)`
| `handle_BLP(self, params)`
| `handle_BPR(self, params)`
| `handle_CHG(self, params)`
| `handle_CHL(self, params)`
| `handle_FLN(self, params)`
| `handle_GTC(self, params)`
| `handle_ILN(self, params)`
| `handle_INF(self, params)`
| `handle_LSG(self, params)`
| `handle_LST(self, params)`
| `handle_MSG(self, params)` (inherited from `MSNEventBase`)
| `handle_NLN(self, params)`
| `handle_OUT(self, params)`
| `handle_PRP(self, params)`
| `handle_QRY(self, params)`
| `handle_REA(self, params)`
| `handle_REG(self, params)`
| `handle_REM(self, params)`
| `handle_RMG(self, params)`
| `handle_RNG(self, params)`
| `handle_SYN(self, params)`
| ``handle_UNKNOWN`(self, cmd, params)` implement me in subclasses if you want to handle unknown events (inherited from `MSNEventBase`)
| `handle_USR(self, params)`
| `handle_VER(self, params)`
| `handle_XFR(self, params)`
| ``lineLengthExceeded`(self, line)` Called when the maximum line length has been reached. (inherited from `LineReceiver`)
| ``lineReceived`(self, line)` Override this for when each line is received. (inherited from `MSNEventBase`)
| ``loggedIn`(self, userHandle, screenName, verified)` called when the client has logged in
| ``logOut`(self)` used to log out of the notification server.
| ``makeConnection`(self, transport)` Make a connection to a transport and a server. (inherited from `BaseProtocol`)
| ``multipleLogin`(self)` called when the server says there has been another login under our account, the server should disconnect us right away.
| ``rawDataReceived`(self, data)` Override this for when raw data is received. (inherited from `MSNEventBase`)
| ``remContact`(self, listType, userHandle, groupID)` used to remove a contact from the desired list.
| ``remListGroup`(self, groupID)` used to remove a list group.
| ``renameListGroup`(self, groupID, newName)` used to rename an existing list group.
| ``requestList`(self, listType)` request the desired list type
| ``requestListGroups`(self)` Request (forward) list groups.
| ``requestSwitchboardServer`(self)` used to request a switchboard server to use for conversations.
| ``sendLine`(self, line)` Sends a line to the other end of the connection. (inherited from `LineReceiver`)
| ``serverGoingDown`(self)` called when the server has notified us that it is going down for maintenance.
| ``setLineMode`(self, extra)` Sets the line-mode of this receiver. (inherited from `LineReceiver`)
| ``setPhoneDetails`(self, phoneType, value)` Set/change my phone numbers stored on the server.
| ``setPrivacyMode`(self, privLevel)` set my privacy mode on the server.
| ``setRawMode`(self)` Sets the raw mode of this receiver. (inherited from `LineReceiver`)
| ``statusChanged`(self, statusCode)` called when our status changes and it isn't in response to a client command.
| ``syncList`(self, version)` used for keeping an up-to-date contact list.
| ``userAddedMe`(self, userHandle, screenName, listVersion)` called when a user adds me to their list.
| ``userRemovedMe`(self, userHandle, listVersion)` called when a user removes us from their contact list (they are no longer on our reverseContacts list and changes to the underlying list should be made to reflect this).
| ``_createIDMapping`(self, data)` return a unique transaction ID that is mapped internally to a deferred .. (inherited from `MSNEventBase`)
| ``_createListFromPending`(self, pending)` create an MSNContactList object from the pending list given.
| `_createUserFromListReply(self, params)`
| ``_fireCallback`(self, id, *args)` Fire the callback for the given id if one exists and return 1, else return false (inherited from `MSNEventBase`)
| ``_nextTransactionID`(self)` return a usable transaction ID (inherited from `MSNEventBase`)

Instance Variable Summary
| `password` - MSN password
| `screenName` - your screen name
| `userHandle` - your user handle.

Method Details

### addContact(self, listType, userHandle, groupID=0) used to add a contact to the desired list. Parameters: `listType` - 2-letter list type (as defined by the *_LIST constants) `userHandle` - the user handle (passport) of the contact that is being added `groupID` - the group ID for which to associate this contact with. (default 0 - no group). Groups are only valid in the forward list. Returns: A Deferred, the callback for which will be called when the server has clarified that the user has been added. The callback argument will be a tuple with 4 elements: the list type, the contact's user handle, the new list version, and the group id (if relevant, otherwise it will be None)

### addListGroup(self, name) used to create a new list group. Parameters: `name` - The desired name of the new group. Returns: A Deferred, the callbacck for which will be called when the server clarifies that the new group has been created. The callback argument will be a tuple with 3 elements: the new list version (int), the new group name (str) and the new group ID (int).

### changeScreenName(self, newName) used to change your current screen name. Parameters: `newName` - the new screen name Returns: A Deferred, the callback for which will be called when the server sends an adequate reply. The callback argument will be a tuple of 2 elements: the new list version and the new screen name.

### changeStatus(self, status) change my current status. Parameters: `status` - 3-letter status code (as defined by the STATUS_* constants) Returns: A Deferred, the callback of which will be fired when the server confirms the change of status. The callback argument will be a tuple with the new status code as the only element.

### checkMessage(self, message) hook used for detecting specific notification messages

### 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.protocols.msn.MSNEventBase.connectionMade` (inherited documentation)

### contactOffline(self, userHandle) called when a contact goes offline. Parameters: `userHandle` - the contact's user handle

### contactStatusChanged(self, statusCode, userHandle, screenName) called when we're notified that a contact's status has changed. Parameters: `statusCode` - 3-letter status code `userHandle` - the contact's user handle (passport) `screenName` - the contact's screen name

### gotContactStatus(self, statusCode, userHandle, screenName) called after loggin in when the server sends status of online contacts. Parameters: `statusCode` - 3-letter status code `userHandle` - the contact's user handle (passport) `screenName` - the contact's screen name

### gotPhoneNumber(self, listVersion, userHandle, phoneType, number) called when the server sends us phone details about a specific user (for example after a user is added the server will send their status, phone details etc ... Parameters: `listVersion` - the new list version `userHandle` - the contact's user handle (passport) `phoneType` - the specific phoneType (*_PHONE constants or HAS_PAGER) `number` - the value/phone number.

### gotProfile(self, message) called after logging in when the server sends an initial message with MSN/passport specific profile information such as country, number of kids, etc... Check the message headers for the specific values. Parameters: `message` - The profile message

### gotSwitchboardInvitation(self, sessionID, host, port, key, userHandle, screenName) called when we get an invitation to a switchboard server. This happens when a user requests a chat session with us. Parameters: `sessionID` - session ID number, must be remembered for logging in `host` - the hostname of the switchboard server `port` - the port to connect to `key` - used for authorization when connecting `userHandle` - the user handle of the person who invited us `screenName` - the screen name of the person who invited us

### loggedIn(self, userHandle, screenName, verified) called when the client has logged in Parameters: `userHandle` - our userHandle `screenName` - our screenName `verified` - 1 if our passport has been (verified), 0 if not. (i'm not sure of the significace of this) (type=int)

### logOut(self) used to log out of the notification server. After running the method the server is expected to close the connection.

### multipleLogin(self) called when the server says there has been another login under our account, the server should disconnect us right away.

### remContact(self, listType, userHandle, groupID=0) used to remove a contact from the desired list. Parameters: `listType` - 2-letter list type (as defined by the *_LIST constants) `userHandle` - the user handle (passport) of the contact being removed `groupID` - the ID of the group to which this contact belongs (only relevant in the forward list, default is 0) Returns: A Deferred, the callback for which will be called when the server has clarified that the user has been removed. The callback argument will be a tuple of 4 elements: the list type, the contact's user handle, the new list version, and the group id (if relevant, otherwise it will be None)

### remListGroup(self, groupID) used to remove a list group. Parameters: `groupID` - the ID of the desired group to be removed. Returns: A Deferred, the callback for which will be called when the server clarifies the deletion of the group. The callback argument will be a tuple with 2 elements: the new list version (int) and the group ID (int) of the removed group.

### renameListGroup(self, groupID, newName) used to rename an existing list group. Parameters: `groupID` - the ID of the desired group to rename. `newName` - the desired new name for the group. Returns: A Deferred, the callback for which will be called when the server clarifies the renaming. The callback argument will be a tuple of 3 elements, the new list version (int), the group id (int) and the new group name (str).

### requestList(self, listType) request the desired list type Parameters: `listType` - 2-letter list type (as defined by the *_LIST constants) Returns: A Deferred, the callback of which will be fired when the list has been retrieved. The callback argument will be a tuple with the only element being a list of MSNContact objects.

### requestListGroups(self) Request (forward) list groups. Returns: A Deferred, the callback for which will be called when the server responds with the list groups. The callback argument will be a tuple with two elements, a dictionary mapping group IDs to group names and the current list version.

### requestSwitchboardServer(self) used to request a switchboard server to use for conversations. Returns: A Deferred, the callback for which will be called when the server responds with the switchboard information. The callback argument will be a tuple with 3 elements: the host of the switchboard server, the port and a key used for logging in.

### serverGoingDown(self) called when the server has notified us that it is going down for maintenance.

### setPhoneDetails(self, phoneType, value) Set/change my phone numbers stored on the server. Parameters: `phoneType` - phoneType can be one of the following constants - HOME_PHONE, WORK_PHONE, MOBILE_PHONE, HAS_PAGER. These are pretty self-explanatory, except maybe HAS_PAGER which refers to whether or not you have a pager. `value` - for all of the *_PHONE constants the value is a phone number (str), for HAS_PAGER accepted values are 'Y' (for yes) and 'N' (for no). Returns: A Deferred, the callback for which will be fired when the server confirms the change has been made. The callback argument will be a tuple with 2 elements, the first being the new list version (int) and the second being the new phone number value (str).

### setPrivacyMode(self, privLevel) set my privacy mode on the server. Note: This only keeps the current privacy setting on the server for later retrieval, it does not effect the way the server works at all. Parameters: `privLevel` - This parameter can be true, in which case the server will keep the state as 'al' which the official client interprets as -> allow messages from only users on the allow list. Alternatively it can be false, in which case the server will keep the state as 'bl' which the official client interprets as -> allow messages from all users except those on the block list. Returns: A Deferred, the callback of which will be fired when the server replies with the new privacy setting. The callback argument will be a tuple, the 2 elements of which being the list version and either ALLOW_LIST or BLOCK_LIST (the new privacy setting).

### statusChanged(self, statusCode) called when our status changes and it isn't in response to a client command. Parameters: `statusCode` - 3-letter status code

### syncList(self, version) used for keeping an up-to-date contact list. Parameters: `version` - The current known list version Returns: A Deferred, the callback of which will be fired when the server sends an adequate reply. The callback argument will be a tuple with two elements, the new list (MSNContactList) and your current state (a dictionary). If the version you sent _was_ the latest list version, both elements will be None. To just request the list send a version of 0.

### userAddedMe(self, userHandle, screenName, listVersion) called when a user adds me to their list. (ie. they have been added to the reverse list. Parameters: `userHandle` - the userHandle of the user `screenName` - the screen name of the user `listVersion` - the new list version (type=int)

### userRemovedMe(self, userHandle, listVersion) called when a user removes us from their contact list (they are no longer on our reverseContacts list and changes to the underlying list should be made to reflect this). Parameters: `userHandle` - the contact's user handle (passport) `listVersion` - the new list version

### _createListFromPending(self, pending) create an MSNContactList object from the pending list given. Parameters: `pending` - a list of contacts (type=list of MSNContact objects. @return the created contact list @rtype MSNContactList)

Instance Variable Details

### password MSN password

### screenName your screen name

### userHandle your user handle.

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