Commit Graph

16 Commits

Author SHA1 Message Date
Vladimir Marek
38b1d7b085 Replaced tabs with spaces to unify python sources
Signed-off-by: Vladimir Marek <vlmarek@volny.cz>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2011-08-16 22:33:19 +02:00
Sebastian Spaeth
b40d02e801 repository/Maildir.py: Fix typo 'sudir'
sudir->subdir in a debug statement. Thanks ccxCZ on IRC for the heads
up.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2011-06-23 18:30:55 +02:00
Sebastian Spaeth
335b320d9a Fix recursively scanning Maildir folders
Commit 1754bf4110 introduced a blunder:

-        for dirname in os.listdir(toppath) + ['.']:
+        for dirname in os.listdir(toppath) + [toppath]:
...
-            if self.getsep() == '/' and dirname != '.':
+            if self.getsep() == '/' and dirname:

This change was plainly wrong and would never have worked, so this
commit reverts above bit. While touching the function, some minor code
documentation, cleanup and limiting line length to 80 chars.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2011-06-16 18:37:40 +02:00
Sebastian Spaeth
1754bf4110 Allow to create the root MailDir directory
We currently do not allow nametrans rules such as
nametrans = lambda foldername: re.sub('^INBOX$', '', foldername)

because we crash with a traceback when running:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=499755

The underlying reason is that we cannot create the "top level" root
directory of the Maildir in the function makefolders(), it will bail
out. John Goerzen intentionally prevented offlineimap from creating the
top-level dir, so that a misconfiguration could not arbitrarily create
folders on the file system. I believe that it should be perfectly
possible to automatically create the root dirctory of the maildir. We
still protect against folder creations at arbitrary places in the file
system though.

This patch cleans up makefolders(), adds documentation, allows to
automatically create rootfolders if needed (using absolute paths) and
adds some robustness in case the folders already exist that we want to
create (rather than simply crapping out).

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2011-06-08 17:15:31 +02:00
Sebastian Spaeth
f3ec6d9c7d Assert error hint when trying to create MailDir root
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=499755 shows the
cryptic output we have when, e.g. trying to put somethin in our mailDir
root via the nametrans options. This commit adds at least some hint as
to what went wrong using an "assert" message, although the correct thing
is to allow the creation of a maildir in the root folder.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2011-06-08 17:10:31 +02:00
Nicolas Sebrecht
44eefae043 cleanup import statements and conform to PEP-8
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2011-03-14 21:35:33 +01:00
Sebastian Spaeth
67089248da repository/*: replace UIBase.getglobalui() with getglobalui()
The latter is much shorter and looks nicer. UIBase was a very weird
name and with this patch, we don't need to use (or see) it from higher
level code anymore.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2011-01-05 19:24:00 +01:00
John Goerzen
2b23657db0 Added ability to disable fsync()
Passed config to LocalStatus and Maildir folders so they can look
up the fsync status
2008-08-02 14:55:08 -05:00
John Goerzen
0754bdef6a Slightly more debug info 2008-08-02 14:37:55 -05:00
John Goerzen
bd1d1010e7 Now create cur,new,tmp in '.' even if existsok is false
Otherwise, there was a race where sometimes subfolders would get created
first in the sep = '.' scneario

fixes #64
2008-08-02 14:34:51 -05:00
John Goerzen
3af221f99b Automatically create top-level localfolder for Maildirs
this is the folder Maildirs will put messages in.

Closes: #286967
2008-03-27 00:35:05 -05:00
John Goerzen
89e530ff6e New restoreatime patch from Ben Kibbey
From: Ben Kibbey
Subject: Re: Removed restoratime from OfflineIMAP

On Wed, May 03, 2006 at 10:08:35PM -0500, John Goerzen wrote:
> Hi Ben,
> 
> Thanks for your restoreatime patch.
> 
> However, I have received this bug report:
> 
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=365933
> 
> After looking at the problem, here's what's going on.
> 
> The person is using IMAP as the local repository as well.
> 
> You really need to move the atime save and restore code from accounts.py
> into the repository/Maildir.py.  Then, for any new call you add to the
> Maildir repository (that will be called from outside Maildir.py), you
> need to add a corresponding default function to repository/Base.py, and
> also make sure that on folders (such as IMAP) where atime restoration
> makes no sense, no error is generated.
> 
> Let me know if that doesn't make sense to you.  If you get it fixed, I'd
> be happy to re-apply it to a future version of OfflineIMAP.
> 
> -- John Goerzen
> 

Attached is a new diff that should work though not really tested
(v4.0.14). In repository/Base.py restore_atime() will call
self.restore_folder_atimes() only if the folder type is Maildir. Let me
know if it has any more problems.
2006-09-06 02:33:07 +01:00
John Goerzen
39a18fef60 Update FSF address 2006-08-12 05:15:55 +01:00
John Goerzen
5a6b2a1ebd Revert restoreatime patch 2006-05-04 09:05:46 +01:00
John Goerzen
405275f541 New restoreatime patch
From: Ben Kibbey <bjk@luxsci.net>

Attached is a patch to restore the atime of Maildir folders after
syncing. It can be enabled via the 'restoreatime' boolean in the
configuration file. I needed this because offlineimap is run after a
fetchmail and my mail checker breaks.
2006-03-02 00:12:29 +01:00
John Goerzen
d839be3c61 Step 2 of SVN to arch tree conversion 2005-04-16 20:33:35 +01:00