.offlineimap.py
This commit is contained in:
parent
596a8ceeb3
commit
4d81596791
1 changed files with 42 additions and 0 deletions
|
@ -1,8 +1,50 @@
|
||||||
|
from offlineimap import imaputil
|
||||||
|
|
||||||
|
|
||||||
|
def lld_flagsimap2maildir(flagstring):
|
||||||
|
flagmap = {'\\seen': 'S',
|
||||||
|
'\\answered': 'R',
|
||||||
|
'\\flagged': 'F',
|
||||||
|
'\\deleted': 'T',
|
||||||
|
'\\draft': 'D',
|
||||||
|
'gnus-expire': 'E'}
|
||||||
|
retval = []
|
||||||
|
imapflaglist = [x.lower() for x in flagstring[1:-1].split()]
|
||||||
|
|
||||||
|
for imapflag in imapflaglist:
|
||||||
|
if imapflag in flagmap:
|
||||||
|
retval.append(flagmap[imapflag])
|
||||||
|
|
||||||
|
retval.sort()
|
||||||
|
return set(retval)
|
||||||
|
|
||||||
|
|
||||||
|
def lld_flagsmaildir2imap(list):
|
||||||
|
flagmap = {'S': '\\Seen',
|
||||||
|
'R': '\\Answered',
|
||||||
|
'F': '\\Flagged',
|
||||||
|
'T': '\\Deleted',
|
||||||
|
'D': '\\Draft',
|
||||||
|
'E': 'gnus-expire'}
|
||||||
|
retval = []
|
||||||
|
|
||||||
|
for mdflag in list:
|
||||||
|
if mdflag in flagmap:
|
||||||
|
retval.append(flagmap[mdflag])
|
||||||
|
|
||||||
|
retval.sort()
|
||||||
|
return '(' + ' '.join(retval) + ')'
|
||||||
|
|
||||||
|
imaputil.flagsmaildir2imap = lld_flagsmaildir2imap
|
||||||
|
imaputil.flagsimap2maildir = lld_flagsimap2maildir
|
||||||
|
|
||||||
|
|
||||||
def getuser(host):
|
def getuser(host):
|
||||||
import netrc
|
import netrc
|
||||||
mynet = netrc.netrc()
|
mynet = netrc.netrc()
|
||||||
return mynet.authenticators(host)[0]
|
return mynet.authenticators(host)[0]
|
||||||
|
|
||||||
|
|
||||||
def getpassword(host):
|
def getpassword(host):
|
||||||
import netrc
|
import netrc
|
||||||
mynet = netrc.netrc()
|
mynet = netrc.netrc()
|
||||||
|
|
Loading…
Reference in a new issue