t.w.p.msn : module documentation

Part of twisted.words.protocols View Source

MSNP8 Protocol (client only) - semi-experimental

This module provides support for clients using the MSN Protocol (MSNP8). There are basically 3 servers involved in any MSN session:

Dispatch server

The DispatchClient class handles connections to the dispatch server, which basically delegates users to a suitable notification server.

You will want to subclass this and handle the gotNotificationReferral method appropriately.

Notification Server

The NotificationClient class handles connections to the notification server, which acts as a session server (state updates, message negotiation etc...)

Switcboard Server

The SwitchboardClient handles connections to switchboard servers which are used to conduct conversations with other users.

There are also two classes (FileSend and FileReceive) used for file transfers.

Clients handle events in two ways.

Most client request callbacks require more than one argument, and since Deferreds can only pass the callback one result, most of the time the callback argument will be a tuple of values (documented in the respective request method). To make reading/writing code easier, callbacks can be defined in a number of ways to handle this 'cleanly'. One way would be to define methods like: def callBack(self, (arg1, arg2, arg)): ... another way would be to do something like: d.addCallback(lambda result: myCallback(*result)).

If the server sends an error response to a client request, the errback of the corresponding Deferred will be called, the argument being the corresponding error code.

NOTE: Due to the lack of an official spec for MSNP8, extra checking than may be deemed necessary often takes place considering the server is never 'wrong'. Thus, if gotBadLine (in any of the 3 main clients) is called, or an MSNProtocolError is raised, it's probably a good idea to submit a bug report. ;) Use of this module requires that PyOpenSSL is installed.

TODO

AuthorSam Jordan
Function checkParamLen Undocumented
Class PassportNexus Used to obtain the URL of a valid passport login HTTPS server.
Class PassportLogin This class is used internally to obtain a login ticket from a passport HTTPS server -- it should not be used directly.
Class MSNProtocolError No summary
Class MSNCommandFailed The server said that the command failed.
Class MSNMessage I am the class used to represent an 'instant' message.
Class MSNContact This class represents a contact (user).
Class MSNContactList This class represents a basic MSN contact list.
Class MSNEventBase This class provides support for handling / dispatching events and is the base class of the three main client protocols (DispatchClient, NotificationClient, SwitchboardClient)
Class DispatchClient This class provides support for clients connecting to the dispatch server @ivar userHandle: your user handle (passport) needed before connecting.
Class NotificationClient This class provides support for clients connecting to the notification server.
Class NotificationFactory No summary
Class SwitchboardClient This class provides support for clients connecting to a switchboard server.
Class FileReceive This class provides support for receiving files from contacts.
Class FileSend This class provides support for sending files to other contacts.
Function _parseHeader No summary
Function _parsePrimitiveHost Undocumented
Function _login This function is used internally and should not ever be called directly.
def checkParamLen(num, expected, cmd, error=None): (source)
Undocumented
def _parseHeader(h, v): (source)
Split a certin number of known header values with the format: field1=val,field2=val,field3=val into a dict mapping fields to values.
Parametershthe header's key
vthe header's value as a string
def _parsePrimitiveHost(host): (source)
Undocumented
def _login(userHandle, passwd, nexusServer, cached=0, authData=''): (source)
This function is used internally and should not ever be called directly.
API Documentation for Twisted, generated by pydoctor at 2011-10-27 16:17:34.