initial
This commit is contained in:
		
						commit
						44182ddd45
					
				@ -60,16 +60,17 @@ class SmtpFileStore(object):
 | 
			
		||||
 | 
			
		||||
class MailDirStore(object):
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
        from serpent.imap import mailbox
 | 
			
		||||
        import mailbox
 | 
			
		||||
        self.mbox = mailbox
 | 
			
		||||
    def deliver(self, user, message):
 | 
			
		||||
        mdir = os.path.join(conf.app_dir, conf.maildir_user_path % user)
 | 
			
		||||
        if not os.path.exists(mdir):
 | 
			
		||||
            os.makedirs(mdir)
 | 
			
		||||
        inbox = os.path.join(mdir, 'INBOX')
 | 
			
		||||
        mailbox = self.mbox.IMAPMailbox(inbox)
 | 
			
		||||
        mailbox = self.mbox.Maildir(inbox)
 | 
			
		||||
        msg = self.mbox.MaildirMessage(message)
 | 
			
		||||
        try:
 | 
			
		||||
            mailbox.addMessage(message, [IMAP_FLAGS['RECENT']])
 | 
			
		||||
            mailbox.add(msg, [])
 | 
			
		||||
            return True
 | 
			
		||||
        except:
 | 
			
		||||
            raise
 | 
			
		||||
 | 
			
		||||
@ -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