Thunderbird development requires understanding a bunch of concepts. Luckily, you may only need to learn a few depending on the specific tasks that you're trying to accomplish with your extension.
Thunderbird users configure usually several Accounts. There are accounts for incoming messages (POP, IMAP, News,etc.), and accounts for outgoing messages (SMTP). (News accounts also do sending). Accounts are also called Servers in much of the code.
Things you can do with accounts:
- iterate over all known accounts [link to sample code]
- introspect the details of particular accounts (names, parameters, etc.) [link to sample code]
- iterate over the folders in an account [ sample code]
Servers contain folders. Folders contain either folders or messages. Folders are a key data structure in Thundebird, and much of the user interface reflects this -- selecting a folder displays the messages in that folder, very fast. This speed is possible by having a specialized database per folder. (see nsIMsgDbFolder). These databases stores information about the "header" of the messages, so lists of messages in folders can be sorted/displayed very fast, even if the messages themselves are large. These headers are nsIMsgDbHdr objects. There is a separate database per folder called the off-line cache [link to some IDL], which stores the complete messages (including headers, bodies and attachments) that have already been downloaded from the server.
Things you can do with folders (nsIMsgFolder):
- iterate over all messages in a folder
Things you can do with nsIMsgHdrs:
Thunderbird's main address book management functions are built on a few key concepts:
- a Contact is an entry corresponding to a person or equivalent, including email address, phone number, etc.
- a List is a set of email addresses, which can be referred to with a single nickname, so that e.g. you can send N people the same email.
- an Address Book is a collection of contacts and lists. Thunderbird by default creates two -- a personal address book, which is completely up to the user's control, and a Collected address book, where Thunderbird stores addresses of people you reply to (CHECK). On the mac, there's also a Mac OS X address book, which lets you read the system address book (but not write). If the user configures an LDAP server, that will also result in another address book, although it's one that you can search, but not
Global database: moving beyond per-folder databases
The folder-centric structure described above is great for many things, but it makes it hard to do manipulations on sets of messages that span different folders (multiple folder databases need to be open and kept in memory at the same time, indices can't be maintained efficiently, etc). To deal with this, we've built a new system in TB3 called Gloda, which is layered on top of the folder databases, but provides new capabilities, such as ...
Gloda defines a few concepts which are: GlodaMessage, GlodaCollection, GlodaContact, GlodaIdentity, etc.
[i'll skip gloda details for now cause asuth can write that well]
[hopefully just point to firefox stuff mostly?]
What happens to a message when it's being received
What happens to a message when it's being sent