Name Description Size 949
nsAutoSyncManager.cpp 50K 43879
nsAutoSyncManager.h Auto-Sync Background: it works only with offline imap folders. "autosync_offline_stores" pref enables/disables auto-sync mechanism. Note that setting "autosync_offline_stores" to false, or setting folder to not-offline doesn't stop synchronization process for already queued folders. Auto-Sync policy: o It kicks in during system idle time, and tries to download as much messages as possible based on given folder and message prioritization strategies/rules. Default folder prioritization strategy dictates to sort the folders based on the following order: INBOX > DRAFTS > SUBFOLDERS > TRASH. Similarly, default message prioritization strategy dictates to download the most recent and smallest message first. Also, by sorting the messages by size in the queue, it tries to maximize the number of messages downloaded. o It downloads the messages in groups. Default groups size is defined by |kDefaultGroupSize|. o It downloads the messages larger than the group size one-by-one. o If new messages arrive when not idle, it downloads the messages that do fit into |kFirstGroupSizeLimit| size limit immediately, without waiting for idle time, unless there is a sibling (a folder owned by the same imap server) in stDownloadInProgress state in the q o If new messages arrive when idle, it downloads all the messages without any restriction. o If new messages arrive into a folder while auto-sync is downloading other messages of the same folder, it simply puts the new messages into the folder's download queue, and re-prioritize the messages. That behavior makes sure that the high priority (defined by the message strategy) get downloaded first always. o If new messages arrive into a folder while auto-sync is downloading messages of a lower priority folder, auto-sync switches the folders in the queue and starts downloading the messages of the higher priority folder next time it downloads a message group. o Currently there is no way to stop/pause/cancel a message download. The smallest granularity is the message group size. o Auto-Sync manager periodically (kAutoSyncFreq) checks folder for existing messages w/o bodies. It persists the last time the folder is checked in the local database of the folder. We call this process 'Discovery'. This process is asynchronous and processes |kNumberOfHeadersToProcess| number of headers at each cycle. Since it works on local data, it doesn't consume lots of system resources, it does its job fast. o Discovery is necessary especially when the user makes a transition from not-offline to offline mode. o Update frequency is defined by nsMsgIncomingServer::BiffMinutes. Error Handling: o if the user moves/deletes/filters all messages of a folder already queued, auto-sync deals with that situation by skipping the folder in question, and continuing with the next in chain. o If the message size is zero, auto-sync ignores the message. o If the download of the message group fails for some reason, auto-sync tries to download the same group |kGroupRetryCount| times. If it still fails, continues with the next group of messages. Download Model: Parallel model should be used with the imap servers that do not have any "max number of sessions per IP" limit, and when the bandwidth is significantly large. How it really works: The AutoSyncManager gets an idle notification. First it processes any folders in the discovery queue (which means it schedules message download for any messages it previously determined it should download). Then it sets a timer, and in the timer callback, it processes the update q, by calling InitiateAutoSync on the first folder in the update q. 11775
nsAutoSyncState.cpp @return True if the elements are equals; false otherwise. 22632
nsAutoSyncState.h An adaptor class to make msg strategy nsTArray.Sort() compatible. 3093
nsImapBodyShell.cpp Create a nsImapBodyShell from a full BODYSTRUCUTRE response from the parser. The body shell represents a single, top-level object, the message. The message body might be treated as either a container or a leaf (just like any arbitrary part). Steps for creating a part: 1. Pull out the paren grouping for the part 2. Create a generic part object with that buffer 3. The factory will return either a leaf or container, depending on what it really is. 4. It is responsible for parsing its children, if there are any 41247
nsImapBodyShell.h nsImapBodyShell and associated classes 16203
nsImapCore.h imap message flags 9208
nsImapFlagAndUidState.cpp amount to expand for imap entry flags when we need more 9782
nsImapFlagAndUidState.h 1825
nsImapGenericParser.cpp 14513
nsImapGenericParser.h nsImapGenericParser is the base parser class used by the server parser and body shell parser 2380
nsImapHostSessionList.cpp "accessing-hostlist-monitor" 23979
nsImapHostSessionList.h 8066
nsImapIncomingServer.cpp 104097
nsImapIncomingServer.h get some implementation from nsMsgIncomingServer 6702
nsImapMailFolder.cpp Copies the contents of srcDir into destDir. destDir will be created if it doesn't exist. 337505
nsImapMailFolder.h 26565
nsImapNamespace.cpp 17457
nsImapNamespace.h 3624
nsImapOfflineSync.cpp Leaves m_currentServer at the next imap or local mail "server" that might have offline events to playback, and m_folderQueue holding a (reversed) list of all the folders to consider for that server. If no more servers, m_currentServer will be left at nullptr and the function returns false. 43970
nsImapOfflineSync.h 3484
nsImapProtocol.cpp 391933
nsImapProtocol.h 33990
nsImapSearchResults.cpp 2168
nsImapSearchResults.h 1145
nsImapServerResponseParser.cpp 113795
nsImapServerResponseParser.h 10620
nsImapService.cpp 121421
nsImapService.h nsImapService implements the IMAP protocol. So, whenever someone opens an "imap://" url, the resultant nsIChannel is created here (via newChannel()). It also provides a bunch of methods to provide more egonomic ways to initiate IMAP operations, rather than manually composing an "imap://..." URL. See nsIImapService for these. 5139
nsImapStringBundle.cpp 1371
nsImapStringBundle.h _nsImapStringBundle_H__ 506
nsImapUndoTxn.cpp 24577
nsImapUndoTxn.h 3032
nsImapUrl.cpp 48021
nsImapUrl.h nsImapUrl_h___ 4778
nsImapUtils.cpp parses ImapMessageURI 11511
nsImapUtils.h 2534
nsSyncRunnableHelpers.cpp 22709
nsSyncRunnableHelpers.h 4106