(self, message)
Copy Maildir-specific state to message insofar as possible.
Copy Maildir-specific state to message insofar as possible.
Copy Maildir - specific state to message insofar as possible .
def _explain_to(self, message):
        """Copy Maildir-specific state to message insofar as possible."""
        if isinstance(message, MaildirMessage):
            message.set_flags(self.get_flags())
            message.set_subdir(self.get_subdir())
            message.set_date(self.get_date())
        elif isinstance(message, _mboxMMDFMessage):
            flags = set(self.get_flags())
            if 'S' in flags:
                message.add_flag('R')
            if self.get_subdir() == 'cur':
                message.add_flag('O')
            if 'T' in flags:
                message.add_flag('D')
            if 'F' in flags:
                message.add_flag('F')
            if 'R' in flags:
                message.add_flag('A')
            message.set_from('MAILER-DAEMON', time.gmtime(self.get_date()))
        elif isinstance(message, MHMessage):
            flags = set(self.get_flags())
            if 'S' not in flags:
                message.add_sequence('unseen')
            if 'R' in flags:
                message.add_sequence('replied')
            if 'F' in flags:
                message.add_sequence('flagged')
        elif isinstance(message, BabylMessage):
            flags = set(self.get_flags())
            if 'S' not in flags:
                message.add_label('unseen')
            if 'T' in flags:
                message.add_label('deleted')
            if 'R' in flags:
                message.add_label('answered')
            if 'P' in flags:
                message.add_label('forwarded')
        elif isinstance(message, Message):
            pass
        else:
            raise TypeError('Cannot convert to specified type: %s' %
                            type(message))
def _explain_to ( self , message ) : if isinstance ( message , MaildirMessage ) : message . set_flags ( self . get_flags ( ) ) message . set_subdir ( self . get_subdir ( ) ) message . set_date ( self . get_date ( ) ) elif isinstance ( message , _mboxMMDFMessage ) : flags = set ( self . get_flags ( ) ) if 'S' in flags : message . add_flag ( 'R' ) if self . get_subdir ( ) == 'cur' : message . add_flag ( 'O' ) if 'T' in flags : message . add_flag ( 'D' ) if 'F' in flags : message . add_flag ( 'F' ) if 'R' in flags : message . add_flag ( 'A' ) message . set_from ( 'MAILER-DAEMON' , time . gmtime ( self . get_date ( ) ) ) elif isinstance ( message , MHMessage ) : flags = set ( self . get_flags ( ) ) if 'S' not in flags : message . add_sequence ( 'unseen' ) if 'R' in flags : message . add_sequence ( 'replied' ) if 'F' in flags : message . add_sequence ( 'flagged' ) elif isinstance ( message , BabylMessage ) : flags = set ( self . get_flags ( ) ) if 'S' not in flags : message . add_label ( 'unseen' ) if 'T' in flags : message . add_label ( 'deleted' ) if 'R' in flags : message . add_label ( 'answered' ) if 'P' in flags : message . add_label ( 'forwarded' ) elif isinstance ( message , Message ) : pass else : raise TypeError ( 'Cannot convert to specified type: %s' % type ( message ) )