Within offlineimap, the classes OfflineImap provides the high-level functionality. The rest of the classes should usually not needed to be touched by the user. Email repositories are represented by a offlineimap.repository.Base.BaseRepository or derivatives (see offlineimap.repository for details). A folder within a repository is represented by a offlineimap.folder.Base.BaseFolder or any derivative from offlineimap.folder.
This page contains the main API overview of OfflineImap 6.7.0.
OfflineImap can be imported as:
from offlineimap import OfflineImap
The main class that encapsulates the high level use of OfflineImap.
To invoke OfflineImap you would call it with:
oi = OfflineImap()
oi.run()
Signal handler: dump a stack trace for each existing thread.
Invoke the correct single/multithread syncing
self.config is supposed to have been correctly initialized already.
Executed if we do not want a separate syncmaster thread
Parameters: | accs – A list of accounts that should be synced |
---|
Parse the commandline and invoke everything
An accounts.Account connects two email repositories that are to be synced. It comes in two flavors, normal and syncable.
Represents an account (ie. 2 repositories) to sync.
Most of the time you will actually want to use the derived accounts.SyncableAccount which contains all functions used for syncing an account.
Parameters: |
|
---|
A syncable email account connecting 2 repositories.
Derives from accounts.Account but contains the additional functions syncrunner(), sync(), syncfolders(), used for syncing.
Contains the current offlineimap.ui, and can be used for logging etc.
Checks if an abort signal had been sent.
If the ‘skipsleep’ config option for this account had been set, with set_abort_event(config, 1) it will get cleared in this function. Ie, we will only skip one sleep and not all.
Returns: | True, if the main thread had called set_abort_event() earlier, otherwise ‘False’. |
---|
Return the corresponding local folder for a given remotefolder.
Retrieves string from the configuration.
Retrieves string from the configuration transforming the result.
Retrieves boolean value from the configuration.
Retrieves floating-point value from the configuration.
Retrieves integer value from the configuration.
Retrieves strings from the configuration and splits it into the list of strings.
Output diagnostics for all involved repositories.
Set skip sleep/abort event for all accounts.
If we want to skip a current (or the next) sleep, or if we want to abort an autorefresh loop, the main thread can use set_abort_event() to send the corresponding signal. Signum = 1 implies that we want all accounts to abort or skip the current or next sleep phase. Signum = 2 will end the autorefresh loop, ie all accounts will return after they finished a sync. signum=3 means, abort NOW, e.g. on SIGINT or SIGTERM.
This is a class method, it will send the signal to all accounts.
An Error during offlineimap synchronization
Parameters: |
|
---|
This exception inherits directly from Exception and is raised on errors during the offlineimap execution. It has an attribute severity that denotes the severity level of the error.
Severity level of an Exception
Module offlineimap.globals provides the read-only storage for the global variables.
All exported module attributes can be set manually, but this practice is highly discouraged and shouldn’t be used. However, attributes of all stored variables can only be read, write access to them is denied.
Currently, we have only options attribute that holds command-line options as returned by OptionParser. The value of options must be set by set_options() prior to its first use.
You can access the values of stored options using the usual syntax, offlineimap.globals.options.<option-name>