(self, message)
Copy MH-specific state to message insofar as possible.
Copy MH-specific state to message insofar as possible.
Copy MH - specific state to message insofar as possible .
def _explain_to(self, message):
        """Copy MH-specific state to message insofar as possible."""
        if isinstance(message, MaildirMessage):
            sequences = set(self.get_sequences())
            if 'unseen' in sequences:
                message.set_subdir('cur')
            else:
                message.set_subdir('cur')
                message.add_flag('S')
            if 'flagged' in sequences:
                message.add_flag('F')
            if 'replied' in sequences:
                message.add_flag('R')
        elif isinstance(message, _mboxMMDFMessage):
            sequences = set(self.get_sequences())
            if 'unseen' not in sequences:
                message.add_flag('RO')
            else:
                message.add_flag('O')
            if 'flagged' in sequences:
                message.add_flag('F')
            if 'replied' in sequences:
                message.add_flag('A')
        elif isinstance(message, MHMessage):
            for sequence in self.get_sequences():
                message.add_sequence(sequence)
        elif isinstance(message, BabylMessage):
            sequences = set(self.get_sequences())
            if 'unseen' in sequences:
                message.add_label('unseen')
            if 'replied' in sequences:
                message.add_label('answered')
        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 ) : sequences = set ( self . get_sequences ( ) ) if 'unseen' in sequences : message . set_subdir ( 'cur' ) else : message . set_subdir ( 'cur' ) message . add_flag ( 'S' ) if 'flagged' in sequences : message . add_flag ( 'F' ) if 'replied' in sequences : message . add_flag ( 'R' ) elif isinstance ( message , _mboxMMDFMessage ) : sequences = set ( self . get_sequences ( ) ) if 'unseen' not in sequences : message . add_flag ( 'RO' ) else : message . add_flag ( 'O' ) if 'flagged' in sequences : message . add_flag ( 'F' ) if 'replied' in sequences : message . add_flag ( 'A' ) elif isinstance ( message , MHMessage ) : for sequence in self . get_sequences ( ) : message . add_sequence ( sequence ) elif isinstance ( message , BabylMessage ) : sequences = set ( self . get_sequences ( ) ) if 'unseen' in sequences : message . add_label ( 'unseen' ) if 'replied' in sequences : message . add_label ( 'answered' ) elif isinstance ( message , Message ) : pass else : raise TypeError ( 'Cannot convert to specified type: %s' % type ( message ) )