imap mech

mailbox
inpos 2016-06-08 22:46:13 +03:00
parent c98032ebe8
commit 5ac9c36546
2 changed files with 9 additions and 11 deletions

View File

@ -9,7 +9,7 @@ from twisted.internet import protocol, ssl
from twisted.mail import imap4 from twisted.mail import imap4
from serpent.config import conf from serpent.config import conf
from serpent.imap.mbox import IMAPMailbox from serpent.imap.mbox import ExtendedMaildir
from serpent.misc import IMAP_HDELIM, IMAP_MBOX_REG, IMAP_ACC_CONN_NUM from serpent.misc import IMAP_HDELIM, IMAP_MBOX_REG, IMAP_ACC_CONN_NUM
from shutil import rmtree, move from shutil import rmtree, move
@ -29,7 +29,7 @@ class IMAPUserAccount(object):
if m not in IMAP_MBOX_REG[self.dir].keys(): if m not in IMAP_MBOX_REG[self.dir].keys():
if isinstance(m, unicode): if isinstance(m, unicode):
m = m.encode('imap4-utf-7') m = m.encode('imap4-utf-7')
IMAP_MBOX_REG[self.dir][m] = IMAPMailbox(os.path.join(self.dir, m)) IMAP_MBOX_REG[self.dir][m] = ExtendedMaildir(os.path.join(self.dir, m))
IMAP_MBOX_REG[self.dir][m]._start_monitor() IMAP_MBOX_REG[self.dir][m]._start_monitor()
self.subscribe(m) self.subscribe(m)
@ -37,7 +37,7 @@ class IMAPUserAccount(object):
if isinstance(path, unicode): if isinstance(path, unicode):
path = path.encode('imap4-utf-7') path = path.encode('imap4-utf-7')
fullPath = os.path.join(self.dir, path) fullPath = os.path.join(self.dir, path)
mbox = IMAPMailbox(fullPath) mbox = ExtendedMaildir(fullPath)
mbox._start_monitor() mbox._start_monitor()
return mbox return mbox
@ -114,8 +114,6 @@ class IMAPUserAccount(object):
move(os.path.join(self.dir, old), os.path.join(self.dir, new)) move(os.path.join(self.dir, old), os.path.join(self.dir, new))
IMAP_MBOX_REG[self.dir][new] = IMAP_MBOX_REG[self.dir][old] IMAP_MBOX_REG[self.dir][new] = IMAP_MBOX_REG[self.dir][old]
IMAP_MBOX_REG[self.dir][new].path = os.path.join(self.dir, new) IMAP_MBOX_REG[self.dir][new].path = os.path.join(self.dir, new)
IMAP_MBOX_REG[self.dir][new].path_msg_info = os.path.join(self.dir, conf.imap_msg_info)
IMAP_MBOX_REG[self.dir][new].path_mbox_info = os.path.join(self.dir, conf.imap_mbox_info)
del IMAP_MBOX_REG[self.dir][old] del IMAP_MBOX_REG[self.dir][old]
return True return True

View File

@ -3,12 +3,12 @@ MSG_ACTIVE = 0
MSG_FROZEN = 1 MSG_FROZEN = 1
IMAP_FLAGS = { IMAP_FLAGS = {
'SEEN': '\\Seen', 'S': '\\Seen',
'FLAGGED': '\\Flagged', 'F': '\\Flagged',
'ANSWERED': '\\Answered', 'P': '\\Passed',
'RECENT': '\\Recent', 'R': '\\Replied',
'DELETED': '\\Deleted', 'T': '\\Trashed',
'DRAFT': '\\Draft' 'D': '\\Draft'
} }
IMAP_HDELIM = '.' IMAP_HDELIM = '.'
IMAP_ACC_CONN_NUM = '...ConnectionNumber...' IMAP_ACC_CONN_NUM = '...ConnectionNumber...'