Commit Graph

1671 Commits

Author SHA1 Message Date
Bart Kerkvliet 3a580049ad Typos fixed in config file
Fixed some minor typos in the commented config file.
I think these days Google also uses Gmail in Germany, so also changed
German Google Mail to German Gmail.
2013-08-02 14:53:12 +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
mxgr7 0d992ee7d3 Execute pre/post hooks for IDLE-toggled syncs
Make IDLE syncs be equal to the regular synchronisations
in respect to pre-sync and post-sync hooks.

From: mxgr7 <maxgerer@gmail.com>
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-08-02 13:53:21 +04:00
Eygene Ryabinkin 67d68c2fc8 IMAP: simplify locking and fix potential lock loss
Run the locked code under 'with': this guarantees that lock
will be released in any case.

This modification also avoids the case when our thread wasn't running
locked when exception was caught, another thread got the lock, our
code checked it via self.connectionlock.locked() and errorneously
released the lock thinking that is was running locked.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-07-22 00:08:39 +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
Dmitrijs Ledkovs e8c40a9285 Merge branch 'master' into next 2013-07-10 02:49:52 +01:00
xnox 05284b4df8 Merge pull request #28 from aspiers/fix-typos
fix typos
2013-07-09 18:30:28 -07:00
Dmitrijs Ledkovs a26ce6d126 Merge branch 'dxtr-remoteporteval' 2013-07-10 02:17:44 +01:00
Dmitrijs Ledkovs 7a21cab6c5 Correct whitespace & add docs about remoteporteval. 2013-07-10 02:17:01 +01:00
xnox 63f1960dbc Merge pull request #35 from cpick/typo
Fix small offlineimap.conf typo
2013-07-09 18:04:12 -07:00
xnox 04c2f8fbe3 Merge pull request #36 from hobarrera/master
Renamed README to README.md
2013-07-09 18:02:55 -07:00
Dmitrijs Ledkovs cbceffcb6a Rename README to README.md for github 2013-07-10 01:59:25 +01:00
xnox e469a1e444 Merge pull request #42 from ryanakca/next
Allow setting IMAP servers' SSL version
2013-07-09 17:53:28 -07:00
Ryan Kavanagh 2bacdb7fa3 Allow setting IMAP servers' SSL version
We now allow setting the SSL version used when connecting to IMAPS servers, and
do so via the `ssl_version` configuration option. We default to the current
practice (letting python's "ssl" library automatically detect the correct
version). There are however rare cases where one must specify the version to
use.

Signed-off-by: Ryan Kavanagh <rak@debian.org>
2013-07-08 10:57:58 -04:00
Kim Lidström dde021ce52 Added remoteporteval 2013-06-20 11:38:45 +02:00
Chris Pick b212e60c49 Fix small offlineimap.conf typo
Maxage comment 'therefor' -> 'therefore'.
2013-05-19 22:07:20 -04:00
Hugo Osvaldo Barrera 84857f9430 README.md: Renaming file so that github renders it nicely. 2013-04-19 19:35:08 -03:00
Adam Spiers aa5202396c fix typos 2013-03-27 12:42:32 +00:00
Eygene Ryabinkin 611f6e89c0 IMAP class: don't suggest multithreading in single-threaded mode
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-02-11 23:34:28 +04:00
Eygene Ryabinkin f4140cbbed Create global instance of command-line options
This eases testing of option values inside the code.  This instance
is implemented as the read-only copy of the obtained 'options' object,
so callers won't be able to modify its contents.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-02-11 23:34:18 +04:00
X-Ryl669 5c842c01bd Fix deadlock for IMAP folder synced in singlethreaded mode
The problem lies in the fact that offlineimap.folder.Base's method
syncmessagesto_copy() uses threaded code everytime it is suggested by
the derived class's suggeststhreads() (currently, only IMAP does this
suggestion), but offlineimap/init.py will not spawn the
exitnotifymonitorloop() from offlineimap.threadutil.

The root cause is that ExitNotifyThread-derived threads need
offlineimap.threadutil's exitnotifymonitorloop() to be running the
cleaner for the exitthreads Queue(), because it fills the queue via
the run() method from this class: it wants to put() itself to the
Queue on exit, so when no exitnotifymonitorloop() is running, the
queue will fill up.  And if this thread is an instance of
InstanceLimitedThread that hits the limit on the number of threads,
then it will hold the instancelimitedsems[] semaphore will prevent
other InstanceLimitedThread()s of the same name to pass its start()
method.

The fix is to avoid using threaded code if we're running
single-threaded.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Obtained-from: X-Ryl669 <boite.pour.spam@gmail.com>
2013-02-05 07:53:25 +04:00
Eygene Ryabinkin 1c8917b036 And add forgotten __init__.py for offlineimap.utils
I should learn to check my commits when rebasing and reordering.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-02-05 07:52:25 +04:00
Eygene Ryabinkin 4dcd676b23 Add offlineimap.utils to the list of our modules
Forgot to do it while was adding stacktrace support.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-02-05 07:38:11 +04:00
Eygene Ryabinkin de84c3941c Implement stack trace dump for all running threads on SIGQUIT
This is handy when we're debugging the thread locks: we can try to
understand which thread does what and how it was called.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-02-02 16:25:37 +04:00
Dmitrijs Ledkovs 83e8fca2e0 Make SIGHUP singal handler equivalent to SIGTERM and SIGINT.
offlineimap has several frontends that encourage running it from a
terminal under an X session. When X session closes for a system
shutdown, the terminals exit, after sending SIGHUP to their children.

Previously SIGHUP was treated to be equivalent to SIGUSR1, i.e. wake
up and sync all accounts. This causes delays during shutdown.

According to Wikipedia [0], SIGHUP has been repurposed from a
historical meaning to one of:
 * re-read configuration files, or reinitialize (e.g. Apache, sendmail)
 * controlling pseudo or virtual terminal has been closed

I believe second meaning is more appropriate for offlineimap, and
hence this patch makes SIGHUP to be handled in the same way SIGTERM
and SIGINT are handled.

[0] http://en.wikipedia.org/wiki/SIGHUP

Debian-Bug: http://bugs.debian.org/670120
Reported-By: Steve Langasek <steve.langasek@canonical.com>
Signed-off-by: Dmitrijs Ledkovs <xnox@debian.org>
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-01-26 23:05:46 +04:00
Tobias Thierer caef9a72fc Fix IMAP folder throwing away time zone when parsing email Date headers
Fix imapfolder.getmessageinternaldate misparsing the Date:
header from emails due to a bug or surprising behaviour by
email.utils.parsedate. This is because email.utils.parsedate's
return value contains the unadjusted hour value from the string
parsed but does not include information about the time zone in
which it is specified. For example (Python 2.7.3):

$ python -c "import email.utils;
  print email.utils.parsedate('Mon, 20 Nov 1995 19:12:08 -0500')"
 (1995, 11, 20, 19, 12, 8, 0, 1, -1)

(the -1 is the isdst field); the -0500 time zone is completely
ignored, so e.g. the same input with time "19:12:08 +0300" has
the same result. When passed to time.struct_time as allowed per
the parsedate documentation, this time is interpreted in GMT and
thus deviates from the correct value by the timezone offset
(in this example, -5 hours).

I consider this a bug in email.utils.parsedate: In my opinion,
since the return value of the parsetime doesn't include a timezone,
it should be expressed in terms of UTC rather than in terms of the
time zone from the Date header; the existence of
email.utils.parsedate_tz, to which I've switched, indicates that
maybe the authors were aware of this problem.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-10-03 11:16:13 +02:00
Nicolas Sebrecht a73b4b3465 Merge branch 'next' 2012-09-12 19:48:19 +02:00
Sebastian Spaeth 5eef3ae473 Merge branch 'next' of github.com:OfflineIMAP/offlineimap into next 2012-09-05 17:41:22 +02:00
Sebastian Spaeth 721035eace Release v6.5.5-rc2
(Same as rc1, but with Changelog updated and version number bumped)

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-09-05 17:40:09 +02:00
Nicolas Sebrecht ad66a4648e add official maintainers list with minimal informations
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2012-09-03 19:38:16 +02:00
Sebastian Spaeth 3476e9ab36 Fix fallout when filtering folders
Previous commit e7ca5b25cb combined
checks for filtered folders in one place. However, it turns out there
was a reason to have them separate. getfolder() on a non-existent Maildir
fails and there might not be an equivalent local Maildir folder for a
filtered out IMAP folder.

Fix this by first checking if the remote folder should be filtered, and
only then retrieving the local folder (which should exist then).

This bug was found by our test suite!

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-09-01 03:15:08 +02:00
Sebastian Spaeth 49c11fc8f0 LocalStatus._folders needs to be {} not None
the LocalStatus._folders cache was changed to be a dict that can be
searched for names. One instance were _folders was set to "None" was
accidentally left over. Fix this.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-09-01 02:58:14 +02:00
Dave Abrahams 7d1d5283f8 No need to filter Maildir folders here
commit e94642bb4d centralized folder filtering by using the
repository.should_sync_folder() function. Therefore there is no need
to check for folderfilter in the Maildir backend separately.

Origina patch by Dave, split into 3 by Sebastian

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-09-01 02:49:00 +02:00
Dave Abrahams e94642bb4d Determine folder syncing on Folder initialization
Rather than later when retrieving them by IMAP, we determine the
"sync_this" value of a folder on Folder() initialization.

This also fixes a bug where folder structure was not propagated when
a folder was filtered out but included in the folderincludes list.

Patch by Dave, split and modified slightly by Sebastian

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-09-01 02:30:46 +02:00
Dave Abrahams e7ca5b25cb Combine checks for ignored folders in one place
- Factor out the code to find a local folder given a remote folder

Patch by Dave, split and modified by Sebastian.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-09-01 02:16:06 +02:00
Sebastian Spaeth 1b54b85f20 Reuse LocalStatus() folders rather than recreate instances
If we ask twice for a LocalStatusFolder via getfolder(), we would
get a newly created instance each time. This can lead to problems,
as e.g. write locks protecting files only work within the same Folder
instance. Make it so, that we cache all Folder instances that we have
asked for and hand back the existing one if we ask again for it,
rather than recreate a new instance.

Also, make getfolders() a noop for LocalStatus. We attempted to
derive the foldername from the name of the LocalStatusfile. However,
this is not really possible, as we do file name mangling
(".$" -> "dot", "/" -> ".") and there is no way to get the original folder
name from the LocalStatus file name anyway.

This commit could potentially solve the "file not found" errors, that people
have been seeing with their LocalStatusCache files. If we have 2
instances of a LocalStatusFolder pointing to the same file, our locking
system would not work.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-09-01 01:19:19 +02:00
Sebastian Spaeth a1dc76ae91 Don't output initial blurb in "quiet" mode
When logging to a file using the -l switch, we would still write an initial
banner to the file. This was never intended. Quiet should be really quiet
unless it experiences an error. Simplify the logging statement, to do nothing
if logevel is set to "WARNING" aka quiet.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-08-31 23:11:11 +02:00
Sebastian Spaeth 3cb2ddccb8 Use "with lock" pattern
While looking at the code to investigate if an why we sometimes don't
seem to honor the write lock, I made it use the more modern "with lock:"
pattern.

Still have not found out how we could ever be using 2 instances of the
LocalStatusFolder for the same folder.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-08-31 22:34:53 +02:00
Sebastian Spaeth 04ffae2f00 Exit with nice error message failing to get repositories
If we throw an OfflineImapError in case of the Repository()
initialization, we display the nice error message and exit rather
than bomb out with a traceback. Misconfiguring a repository name in
the configuration file is now nicely pointed out to the user.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-08-31 20:34:54 +02:00
Sebastian Spaeth 103524c979 Throw OfflineImapErrors rather than weird Exceptions
When misconfiguring OLI, e.g. by specifying a repository name that was
not configured anywhere, we would bomb out with cryptic "NoSectionError".
Throw OfflineImapError that explains what has happened. We still need to
avoid throwing exceptions with Tracebacks here though.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-08-31 20:31:43 +02:00
Sebastian Spaeth 925a5bcae1 Fix cut-off line
Commit 6e5fbebc introduced a cut-off line. Fixing that.
All tests ran successfully.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-08-21 17:00:39 +02:00
Sebastian Spaeth a134301ac5 Improve 'find first quotation' regex
Reported by http://www.dfranke.com/blog/2012/08/20/offlineimap-error-beim-syncen-mit-lotus-domino/
our 'find the first quote possible containing encoded quotation
marks' regex did not seem to have caught all cases. E.g. "\\".

Verified the fix as good. Thanks Daniel Franke.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-08-21 16:58:32 +02:00
Vladimir Nesov 6e5fbebc0e fix: createfolders setting is ignored if readonly is True
If 'readonly' is True, folders shouldn't be created (regardless of
'createfolders' option). With old behavior, instead folders were always created
when 'readonly' is True (even if 'createfolders' was also False), which is a
serious bug (offlineimap was creating folders in all read-only repositories).
'createfolders' should only play a role if 'readonly' is False, in which case
folders should only be created if 'createfolders' is True.

Submitted-by: Vladimir Nesov <robotact@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2012-08-20 21:12:56 +02:00
Nicolas Sebrecht 44d2199a00 docs: update links to the newly created github organization
Acually, these are the minimal expected changes.
More might be done and/or discussed.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2012-08-20 14:45:43 +02:00
Eygene Ryabinkin 131ac5c827 IMAPlib mixin class: pass 'readonly' exception to our callers
This will allow our callers who are capable of dealing with
readonly folders to properly detect this condition and act
accordingly.

One example is Gmail's "Chats" folder that is read-only,
but contains logs of the quick chats.

Minor Changelog improvements.

Tested-by: Abdó Roig-Maranges <abdo.roig@gmail.com>
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2012-08-11 11:59:26 +02:00
Eygene Ryabinkin 6c85a4518d IMAPlib mixin class: pass 'readonly' exception to our callers
This will allow our callers who are capable of dealing with
readonly folders to properly detect this condition and act
accordingly.

One example is Gmail's "Chats" folder that is read-only,
but contains logs of the quick chats.

Tested-by: Abdó Roig-Maranges <abdo.roig@gmail.com>
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2012-08-06 14:28:09 +04:00
Nicolas Sebrecht 799905325c docs: split long lines (up to 80 characters)
Not everybody has a wide screen.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2012-07-30 18:41:17 +02:00
Dmitrijs Ledkovs d45872e59c Add missing OfflineImapError import in folder/UIDMaps.py
Bug-Debian: http://bugs.debian.org/671279
Reported-by: Ansgar Burchardt <ansgar@debian.org>
Signed-off-by: Dmitrijs Ledkovs <xnox@debian.org>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2012-07-30 20:10:11 +02:00
Sebastian Spaeth 36156fa985 Remove the APPENDUID hack, previously introduced
As Gmail was only announcing the presence of the UIDPLUS extension
after we logged in, and we were then only getting server
capabilities before, a hack was introduced that checked the
existence of an APPENDUID reply, even if the server did not claim
to support it.

However, John Wiegley reports problems, where the APPENDUID would
be None, and we attempt to go this path (it seems that imaplib2
returns [None] if there is no such reply, so our test here for "!="
might fail. Given that this is an undocumented imaplib2 function
anyway, and we do fetch gmail capabilities after authentication,
this hack should no longer be necessary.

We had problems there earlier, where imapobj.response() would
return [None] although we had received a APPENDUID response from
the server, this might need more debugging and testing.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-06-06 10:13:42 +02:00
David Logie a614f9a735 Fix str.format() calls for Python 2.6.
Python 2.6 requires a slightly different string formatting that >2.7.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-06-02 18:25:51 +02:00