Commit Graph

1197 Commits

Author SHA1 Message Date
Nicolas Sebrecht
7b2fbeee74 repository: GmailMaildir: fix copyright
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-14 18:01:05 +01:00
Nicolas Sebrecht
ab3423d039 localeval: avoid redefining 'file' keyword
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-14 17:18:48 +01:00
Nicolas Sebrecht
41fa3ae4fc more style consistency
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-13 18:16:25 +01:00
Eygene Ryabinkin
6fc9c36014 Fix regression introduced in 0f40ca4799
We have no variable "fullname", it must have been slipped in
unintentionally.

Blame commit:
	0f40ca4799 more style consistency

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-12 19:55:05 +01:00
Wieland Hoffmann
d08f6d15c2 addmessageheader: Add a note about the incorrect rendering of the docstring
The note tells people to look at the source of the method, which
spinx.ext.viewcode conveniently links right next to the methods
signature.

Signed-off-by: Wieland Hoffmann <themineo@gmail.com>
2015-01-12 17:17:42 +01:00
Giovanni Mascellani
29e9b7ab39 Drop caches after having processed folders.
This enhances a lot memory consumption when you have many folders
to process.

Signed-off-by: Giovanni Mascellani <mascellani@poisson.phc.unipi.it>
2015-01-12 17:17:42 +01:00
Nicolas Sebrecht
63e499c6f2 more consistent style
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-12 17:17:42 +01:00
Nicolas Sebrecht
a44718130d minor: add comments
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-12 17:17:42 +01:00
Nicolas Sebrecht
c2b8a99fa2 repository: IMAP.py: do not redefine string
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-12 17:17:42 +01:00
Nicolas Sebrecht
14de280585 repository: Base: add comment about lying variable name self.uiddir
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-12 17:17:42 +01:00
Eygene Ryabinkin
e7fabf9e57 Properly re-raise exception to save original tracebacks
We usually mutate some exceptions to OfflineImapError() and it is
a whole lot better if such exception will show up with the original
traceback, so all valid occurrences of such mutations were transformed
to the 3-tuple form of "raise".  Had also added coding guidelines
document where this re-raise strategy is documented.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2015-01-12 17:51:21 +03:00
Nicolas Sebrecht
8c6abc413e ui: Machine: remove offending param for a _printData() call
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-10 12:36:18 +01:00
Nicolas Sebrecht
f2010cdfb0 Machine.py; more consistent style
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-10 12:36:18 +01:00
Stefan Huber
561a3d4329 Do not keep reloading pyhtonfile, make it stateful
CustomConfigParser.getlocaleval() loads "pythonfile" at each call.
Besides unnecessary IO, in case that dynamic_folderfilter is true, the
code in "pythonfile" would behave stateless, since it is re-initialized
at each call of getlocaleval(), i.e., at every sync. Fix that by keeping
a singleton copy of localeval in CustomConfigParser after the first call
of getlocaleval().

Signed-off-by: Stefan Huber <shuber@sthu.org>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-10 12:36:18 +01:00
Wieland Hoffmann
4bc766035c error: Log the messages with level ERROR
Otherwise, messages logged through UIBase.error would only be passed to
UIBase._msg, which only logs at INFO. This causes error to not get
logged at all for the quit UI.

Signed-off-by: Wieland Hoffmann <themineo@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-10 12:36:18 +01:00
Wieland Hoffmann
2f9d8d22ee folder/Base.py: fix comment: para -> param
Signed-off-by: Wieland Hoffmann <themineo@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-09 01:10:49 +01:00
Nicolas Sebrecht
0f40ca4799 more style consistency
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-08 23:36:19 +01:00
Nicolas Sebrecht
594a286888 repository/Maildir.py: use f variable instead of folder
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-08 23:36:18 +01:00
Nicolas Sebrecht
0dc45e421b init.py: avoid redefining "type" builtin
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-08 23:36:18 +01:00
Nicolas Sebrecht
11619faf7c imaputil.py: avoid to redefine "string"
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-08 23:36:18 +01:00
Nicolas Sebrecht
1339cc8913 emailutil.py: remove unused import time
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-08 23:36:18 +01:00
Nicolas Sebrecht
eab3e18613 remove garbage about unicode
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-08 12:07:29 +01:00
Nicolas Sebrecht
dbb632275e v6.5.7-rc1
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-07 22:20:14 +01:00
Nicolas Sebrecht
61021260cb more consistent style
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-07 21:31:43 +01:00
Nicolas Sebrecht
11a28fb0cb ui/UIBase: folderlist(): avoid built-in list() redefinition
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-05 13:15:26 +01:00
Nicolas Sebrecht
a35c432671 utils/const.py: fix ident
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-01 22:24:23 +01:00
Nicolas Sebrecht
4589cfeff2 localeval: comment on security issues
Minor syntax fixes.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-01 22:24:23 +01:00
Nicolas Sebrecht
e613f6992d ui/UIBase.py: remove unused import
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-01 22:24:23 +01:00
Nicolas Sebrecht
7b453efcce ui/Curses.py: remove unused import
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-01 22:24:23 +01:00
Nicolas Sebrecht
24a4ab3e16 repository/LocalStatus.py: remove unused import
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-01 22:24:23 +01:00
Nicolas Sebrecht
7f1419a40a repository/GmailMaildir.py: remove unused import
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-01 22:24:22 +01:00
Nicolas Sebrecht
62afde1825 repository/Base.py: remove unused import
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-01 22:24:22 +01:00
Nicolas Sebrecht
2785e779e2 init.py: remove unused import
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-01 22:24:22 +01:00
Nicolas Sebrecht
de5f22a23a CustomConfig.py: remove unused imports
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-01 22:24:22 +01:00
Nicolas Sebrecht
54cff7f786 imaplibutil.py: remove unused imports
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-01 22:23:35 +01:00
Nicolas Sebrecht
9b2c275561 Merge pull request #136 from aroig/gh/label-fix
Fix issue with multiple instances of gmail labels header
2014-12-23 03:30:36 +01:00
Keith Smiley
0521aa2706 Fix typo in apply_xforms invocation
Fixes a bug introduced in e51ed80ecc
since apply_xform (without the 's') doesn't exist.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-11-27 17:50:51 +03:00
Abdo Roig-Maranges
e70607e3e3 Warn about a tricky piece of code in addmessageheader
As requested by Nicholas Sebrecht.

Signed-off-by: Abdo Roig-Maranges <abdo.roig@gmail.com>
2014-11-20 14:18:35 +01:00
Abdo Roig-Maranges
2a5ef8c2ef Delete gmail labels header before adding a new one
This fixes a bug in which a message ended up with multiple gmail labels
header (X-Keywords or so). Fix fix it by removing all labels headers
before adding the updated one.

Signed-off-by: Abdo Roig-Maranges <abdo.roig@gmail.com>
2014-11-20 14:16:48 +01:00
Abdo Roig-Maranges
fc4c7549d6 Do not ignore gmail labels if header appears multiple times
There should be just one header storing gmail labels, but due to a bug,
multiple X-Keywords (or equivalent) headers may be found on the local
messages.

Now we, when extracting the labels from a message, we read all label
headers, instead of just the first one.

This has the consequence that some old labels stored locally in a second
X-Keywords (or third...) header, which effectively was rendered
invisible to offlineimap until now, may pop back up again and be pushed
to gmail. No labels will be removed by the changes in this commit,
though.

Signed-off-by: Abdo Roig-Maranges <abdo.roig@gmail.com>
2014-11-20 14:15:59 +01:00
Eygene Ryabinkin
e51ed80ecc 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>
2014-11-12 09:40:12 +03:00
Eygene Ryabinkin
8f3c22e227 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>
2014-11-02 11:53:05 +03:00
Eygene Ryabinkin
dbf683ed38 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>
2014-11-02 10:35:43 +03:00
Eygene Ryabinkin
af464c1b56 Update imaplib2 to 2.37
The only fix is
 - add missing idle_lock in _handler().

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-11-02 10:35:34 +03:00
Eygene Ryabinkin
a1bf8db517 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>
2014-10-09 19:24:11 +04:00
Eygene Ryabinkin
0a569bea3d Add default CA bundle location for DragonFlyBSD
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-10-08 10:39:43 +04:00
nopjmp
716a6f4718 Add OpenBSD default CA certificates file location
GitHub pull: https://github.com/OfflineIMAP/offlineimap/pull/120
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-10-08 09:03:02 +04:00
Eygene Ryabinkin
0aa44c5df4 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>
2014-10-05 11:34:23 +04:00
Eygene Ryabinkin
31d06d1ccb Properly capitalize OpenSSL
And I am also not against this change in licensing.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-10-05 11:33:22 +04:00
Sebastian Spaeth
5cacda68ac 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>
2014-10-02 11:34:44 +02:00
Eygene Ryabinkin
818486283e 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>
2014-09-22 09:52:57 +04:00
Eygene Ryabinkin
aef88cc1f8 Fix label processing in GmailMaildir
Commit 7df765cfdb 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>
2014-08-22 17:43:36 +04:00
Eygene Ryabinkin
7df765cfdb 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>
2014-08-03 16:47:26 +04:00
Eygene Ryabinkin
73e2c95acd 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>
2014-08-02 22:25:33 +04:00
Eygene Ryabinkin
aa55b38e26 Avoid copying array every time, just slice it
Suggested-by: Josh Berry
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-07-10 10:25:34 +04:00
Eygene Ryabinkin
1f2e8af8aa Trade recursion by plain old cycle
We can do a simpler and more stack-friendly hack for IMAP
servers with limited line lenghts.

Reported-by: Josh Berry, https://github.com/josh-berry
GH: https://github.com/OfflineIMAP/offlineimap/pull/100
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-07-08 12:23:05 +04:00
Eygene Ryabinkin
ffd1b1d691 IMAP: provide message-id in error messages
This is handy for debug purposes when one tries to locate exact
message that was e.g. rejected by server.

Feature-request: http://comments.gmane.org/gmane.mail.imap.offlineimap.general/6491
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-07-01 07:44:18 +04:00
Eygene Ryabinkin
863113efa3 Match header names case-insensitively
http://tools.ietf.org/html/rfc5234#section-2.3 says that ABNF strings
are case-insensitive.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-06-30 16:41:17 +04:00
Adam Spiers
807f3da880 addmessageheader(): add debug for header insertion
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-06-24 23:36:48 +04:00
Adam Spiers
37f74d859a addmessageheader: fix case #2 and flesh out docstring
The example illustrations were slightly cryptic;
modify them to be more obvious.

Fix case #2 (message starts with two line breaks)
where additional line break was shown and coded.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-06-24 23:25:45 +04:00
Adam Spiers
afead6c48e Rename addmessageheader()'s crlf parameter to linebreak
The parameter's value is a string representing the linebreak,
and can sometimes contain just '\n', in which case naming it
crlf is slightly misleading.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-06-24 23:12:06 +04:00
Eygene Ryabinkin
968ffc20bd More clearly show results of folder name translation
For cases like
  http://article.gmane.org/gmane.mail.imap.offlineimap.general/6468
it is beneficial to see that folder name was translated and the result
of this translation on a single line: having log like
{{{
Folder Boring/Wreck [acc: tmarble@info9.net]:
 Syncing Boring/Breck: Gmail -> Maildir
}}}
with translated name on the "Folder" line and original one on the
"Syncing" line isn't very intuitive.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-06-24 18:48:58 +04:00
Eygene Ryabinkin
c92c4e56a0 Add version qualifier to differentiate releases and development ones
It is always good to see which version we're talking about, so I had
added explicit marker for -devel, -release, -rcX and other states of
the OfflineIMAP.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-06-01 22:39:10 +04:00
Eygene Ryabinkin
e8db1217d4 Fix improper header separator for X-OfflineIMAP header
For servers without UIDPLUS we are inserting additional header
just after transformation '\n' -> CRLF was done.  addmessageheaders()
was written to work with just '\n' as the separator, so X-OfflineIMAP
header wasn't preceeded by the CRLF, but just by '\n'.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-06-01 22:12:26 +04:00
Eygene Ryabinkin
1746676af8 Make IDLE mode to work again
Refactoring in commit 6cbd2498 touched wrong class's "idle" call.

Found-by: Tomasz Żok <tomasz.zok@gmail.com>
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-23 13:19:11 +04:00
Eygene Ryabinkin
0005bcb2f0 Make IDLE mode to work again
Refactoring in commit 6cbd2498 touched wrong class's "idle" call.

Found-by: Tomasz Żok <tomasz.zok@gmail.com>
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-23 10:24:55 +04:00
Eygene Ryabinkin
d2ec2a4e9e Extend handling of cert_fingerprint
Add ability to specify multiple fingerprints.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-11 22:45:34 +04:00
Abdo Roig-Maranges
1690e5f74e Copymessageto should not be private since we override it
private methods prevent them from being overriden on derived classes. In
GmailFolder we need to override copymessageto, so it can't be private.

Before this commit, copymessageto was made private in Base but not in
GmailFolder. The end result was that labels were not set when copying
the message content, and always needed to be set on the label copying
pass.

Pointyhat-to: Eygene Ryabinkin
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-11 22:44:57 +04:00
Abdo Roig-Maranges
8c43e52173 Fix multiple typos in var, function and exception names
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-07 18:29:47 +04:00
Abdo Roig-Maranges
8dd6f7893c Add import for OfflineImapError
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-07 18:29:47 +04:00
Abdo Roig-Maranges
8b4f86be67 Class LocalStatusFolder: remove duplicate cachemessagelist()
Remained from GMail label sync merge.

Pointyhat-to: Eygene Ryabinkin
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-07 18:29:47 +04:00
Abdo Roig-Maranges
b982549e4d Class LocalStatusRepository: add missing self qualifier
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-07 18:29:47 +04:00
Abdo Roig-Maranges
96c9cca83a Class IMAPServer: idle() is private now
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-07 18:29:47 +04:00
Abdo Roig-Maranges
1300f2289b deletemessageheaders(): use passed list of headers to remove
... and not self.filterheaders.  With the current code this change
is no-op (since self.filterheaders is always passed as header_list),
but it is a bug in general.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-07 18:29:47 +04:00
Eygene Ryabinkin
5150de5514 Add support for XDG Base Directory Specification
$XDG_CONFIG_HOME/offlineimap/config will now be tried before
the canonical ~/.offlineimaprc.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-07 00:40:59 +04:00
Eygene Ryabinkin
d96af192ed Move space to the end of string
... to be aligned with the rest of the code.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-07 00:07:56 +04:00
Ben Boeckel
7c271d5131 Imapserver: add missing space to the log message
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-07 00:04:44 +04:00
Abdo Roig-Maranges
1b954c3b4c Add ability to migrate status data across backends
If when we request a LocalStatus folder, the folder has to be created,
we look whether the other backend has data, and if it does we migrate
it to the new backend.

The old backend data is left untouched, so that if you change back say
from sqlite to plaintext, the older data is still there.  That should
not lead to data loss, only a slower sync while the status folder gets
updated.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-06 23:37:11 +04:00
Abdo Roig-Maranges
214137eb7b Improvements to the SQlite-based local status folder
* Do not inherit LocalStatusSQLiteFolder class from the plaintext
    one.

  * Use some functions already in BaseFolder in both, plaintext and
    sqlite classes.

  * Add a saveall method. The idea is that saveall dumps the entire
    messagelist to disk, while save only commits the uncommited
    changes. Right now, save is noop for sqlite, and equivalent to
    saveall for plaintext, but it enables to be more clever on when we
    commit to disk in the future.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-06 23:37:11 +04:00
Abdo Roig-Maranges
09556d645e Adapt plain status folder to gmail labels stuff
* Implements Status Folder format v2, with a mechanism to upgrade an
    old statusfolder.

  * Do not warn about Gmail and GmailMaildir needing sqlite backend
    anymore.

  * Clean repository.LocalStatus reusing some code from
    folder.LocalStatus.

  * Change field separator in the plaintext file from ':' to '|'. Now
    the local status stores gmail labels. If they contain field
    separator character (formerly ':'), they get messed up. The new
    character '|' is less likely to appear in a label.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-06 23:37:11 +04:00
Abdó Roig-Maranges
789e047734 Extend handling of GMail labels header
Format headers X-Label and Keywords as a space separated list and all
other ones as comma-separated entities.  This makes OfflineIMAP label
handling to be compatible with some user agents that recognise these
headers.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-06 23:37:03 +04:00
Abdó Roig-Maranges
0e4afa9132 Make GmailFolder sync GMail labels
When synclabels config flag is set to "yes" for the GMail repo,
offlineimap fetches the message labels along with the messages, and
embeds them into the body under the header X-Keywords (or whatever
'labelsheader' was set to), as a comma separated list.

It also adds an extra pass to savemessageto, that performs label
synchronization on existing messages from GMail to local, the same way
it is done with flags.

We also introduce GmailMaildir repository that adds functionality to
change message labels.  It keeps track of messages modification time,
so one can quickly detect when the labels may have changed.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-06 23:36:06 +04:00
Abdó Roig-Maranges
9319ae212b Restructured folder/IMAP code
In preparation for GMail label sync, we had split our some functionality
that will be needed further into their own functions.  This also permitted
the code to look more compact and concise.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-06 23:03:21 +04:00
Abdó Roig-Maranges
5391476dfb Add ability to trim some local mail headers
When filterheaders is set to a comma-separated list of headers,
OfflineIMAP removes those headers from messages before uploading them
to the server.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-03 14:45:28 +04:00
Eygene Ryabinkin
844ca6b08c Don't embed CRLF multiple times when saving a message
Since we just do multiple passes for saving the message without
actually modifying its content (apart from header insertion that
is CRLF-clean), we can change line ends to the proper CRLF just
once.

And we can also get message's date only once too.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-03 14:43:11 +04:00
Abdó Roig-Maranges
0903428fda Enable compressed connections to the IMAP server
Added the configuration setting usecompression for the IMAP repositories.
When enabled, the data from and to the IMAP server is compressed.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-02 19:30:49 +04:00
Abdó Roig-Maranges
0c4fe6bada Bugfix: make change_message_uid to update messagelist's filename
This broke code that relied on the filename being up to date in memory
after messages are copied.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-02 19:28:28 +04:00
Abdó Roig-Maranges
697ca8a229 Changed NotImplementedException to NotImplementedError
It seems NotImplementedException does not exist. It must be a relic
from old Python...

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-05-02 19:23:01 +04:00
Eygene Ryabinkin
6cbd2498ae Refactoring: make functions to be private if we can
Make external API of class/module to be smaller, explicitely mark
all internal functions.  Also annotate methods that are implemented
as the part of the parent class interface.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-04-30 19:35:56 +04:00
Stefan Huber
af2d6dc5e1 Fix: Undefined variable 'this' should be 'self'
Pointyhat-to: Eygene Ryabinkin
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-03-06 10:48:34 +04:00
Eygene Ryabinkin
829c9cf4be Introduce dynamic filtering for repository folders
Allow people who want folder filtering to depend on the external
conditions or to make it dynamic for other reasons, to do what
they want.

New repository configuration knob 'dynamic_folderfilter' was
introduced; it defaults to 'False' that matches historical behaviour.

GitHub: #73
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-03-02 16:37:41 +04:00
Eygene Ryabinkin
b01274ce38 Fix double release of IMAP connection object
This commit fixes the case when we're invoking releaseconnection()
for a given imapobj twice.

This bug manifests itself as
{{{
ValueError: list.remove(x): x not in list

  File "[...]/offlineimap/folder/IMAP.py", line 615, in savemessage
    self.imapserver.releaseconnection(imapobj)
  File "[...]/offlineimap/imapserver.py", line 130, in releaseconnection
    self.assignedconnections.remove(connection)
}}}

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-02-26 17:51:48 +04:00
Eygene Ryabinkin
8bc2f35bf6 OfflineIMAP 6.5.5 is out
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-10-04 17:03:06 +04:00
Eygene Ryabinkin
254e848140 Rolling in release candidate #3 for 6.5.5
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-09-20 14:35:37 +04:00
Eygene Ryabinkin
57adfc23a5 Fix parsing of quoted strings
When imaputil was parsing quoted strings, it treated "abcd\\"
as incomplete quoted string having escaped quote, rather than
properly-quoted string having escaped backslash.

GitHub issue: https://github.com/OfflineIMAP/offlineimap/issues/53
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-09-19 22:56:55 +04:00
Eygene Ryabinkin
be1c72ea5f Updated bundled imaplib2 to 2.36
2.36 it includes support for SSL version override that was integrated
into our code before, no other changes.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-09-19 17:19:37 +04:00
Eygene Ryabinkin
2df5b716b5 Updated bundled imaplib2 to 2.35:
- Fix for Gmail sending a BYE response after reading >100 messages
   in a session.

 - Includes fix for GitHub#15: patch was accepted upstream.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-09-02 09:08:50 +04:00
Eygene Ryabinkin
1ef506655c Catch two instances of untested regexp matches
They could possibly lead to the problems mentioned in
  https://github.com/OfflineIMAP/offlineimap/issues/6
though there are no sound evidences for this.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-08-30 21:50:08 +04:00
Eygene Ryabinkin
69765a3ef0 Properly call error() function from ui.UIBase
Second argument is exception traceback, not the message; without this
tracebacks like mentioned in
  http://permalink.gmane.org/gmane.mail.imap.offlineimap.general/5712
were happening when this exception handling block was hit.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-08-30 21:49:09 +04:00
Eygene Ryabinkin
f2c858330f Always show full tracebacks at the end of the run
This greatly simplifies developer's life and will, possibly, allow
users familiar with Python to debug and fix the problems by
themselves.

We, possibly, should not give tracebacks for the problems like
"can't open connection", but this is up to the caller of this
routine not to provide traceback in this case.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-08-27 20:25:30 +04:00