imap mech
This commit is contained in:
		
							parent
							
								
									c98032ebe8
								
							
						
					
					
						commit
						5ac9c36546
					
				@ -9,7 +9,7 @@ from twisted.internet import protocol, ssl
 | 
			
		||||
from twisted.mail import imap4
 | 
			
		||||
 | 
			
		||||
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 shutil import rmtree, move
 | 
			
		||||
 | 
			
		||||
@ -29,7 +29,7 @@ class IMAPUserAccount(object):
 | 
			
		||||
            if m not in IMAP_MBOX_REG[self.dir].keys():
 | 
			
		||||
                if isinstance(m, unicode):
 | 
			
		||||
                    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()
 | 
			
		||||
                self.subscribe(m)
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,7 @@ class IMAPUserAccount(object):
 | 
			
		||||
        if isinstance(path, unicode):
 | 
			
		||||
            path = path.encode('imap4-utf-7')
 | 
			
		||||
        fullPath = os.path.join(self.dir, path)
 | 
			
		||||
        mbox = IMAPMailbox(fullPath)
 | 
			
		||||
        mbox = ExtendedMaildir(fullPath)
 | 
			
		||||
        mbox._start_monitor()
 | 
			
		||||
        return mbox
 | 
			
		||||
 | 
			
		||||
@ -114,8 +114,6 @@ class IMAPUserAccount(object):
 | 
			
		||||
            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].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]
 | 
			
		||||
        return True
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,12 @@ MSG_ACTIVE = 0
 | 
			
		||||
MSG_FROZEN = 1
 | 
			
		||||
 | 
			
		||||
IMAP_FLAGS = {
 | 
			
		||||
    'SEEN':     '\\Seen',
 | 
			
		||||
    'FLAGGED':  '\\Flagged',
 | 
			
		||||
    'ANSWERED': '\\Answered',
 | 
			
		||||
    'RECENT':   '\\Recent',
 | 
			
		||||
    'DELETED':  '\\Deleted',
 | 
			
		||||
    'DRAFT':    '\\Draft'    
 | 
			
		||||
    'S':     '\\Seen',
 | 
			
		||||
    'F':  '\\Flagged',
 | 
			
		||||
    'P': '\\Passed',
 | 
			
		||||
    'R': '\\Replied',
 | 
			
		||||
    'T':  '\\Trashed',
 | 
			
		||||
    'D':    '\\Draft'    
 | 
			
		||||
    }
 | 
			
		||||
IMAP_HDELIM = '.'
 | 
			
		||||
IMAP_ACC_CONN_NUM = '...ConnectionNumber...'
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user