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>
This commit is contained in:
parent
8d858a0b78
commit
38b1d7b085
@ -34,7 +34,7 @@ class MappedIMAPFolder(IMAPFolder):
|
|||||||
diskl2r: dict mapping message uids: self.r2l[localuid]=remoteuid"""
|
diskl2r: dict mapping message uids: self.r2l[localuid]=remoteuid"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
IMAPFolder.__init__(self, *args, **kwargs)
|
IMAPFolder.__init__(self, *args, **kwargs)
|
||||||
self.maplock = Lock()
|
self.maplock = Lock()
|
||||||
(self.diskr2l, self.diskl2r) = self._loadmaps()
|
(self.diskr2l, self.diskl2r) = self._loadmaps()
|
||||||
self._mb = IMAPFolder(*args, **kwargs)
|
self._mb = IMAPFolder(*args, **kwargs)
|
||||||
|
@ -42,14 +42,14 @@ class BaseRepository(object, CustomConfig.ConfigHelperMixin):
|
|||||||
# The 'restoreatime' config parameter only applies to local Maildir
|
# The 'restoreatime' config parameter only applies to local Maildir
|
||||||
# mailboxes.
|
# mailboxes.
|
||||||
def restore_atime(self):
|
def restore_atime(self):
|
||||||
if self.config.get('Repository ' + self.name, 'type').strip() != \
|
if self.config.get('Repository ' + self.name, 'type').strip() != \
|
||||||
'Maildir':
|
'Maildir':
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.config.has_option('Repository ' + self.name, 'restoreatime') or not self.config.getboolean('Repository ' + self.name, 'restoreatime'):
|
if not self.config.has_option('Repository ' + self.name, 'restoreatime') or not self.config.getboolean('Repository ' + self.name, 'restoreatime'):
|
||||||
return
|
return
|
||||||
|
|
||||||
return self.restore_folder_atimes()
|
return self.restore_folder_atimes()
|
||||||
|
|
||||||
def connect(self):
|
def connect(self):
|
||||||
"""Establish a connection to the remote, if necessary. This exists
|
"""Establish a connection to the remote, if necessary. This exists
|
||||||
|
@ -73,7 +73,7 @@ class GmailRepository(IMAPRepository):
|
|||||||
def gettrashfolder(self, foldername):
|
def gettrashfolder(self, foldername):
|
||||||
#: Where deleted mail should be moved
|
#: Where deleted mail should be moved
|
||||||
return self.getconf('trashfolder','[Gmail]/Trash')
|
return self.getconf('trashfolder','[Gmail]/Trash')
|
||||||
|
|
||||||
def getspamfolder(self):
|
def getspamfolder(self):
|
||||||
#: Gmail also deletes messages upon EXPUNGE in the Spam folder
|
#: Gmail also deletes messages upon EXPUNGE in the Spam folder
|
||||||
return self.getconf('spamfolder','[Gmail]/Spam')
|
return self.getconf('spamfolder','[Gmail]/Spam')
|
||||||
|
@ -32,28 +32,28 @@ class MaildirRepository(BaseRepository):
|
|||||||
self.folders = None
|
self.folders = None
|
||||||
self.ui = getglobalui()
|
self.ui = getglobalui()
|
||||||
self.debug("MaildirRepository initialized, sep is " + repr(self.getsep()))
|
self.debug("MaildirRepository initialized, sep is " + repr(self.getsep()))
|
||||||
self.folder_atimes = []
|
self.folder_atimes = []
|
||||||
|
|
||||||
# Create the top-level folder if it doesn't exist
|
# Create the top-level folder if it doesn't exist
|
||||||
if not os.path.isdir(self.root):
|
if not os.path.isdir(self.root):
|
||||||
os.mkdir(self.root, 0700)
|
os.mkdir(self.root, 0700)
|
||||||
|
|
||||||
def _append_folder_atimes(self, foldername):
|
def _append_folder_atimes(self, foldername):
|
||||||
p = os.path.join(self.root, foldername)
|
p = os.path.join(self.root, foldername)
|
||||||
new = os.path.join(p, 'new')
|
new = os.path.join(p, 'new')
|
||||||
cur = os.path.join(p, 'cur')
|
cur = os.path.join(p, 'cur')
|
||||||
f = p, os.stat(new)[ST_ATIME], os.stat(cur)[ST_ATIME]
|
f = p, os.stat(new)[ST_ATIME], os.stat(cur)[ST_ATIME]
|
||||||
self.folder_atimes.append(f)
|
self.folder_atimes.append(f)
|
||||||
|
|
||||||
def restore_folder_atimes(self):
|
def restore_folder_atimes(self):
|
||||||
if not self.folder_atimes:
|
if not self.folder_atimes:
|
||||||
return
|
return
|
||||||
|
|
||||||
for f in self.folder_atimes:
|
for f in self.folder_atimes:
|
||||||
t = f[1], os.stat(os.path.join(f[0], 'new'))[ST_MTIME]
|
t = f[1], os.stat(os.path.join(f[0], 'new'))[ST_MTIME]
|
||||||
os.utime(os.path.join(f[0], 'new'), t)
|
os.utime(os.path.join(f[0], 'new'), t)
|
||||||
t = f[2], os.stat(os.path.join(f[0], 'cur'))[ST_MTIME]
|
t = f[2], os.stat(os.path.join(f[0], 'cur'))[ST_MTIME]
|
||||||
os.utime(os.path.join(f[0], 'cur'), t)
|
os.utime(os.path.join(f[0], 'cur'), t)
|
||||||
|
|
||||||
def getlocalroot(self):
|
def getlocalroot(self):
|
||||||
return os.path.expanduser(self.getconf('localfolders'))
|
return os.path.expanduser(self.getconf('localfolders'))
|
||||||
@ -110,8 +110,8 @@ class MaildirRepository(BaseRepository):
|
|||||||
self.ui.warn("NOT YET IMPLEMENTED: DELETE FOLDER %s" % foldername)
|
self.ui.warn("NOT YET IMPLEMENTED: DELETE FOLDER %s" % foldername)
|
||||||
|
|
||||||
def getfolder(self, foldername):
|
def getfolder(self, foldername):
|
||||||
if self.config.has_option('Repository ' + self.name, 'restoreatime') and self.config.getboolean('Repository ' + self.name, 'restoreatime'):
|
if self.config.has_option('Repository ' + self.name, 'restoreatime') and self.config.getboolean('Repository ' + self.name, 'restoreatime'):
|
||||||
self._append_folder_atimes(foldername)
|
self._append_folder_atimes(foldername)
|
||||||
return folder.Maildir.MaildirFolder(self.root, foldername,
|
return folder.Maildir.MaildirFolder(self.root, foldername,
|
||||||
self.getsep(), self,
|
self.getsep(), self,
|
||||||
self.accountname, self.config)
|
self.accountname, self.config)
|
||||||
@ -155,11 +155,11 @@ class MaildirRepository(BaseRepository):
|
|||||||
# This directory has maildir stuff -- process
|
# This directory has maildir stuff -- process
|
||||||
self.debug(" This is maildir folder '%s'." % foldername)
|
self.debug(" This is maildir folder '%s'." % foldername)
|
||||||
|
|
||||||
if self.config.has_option('Repository %s' % self,
|
if self.config.has_option('Repository %s' % self,
|
||||||
'restoreatime') and \
|
'restoreatime') and \
|
||||||
self.config.getboolean('Repository %s' % self,
|
self.config.getboolean('Repository %s' % self,
|
||||||
'restoreatime'):
|
'restoreatime'):
|
||||||
self._append_folder_atimes(foldername)
|
self._append_folder_atimes(foldername)
|
||||||
retval.append(folder.Maildir.MaildirFolder(self.root,
|
retval.append(folder.Maildir.MaildirFolder(self.root,
|
||||||
foldername,
|
foldername,
|
||||||
self.getsep(),
|
self.getsep(),
|
||||||
|
Loading…
Reference in New Issue
Block a user