Avoid copying array every time, just slice it

Suggested-by: Josh Berry
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Create SQLite DB directory if it doesn't exist yet

Also check if DB path doesn't point to a directory.

By: Nick Farrell
GitHub: https://github.com/OfflineIMAP/offlineimap/pull/102
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Properly manipulate contents of messagelist for folder

Create initializer function that puts default values to all fields
of message list item.  Fix all code that directly assigns some hash
to the elements of messagelist: for direct assignments only initializer
is now permitted, all other modification are done in-place.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Fix label processing in GmailMaildir

Commit 7df765cfdb4096a33f35bf709db6820a6c2c79fd introduced regression:
GmailMaildir caches labels in its own function and it was testing the
presence of the 'labels' key in message descriptor.  But 7df765cf
changed descriptor initialization and this key is always present.

So now we have 'labels_cached' flag that tells us if labels were
already cached or not.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Add support for OS-specific CA bundle locations

GitHub pull: #19
Suggested-by: Michael Vogt <mvo@ubuntu.com>
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Add the OpenSSL exception

The GNU GPL and the OpenSSL license are incompatible. Some distributions
take a hardline stance and do not consider OpenSSL to be a systems library
(which would permit the usage/distribution of OpenSSL) when distributing
apps such as OfflineImap from the same repository. In order to solve these
distributions dilemma, we add the OpenSSL exception to our GNU GPL v2+ license.
This allows for unambiguous use/distribution of our GNU GPL'ed application
with a python linking to openssl.

Consent of all contributors has been requested via email by
Sebastian@SSpaeth.de. With very few exceptions of minor contributions (which
might or might not by copyright-worthy) all past contributors have consented
to adding the OpenSSL exception. None of the replying authors has disagreed
with adding the exception.

The corresponding issues at question:
 https://github.com/OfflineIMAP/offlineimap/issues/104
 Debian bug #747033

We are still missing consent from:
1	Asheesh Laroia
2	Bart Kerkvliet
4	Daniel Burrows
5	David Favro
1	David Logie
1	Eric Dorland
1	Ethan Schoonover
49	Eygene Ryabinkin
1	Loui Chang
1	Luca Capello
1	Michael Witten
2	Mike Dawson
1	Peter Colberg
1	Scott Henson
1	Tom Lawton
1	W. Trevor King
2	X-Ryl669
1	buergi
2	dtk
5	mj

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Merge pull request #115 from spaetz/opensslexception

Add the OpenSSL exception
Properly capitalize OpenSSL

And I am also not against this change in licensing.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Fix warning processing for MachineUI

Old code were trying to pass the message to be output as-is,
but it should really be passed as the 'mesg' key in order to
be properly processed by MAchineLogFormatter.format().

GitHub pull: https://github.com/OfflineIMAP/offlineimap/pull/64
GitHub pull: https://github.com/OfflineIMAP/offlineimap/pull/118
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Announce addition of OpenSSL license exception in ChangeLog

Someone is probably picky about licensing, so allow them to
discover the recent change (provided that they read change logs).

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Add OpenBSD default CA certificates file location

GitHub pull: https://github.com/OfflineIMAP/offlineimap/pull/120
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Add default CA bundle location for DragonFlyBSD

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Brought CustomConfig.py into more proper shape

 - Multi-line documentation for functions and methods
   now has ending triple-double-quotes on an own line,
   as per PEP 257.

 - Added documentation and comments to almost all functions
   and methods.

 - Added stub implementations for getconfig() and getsection()
   inside CustomConfig.ConfigHelperMixin to provide sane
   run-time diagnostics for classes that doesn't implement them.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Update imaplib2 to 2.37

The only fix is
 - add missing idle_lock in _handler().

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Imaplib2: trade backticks to repr()

Backticks are gone in Python 3.x.

GitHub issue: https://github.com/OfflineIMAP/offlineimap/issues/121
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Introduce CustomConfig method that applies set of transforms

It is a bit cleaner than making chains of calls like
{{{
value = os.path.expanduser(value)
value = os.path.abspath(value)
}}}
since we do see all transformations to be applied in a single
iterable and have no repeated code like in the above example.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Enable tilde and environment variable expansion on some items

Expand environment variables in the following configuration items:
- general.pythonfile;
- general.metadata;
- mbnames.filename;
- Repository.localfolders.
- Repository.sslcacertfile.

Make tilde and environment variable expansion in the following
configuration items:
- Repository.sslclientcert;
- Repository.sslclientkey.

GitHub pull request: https://github.com/OfflineIMAP/offlineimap/pull/113
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Properly generate package via "sdist"

Include tests, configuration examples and other stuff we usually
include to the tarballs.

GitHub issue: https://github.com/OfflineIMAP/offlineimap/issues/137
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Fix typo in apply_xforms invocation

Fixes a bug introduced in e51ed80ecc1830ca3184761ccbfa63cf22cc2d42
since apply_xform (without the 's') doesn't exist.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>