Merge branch 'master' into next

This commit is contained in:
Dmitrijs Ledkovs 2013-07-10 02:49:52 +01:00
commit e8c40a9285
5 changed files with 86 additions and 78 deletions

View File

@ -1,5 +1,5 @@
OfflineImap README OfflineImap
================== ===========
Description Description
----------- -----------
@ -26,7 +26,7 @@ Documentation
The documentation is included (in .rst format) in the `docs` directory. The documentation is included (in .rst format) in the `docs` directory.
Read it directly or generate nice html docs (python-sphinx needed) and/or Read it directly or generate nice html docs (python-sphinx needed) and/or
the man page (python-docutils needed) while being in the `docs` dir via:: the man page (python-docutils needed) while being in the `docs` dir via:
'make doc' (user docs), 'make man' (man page only) or 'make' (both) 'make doc' (user docs), 'make man' (man page only) or 'make' (both)
@ -50,7 +50,7 @@ provides you with the bare minimum of setting up OfflineIMAP. You can
simply copy this file into your home directory and name it simply copy this file into your home directory and name it
``.offlineimaprc``. A command such as ``cp offlineimap.conf.minimal ``.offlineimaprc``. A command such as ``cp offlineimap.conf.minimal
~/.offlineimaprc`` will do it. Or, if you prefer, you can just copy ~/.offlineimaprc`` will do it. Or, if you prefer, you can just copy
this text to ``~/.offlineimaprc``:: this text to ``~/.offlineimaprc``:
[general] [general]
accounts = Test accounts = Test
@ -111,7 +111,7 @@ This example shows you how to set up OfflineIMAP to synchronize multiple
accounts with the mutt mail reader. accounts with the mutt mail reader.
Start by creating a directory to hold your folders by running ``mkdir ~/Mail``. Start by creating a directory to hold your folders by running ``mkdir ~/Mail``.
Then, in your ``~/.offlineimaprc``, specify:: Then, in your ``~/.offlineimaprc``, specify:
accounts = Personal, Work accounts = Personal, Work
@ -120,12 +120,12 @@ Make sure that you have both an [Account Personal] and an [Account Work]
section. The local repository for each account must have different localfolder section. The local repository for each account must have different localfolder
path names. Also, make sure to enable [mbnames]. path names. Also, make sure to enable [mbnames].
In each local repository section, write something like this:: In each local repository section, write something like this:
localfolders = ~/Mail/Personal localfolders = ~/Mail/Personal
Finally, add these lines to your ``~/.muttrc``:: Finally, add these lines to your ``~/.muttrc``:
source ~/path-to-mbnames-muttrc-mailboxes source ~/path-to-mbnames-muttrc-mailboxes
folder-hook Personal set from="youremail@personal.com" folder-hook Personal set from="youremail@personal.com"
@ -146,7 +146,7 @@ to get at their mailboxes, specifying a reference of ``~/Mail`` or ``#mh/``
depending on the configuration. The below configuration from (originally from depending on the configuration. The below configuration from (originally from
docwhat@gerf.org) shows using a reference of Mail, a nametrans that strips the docwhat@gerf.org) shows using a reference of Mail, a nametrans that strips the
leading Mail/ off incoming folder names, and a folderfilter that limits the leading Mail/ off incoming folder names, and a folderfilter that limits the
folders synced to just three:: folders synced to just three:
[Account Gerf] [Account Gerf]
localrepository = GerfLocal localrepository = GerfLocal
@ -184,14 +184,14 @@ configuration file options that are Python expressions. This example is based
on one supplied by Tommi Virtanen for this feature. on one supplied by Tommi Virtanen for this feature.
In ~/.offlineimaprc, he adds these options:: In ~/.offlineimaprc, he adds these options:
[general] [general]
pythonfile=~/.offlineimap.py pythonfile=~/.offlineimap.py
[Repository foo] [Repository foo]
foldersort=mycmp foldersort=mycmp
Then, the ~/.offlineimap.py file will contain:: Then, the ~/.offlineimap.py file will contain:
prioritized = ['INBOX', 'personal', 'announce', 'list'] prioritized = ['INBOX', 'personal', 'announce', 'list']

View File

@ -234,7 +234,7 @@ remoterepository = RemoteExample
# Messages older than maxage days will not be synced, their flags will # Messages older than maxage days will not be synced, their flags will
# not be changed, they will not be deleted etc. For offlineimap it will # not be changed, they will not be deleted etc. For offlineimap it will
# be like these messages do not exist. This will perform an IMAP search # be like these messages do not exist. This will perform an IMAP search
# in the case of IMAP or Gmail and therefor requires that the server # in the case of IMAP or Gmail and therefore requires that the server
# support server side searching. This will calculate the earliest day # support server side searching. This will calculate the earliest day
# that would be included in the search and include all messages from # that would be included in the search and include all messages from
# that day until today. e.g. maxage = 3 to sync only the last 3 days # that day until today. e.g. maxage = 3 to sync only the last 3 days
@ -292,6 +292,7 @@ type = IMAP
# "getcredentials" that parses a file "filename" and returns the account # "getcredentials" that parses a file "filename" and returns the account
# details for "hostname". # details for "hostname".
# remotehosteval = getcredentials("filename", "hostname", "hostname") # remotehosteval = getcredentials("filename", "hostname", "hostname")
# remoteporteval = getcredentials("filename", "hostname", "port")
# remoteusereval = getcredentials("filename", "hostname", "user") # remoteusereval = getcredentials("filename", "hostname", "user")
# remotepasseval = getcredentials("filename", "hostname", "passwd") # remotepasseval = getcredentials("filename", "hostname", "passwd")

View File

@ -367,7 +367,7 @@ class BaseFolder(object):
raise raise
except OfflineImapError as e: except OfflineImapError as e:
if e.severity > OfflineImapError.ERROR.MESSAGE: if e.severity > OfflineImapError.ERROR.MESSAGE:
raise # buble severe errors up raise # bubble severe errors up
self.ui.error(e, exc_info()[2]) self.ui.error(e, exc_info()[2])
except Exception as e: except Exception as e:
self.ui.error(e, "Copying message %s [acc: %s]:\n %s" %\ self.ui.error(e, "Copying message %s [acc: %s]:\n %s" %\

View File

@ -556,7 +556,7 @@ class IMAPFolder(BaseFolder):
imapobj = self.imapserver.acquireconnection() imapobj = self.imapserver.acquireconnection()
if not retry_left: if not retry_left:
raise OfflineImapError("Saving msg in folder '%s', " raise OfflineImapError("Saving msg in folder '%s', "
"repository '%s' failed (abort). Server reponded: %s\n" "repository '%s' failed (abort). Server responded: %s\n"
"Message content was: %s" % "Message content was: %s" %
(self, self.getrepository(), str(e), dbg_output), (self, self.getrepository(), str(e), dbg_output),
OfflineImapError.ERROR.MESSAGE) OfflineImapError.ERROR.MESSAGE)
@ -568,7 +568,7 @@ class IMAPFolder(BaseFolder):
self.imapserver.releaseconnection(imapobj, True) self.imapserver.releaseconnection(imapobj, True)
imapobj = None imapobj = None
raise OfflineImapError("Saving msg folder '%s', repo '%s'" raise OfflineImapError("Saving msg folder '%s', repo '%s'"
"failed (error). Server reponded: %s\nMessage content was: " "failed (error). Server responded: %s\nMessage content was: "
"%s" % (self, self.getrepository(), str(e), dbg_output), "%s" % (self, self.getrepository(), str(e), dbg_output),
OfflineImapError.ERROR.MESSAGE) OfflineImapError.ERROR.MESSAGE)
# Checkpoint. Let it write out stuff, etc. Eg searches for # Checkpoint. Let it write out stuff, etc. Eg searches for

View File

@ -148,6 +148,13 @@ class IMAPRepository(BaseRepository):
def getport(self): def getport(self):
port = None
if self.config.has_option(self.getsection(), 'remoteporteval'):
port = self.getconf('remoteporteval')
if port != None:
return self.localeval.eval(port)
return self.getconfint('remoteport', None) return self.getconfint('remoteport', None)
def getssl(self): def getssl(self):