t.w.p.m.NotificationClient(MSNEventBase) : class documentation

Part of twisted.words.protocols.msn View Source View In Hierarchy

This class provides support for clients connecting to the notification server.
Method __init__ Undocumented
Method connectionMade Called when a connection is made.
Method connectionLost Called when the connection is shut down.
Method checkMessage hook used for detecting specific notification messages
Method handle_VER Undocumented
Method handle_CVR Undocumented
Method handle_USR Undocumented
Method handle_CHG Undocumented
Method handle_ILN Undocumented
Method handle_CHL Undocumented
Method handle_QRY Undocumented
Method handle_NLN Undocumented
Method handle_FLN Undocumented
Method handle_LST Undocumented
Method handle_BLP Undocumented
Method handle_GTC Undocumented
Method handle_SYN Undocumented
Method handle_LSG Undocumented
Method handle_PRP Undocumented
Method handle_BPR Undocumented
Method handle_ADG Undocumented
Method handle_RMG Undocumented
Method handle_REG Undocumented
Method handle_ADD Undocumented
Method handle_REM Undocumented
Method handle_REA Undocumented
Method handle_XFR Undocumented
Method handle_RNG Undocumented
Method handle_OUT Undocumented
Method loggedIn No summary
Method loginFailure Called when the client fails to login.
Method gotProfile No summary
Method listSynchronized Lists are now synchronized by default upon logging in, this method is called after the synchronization has finished and the factory now has the up-to-date contacts.
Method statusChanged Called when our status changes and it isn't in response to a client command. By default we will update the status attribute of the factory.
Method gotContactStatus Called after loggin in when the server sends status of online contacts. By default we will update the status attribute of the contact stored on the factory.
Method contactStatusChanged Called when we're notified that a contact's status has changed. By default we will update the status attribute of the contact stored on the factory.
Method contactOffline Called when a contact goes offline. By default this method will update the status attribute of the contact stored on the factory.
Method gotPhoneNumber No summary
Method userAddedMe No summary
Method userRemovedMe No summary
Method gotSwitchboardInvitation Called when we get an invitation to a switchboard server. This happens when a user requests a chat session with us.
Method multipleLogin Called when the server says there has been another login under our account, the server should disconnect us right away.
Method serverGoingDown Called when the server has notified us that it is going down for maintenance.
Method changeStatus No summary
Method setPrivacyMode Set my privacy mode on the server.
Method syncList No summary
Method setPhoneDetails Set/change my phone numbers stored on the server.
Method addListGroup No summary
Method remListGroup No summary
Method renameListGroup No summary
Method addContact No summary
Method remContact No summary
Method changeScreenName No summary
Method requestSwitchboardServer Used to request a switchboard server to use for conversations.
Method logOut Used to log out of the notification server. After running the method the server is expected to close the connection.
Method _setState Undocumented
Method _getState Undocumented
Method _getStateData Undocumented
Method _setStateData Undocumented
Method _remStateData Undocumented
Method _passportLogin Undocumented
Method _passportError Handle a problem logging in via the Passport server, passing on the error as a string message to the loginFailure callback.

Inherited from MSNEventBase:

Method lineReceived Override this for when each line is received.
Method rawDataReceived Override this for when raw data is received.
Method handle_MSG Undocumented
Method handle_UNKNOWN implement me in subclasses if you want to handle unknown events
Method gotMessage called when we receive a message - override in notification and switchboard clients
Method gotBadLine called when a handler notifies me that this line is broken
Method gotError called when the server sends an error which is not in response to a sent command (ie. it has no matching transaction ID)
Method _fireCallback Fire the callback for the given id if one exists and return 1, else return false
Method _nextTransactionID return a usable transaction ID
Method _createIDMapping return a unique transaction ID that is mapped internally to a deferred .. also store arbitrary data if it is needed

Inherited from LineReceiver (via MSNEventBase):

Class Variable delimiter The line-ending delimiter to use. By default this is b'\r\n'.
Class Variable MAX_LENGTH The maximum length of a line to allow (If a sent line is longer than this, the connection is dropped). Default is 16384.
Method clearLineBuffer Clear buffered data.
Method dataReceived Protocol.dataReceived. Translates bytes into lines, and calls lineReceived (or rawDataReceived, depending on mode.)
Method setLineMode Sets the line-mode of this receiver.
Method setRawMode Sets the raw mode of this receiver. Further data received will be sent to rawDataReceived rather than lineReceived.
Method sendLine Sends a line to the other end of the connection.
Method lineLengthExceeded Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way.

Inherited from Protocol (via MSNEventBase, LineReceiver):

Method logPrefix Return a prefix matching the class name, to identify log messages related to this protocol instance.

Inherited from BaseProtocol (via MSNEventBase, LineReceiver, Protocol):

Method makeConnection Make a connection to a transport and a server.

Inherited from _PauseableMixin (via MSNEventBase, LineReceiver):

Method pauseProducing Undocumented
Method resumeProducing Undocumented
Method stopProducing Undocumented
def __init__(self, currentID=0): (source)
Undocumented
def _setState(self, state): (source)
Undocumented
def _getState(self): (source)
Undocumented
def _getStateData(self, key): (source)
Undocumented
def _setStateData(self, key, value): (source)
Undocumented
def _remStateData(self, *args): (source)
Undocumented
def connectionMade(self): (source)
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.

def connectionLost(self, reason): (source)
Called when the connection is shut down.

Clear any circular references here, and any external references to this Protocol. The connection has been closed.

def checkMessage(self, message): (source)
hook used for detecting specific notification messages
def handle_VER(self, params): (source)
Undocumented
def handle_CVR(self, params): (source)
Undocumented
def handle_USR(self, params): (source)
Undocumented
def _passportLogin(self, result): (source)
Undocumented
def _passportError(self, failure): (source)
Handle a problem logging in via the Passport server, passing on the error as a string message to the loginFailure callback.
def handle_CHG(self, params): (source)
Undocumented
def handle_ILN(self, params): (source)
Undocumented
def handle_CHL(self, params): (source)
Undocumented
def handle_QRY(self, params): (source)
Undocumented
def handle_NLN(self, params): (source)
Undocumented
def handle_FLN(self, params): (source)
Undocumented
def handle_LST(self, params): (source)
Undocumented
def handle_BLP(self, params): (source)
Undocumented
def handle_GTC(self, params): (source)
Undocumented
def handle_SYN(self, params): (source)
Undocumented
def handle_LSG(self, params): (source)
Undocumented
def handle_PRP(self, params): (source)
Undocumented
def handle_BPR(self, params): (source)
Undocumented
def handle_ADG(self, params): (source)
Undocumented
def handle_RMG(self, params): (source)
Undocumented
def handle_REG(self, params): (source)
Undocumented
def handle_ADD(self, params): (source)
Undocumented
def handle_REM(self, params): (source)
Undocumented
def handle_REA(self, params): (source)
Undocumented
def handle_XFR(self, params): (source)
Undocumented
def handle_RNG(self, params): (source)
Undocumented
def handle_OUT(self, params): (source)
Undocumented
def loggedIn(self, userHandle, screenName, verified): (source)
Called when the client has logged in. The default behaviour of this method is to update the factory with our screenName and to sync the contact list (factory.contacts). When this is complete self.listSynchronized will be called.
ParametersuserHandleour userHandle
screenNameour screenName
verified1 if our passport has been (verified), 0 if not. (i'm not sure of the significace of this) (type: int)
def loginFailure(self, message): (source)
Called when the client fails to login.
Parametersmessagea message indicating the problem that was encountered
def gotProfile(self, message): (source)
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.
ParametersmessageThe profile message
def listSynchronized(self, *args): (source)
Lists are now synchronized by default upon logging in, this method is called after the synchronization has finished and the factory now has the up-to-date contacts.
def statusChanged(self, statusCode): (source)
Called when our status changes and it isn't in response to a client command. By default we will update the status attribute of the factory.
ParametersstatusCode3-letter status code
def gotContactStatus(self, statusCode, userHandle, screenName): (source)
Called after loggin in when the server sends status of online contacts. By default we will update the status attribute of the contact stored on the factory.
ParametersstatusCode3-letter status code
userHandlethe contact's user handle (passport)
screenNamethe contact's screen name
def contactStatusChanged(self, statusCode, userHandle, screenName): (source)
Called when we're notified that a contact's status has changed. By default we will update the status attribute of the contact stored on the factory.
ParametersstatusCode3-letter status code
userHandlethe contact's user handle (passport)
screenNamethe contact's screen name
def contactOffline(self, userHandle): (source)
Called when a contact goes offline. By default this method will update the status attribute of the contact stored on the factory.
ParametersuserHandlethe contact's user handle
def gotPhoneNumber(self, listVersion, userHandle, phoneType, number): (source)
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. By default we will update the list version for the factory's contact list and update the phone details for the specific user.
ParameterslistVersionthe new list version
userHandlethe contact's user handle (passport)
phoneTypethe specific phoneType (*_PHONE constants or HAS_PAGER)
numberthe value/phone number.
def userAddedMe(self, userHandle, screenName, listVersion): (source)
Called when a user adds me to their list. (ie. they have been added to the reverse list. By default this method will update the version of the factory's contact list -- that is, if the contact already exists it will update the associated lists attribute, otherwise it will create a new MSNContact object and store it.
ParametersuserHandlethe userHandle of the user
screenNamethe screen name of the user
listVersionthe new list version (type: int)
def userRemovedMe(self, userHandle, listVersion): (source)
Called when a user removes us from their contact list (they are no longer on our reverseContacts list. By default this method will update the version of the factory's contact list -- that is, the user will be removed from the reverse list and if they are no longer part of any lists they will be removed from the contact list entirely.
ParametersuserHandlethe contact's user handle (passport)
listVersionthe new list version
def gotSwitchboardInvitation(self, sessionID, host, port, key, userHandle, screenName): (source)
Called when we get an invitation to a switchboard server. This happens when a user requests a chat session with us.
ParameterssessionIDsession ID number, must be remembered for logging in
hostthe hostname of the switchboard server
portthe port to connect to
keyused for authorization when connecting
userHandlethe user handle of the person who invited us
screenNamethe screen name of the person who invited us
def multipleLogin(self): (source)
Called when the server says there has been another login under our account, the server should disconnect us right away.
def serverGoingDown(self): (source)
Called when the server has notified us that it is going down for maintenance.
def changeStatus(self, status): (source)
Change my current status. This method will add a default callback to the returned Deferred which will update the status attribute of the factory.
Parametersstatus3-letter status code (as defined by the STATUS_* constants)
ReturnsA 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.
def setPrivacyMode(self, privLevel): (source)
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.

ParametersprivLevelThis 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.
ReturnsA 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 'al' or 'bl' (the new privacy setting).
def syncList(self, version): (source)
Used for keeping an up-to-date contact list. A callback is added to the returned Deferred that updates the contact list on the factory and also sets my state to STATUS_ONLINE.

Note: This is called automatically upon signing in using the version attribute of factory.contacts, so you may want to persist this object accordingly. Because of this there is no real need to ever call this method directly.

ParametersversionThe current known list version
ReturnsA 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.
def setPhoneDetails(self, phoneType, value): (source)
Set/change my phone numbers stored on the server.
ParametersphoneTypephoneType 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.
valuefor 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).
ReturnsA 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).
def addListGroup(self, name): (source)
Used to create a new list group. A default callback is added to the returned Deferred which updates the contacts attribute of the factory.
ParametersnameThe desired name of the new group.
ReturnsA 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).
def remListGroup(self, groupID): (source)
Used to remove a list group. A default callback is added to the returned Deferred which updates the contacts attribute of the factory.
ParametersgroupIDthe ID of the desired group to be removed.
ReturnsA 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.
def renameListGroup(self, groupID, newName): (source)
Used to rename an existing list group. A default callback is added to the returned Deferred which updates the contacts attribute of the factory.
ParametersgroupIDthe ID of the desired group to rename.
newNamethe desired new name for the group.
ReturnsA 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).
def addContact(self, listType, userHandle, groupID=0): (source)
Used to add a contact to the desired list. A default callback is added to the returned Deferred which updates the contacts attribute of the factory with the new contact information. If you are adding a contact to the forward list and you want to associate this contact with multiple groups then you will need to call this method for each group you would like to add them to, changing the groupID parameter. The default callback will take care of updating the group information on the factory's contact list.
ParameterslistType(as defined by the *_LIST constants)
userHandlethe user handle (passport) of the contact that is being added
groupIDthe group ID for which to associate this contact with. (default 0 - default group). Groups are only valid for FORWARD_LIST.
ReturnsA 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)
def remContact(self, listType, userHandle, groupID=0): (source)
Used to remove a contact from the desired list. A default callback is added to the returned deferred which updates the contacts attribute of the factory to reflect the new contact information. If you are removing from the forward list then you will need to supply a groupID, if the contact is in more than one group then they will only be removed from this group and not the entire forward list, but if this is their only group they will be removed from the whole list.
ParameterslistType(as defined by the *_LIST constants)
userHandlethe user handle (passport) of the contact being removed
groupIDthe ID of the group to which this contact belongs (only relevant for FORWARD_LIST, default is 0)
ReturnsA 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)
def changeScreenName(self, newName): (source)
Used to change your current screen name. A default callback is added to the returned Deferred which updates the screenName attribute of the factory and also updates the contact list version.
ParametersnewNamethe new screen name
ReturnsA 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.
def requestSwitchboardServer(self): (source)
Used to request a switchboard server to use for conversations.
ReturnsA 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.
def logOut(self): (source)
Used to log out of the notification server. After running the method the server is expected to close the connection.
API Documentation for Twisted, generated by pydoctor at 2013-11-08 22:07:30.