MailNews Protocols

These are all implemented in C++, except for RSS. RSS is implemented in JS and doesn't follow the same pattern as the C++ protocols.

IMAP,POP3, and NNTP are "incoming" protocols, i.e., we retrieve messages from a server, and represent them as folders to the user. Those protocols all have the following, defined in the corresponding protocol subdirectory of mailnews (i.e., mailnews/imap, mailnews/local (for pop3), mailnews/news):

An incoming server class, which implements nsIMsgIncomingServer and inherits from mailnews/base/util/nsMsgIncomingServer, i.e.., nsPop3IncomingServer, nsImapIncomingServer, nsNNTPIncomingServer.

A folder class, which implements nsIMsgFolder, and inherits from nsMsgDBFolder. Most commands/operations go through the folder object. nsImapMailFolder, nsNewsFolder, nsLocalMailFolder (for POP3)

A service class, which generally sits between the folder object or the server object, and the protocol object. The service class creates and initializes the url object for the operation, and hands that off to a protocol object to run. The service classes usually have their own interface, but they also implement nsIMsgMessageService.

A url object. These implement nsIMsgMailNewsUrl, inherit from base/util/nsMsgMailNewsUrl, and implement their own protocol-specific interface (nsIImapUrl, nsINntpUrl, nsIPop3Url).

A protocol object that takes a url and handles the network communications with the actual server required to run that url. These implement nsIMsgProtocol, inherit from nsMsgProtocol, and implement their own protocol-specific interface (nsIImapProtocol, nsIPop3Protocol, nsINntpProtocol)

In addition, in mailnews/db/msgdb/public, we have protocol-specific msg db classes (and in the case of news, a nsINewsDatabase interface), so that we can use polymorphism when msg db operations need to be specialized for different kinds of folders.

The message search code also has protocol-specific code to handle searching on the server, or local mailbox. The search code also knows what the different search capabilities of the various protocols are.