This began as one of the example programs for the Antikythera class library ArchiveMailBox; but it was decided to refactor its code and create a more fully featured application. To this end the code was separated out into 4 namespaces
- Pendulum – Main program control logic.
- Pendulum_ProcCmdLine – Command line option processing.
- Pendulum_File – All file related functionality.
- Pendulum_MailBox – IMAP Server and mailbox code.
Pendulum: control flow logic that connects to a server and selects all specified mailboxes sequentially and searches for either all messages or all new message from a given UID. From this a vector of message UID(s) are returned and the message bodies for each UID are then downloaded and written to an .EML file (archived).
Pendulum_ProcCmdLine: command line processing code that uses the BOOST program options library to translate any options passed on the command line into a structure that is then used to drive the program.
Pendulum_File: EML file creation and archive directory scan code. Each archive EML file created has as part of its filename the e-mails UID. Before new e-mails for a mailbox are searched for the highest UID for an archived e-mail is found an this used as the basis of a search (i.e. new e-mail searched for).
Pendulum_MailBox: IMAP server connection and mailbox handling. It is possible whilst communicating with the server for the connection to fail; instead of just failing a reconnect is tried and any current command is repeated.
The current version of Pendulum can be found here and it is very much a work in progress.
Possible changes in future.
- Addition of mailbox ignore list for use with –all so that for instance Deleted/Junk/Spam mailboxes are not archived.
- The ability to work with multiple servers
- Use of threads.
- QT based UI (Know nothing of Qt but it looks like the best choice for a portable/flexible way to provide a cross platform user interface).