Commit Graph

20 Commits

Author SHA1 Message Date
Nicolas Sebrecht 5d5ad62fa7 mbnames: don't duplicate entries in autorefresh mode
mbnames is initialized and written once in the run from OfflineImap.__sync().

However, the in-memory instance is fed with data at sync time for each folder
and the intermediate files are written as soon as all the folders are synced for
the account. All of this is done inside the SyncableAccount.__sync() method
while the syncrunner is looping on this.

This means that we duplicate entries for mbnames in each loop (most likely when
autorefresh is enabled).

It is wrong to have duplicates in mbnames for each account. Ignore duplicates
when adding data in the mbnames intermediate files.

Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/467
Reported-and-tested-by: Shin Kojima <shin@kojima.org>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2017-05-19 08:32:22 +02:00
Stéphane Albert 175d49e8a2 Fix mbnames writing with folders using utf-8
Signed-off-by: Stéphane Albert <sheeprine@oh.its.fake.nullplace.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-11-02 12:30:03 +01:00
Nicolas Sebrecht 41764a0ec6 mbnames: add info output messages in dry run mode
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-08-26 01:44:15 +02:00
Nicolas Sebrecht 520e99d8b6 mbnames: remove non-required argument
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-08-26 01:38:03 +02:00
Wieland Hoffmann ad2070f0d4 Remove an unused import
Signed-off-by: Wieland Hoffmann <themineo@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-08-09 22:40:45 +02:00
Nicolas Sebrecht 175479d919 mbnames: fix the filename extension for the intermediate files
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-06 01:15:33 +02:00
Nicolas Sebrecht b3209e38c0 mbnames: output message on errors while reading intermediate files
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-06 00:38:43 +02:00
Nicolas Sebrecht 69c0080323 learn --mbnames-prune CLI option
This is usefull to remove dangling entries for removed accounts or if mbnames is
not enabled anymore.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-07-03 19:54:41 +02:00
Nicolas Sebrecht 092264c8e7 fix: when called with -a, mbnames must not erase entries of other accounts
Make mbnames to work with intermediate files, one per account, in the JSON
format. The mbnames target is built from those intermediate files.

Github-Fix: https://github.com/OfflineIMAP/offlineimap/issues/66
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-06-25 17:33:42 +02:00
Ben Boeckel 4217fccb82 mbnames: add option to write the file once per account
The basic problem is in the context of syncing multiple accounts where
one is fast and the others are slower (due to the number of folders).
When the fast account completes, the other accounts are partially written
through the list and if the file is read during this time, the list can
be useless. However, in the general case, the file is probably left
around from a previous run of offlineimap and is more correct, so add an
option to leave it alone until all syncing is done.

Incremental is still the default since this running offlineimap using
its own timer setup is likely the most common setup. Turning it off
works best with one-shot mode triggered by cron or systemd timers.

Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-03-22 21:15:46 +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
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
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 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
Eygene Ryabinkin 95aea5e489 Add new expansion key for mbnames.peritem config variable
It is called localfolders and holds expanded name for the same
variable for the local repository of the account that is being
processed.

GitHub issue: https://github.com/OfflineIMAP/offlineimap/issues/21
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-08-27 20:25:23 +04:00
Johan Herland 56b0c5dbac Allow custom sorting of mailboxes for mbnames
mutt-sidebar and, probably, other MUA show mailboxes in the order
they are listed in the file written by mbnames.  Therefore, to allow
customization of the order with which mailboxes are listed, introduce
the new 'sort_keyfunc' directive in the [mbnames] section.

'sort_keyfunc' must be a function that will be called once for each
mailbox.  It must accept the only argument -- a dict with 2 items,
'accountname' and 'foldername', and should return an object that
will be used as the sorting key for each mailbox.

Default key function returns (d['accountname'], d['foldername']),
thus sorting by account name and then by the folder name.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-08-02 14:46:44 +04:00
Eygene Ryabinkin 41cb0f577f Prune trailing whitespaces from code and documentation
They are redundant in all pruned cases and sometimes even create some
problems, e.g., when one tries to jump through paragraphs in vi.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-07-21 23:00:23 +04:00
Nicolas Sebrecht a39128516b explicitly define symbols to import instead of 'import *'
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2011-05-09 22:43:03 +02:00
John Goerzen 39a18fef60 Update FSF address 2006-08-12 05:15:55 +01:00
John Goerzen d839be3c61 Step 2 of SVN to arch tree conversion 2005-04-16 20:33:35 +01:00