Search in sources :

Example 6 with EmailMetadata

use of i2p.bote.email.EmailMetadata in project i2p.i2p-bote by i2p.

the class EmailFolder method setRecent.

public void setRecent(String messageId, boolean isRecent) throws PasswordException, GeneralSecurityException {
    EmailMetadata metadata = getMetadata(messageId);
    metadata.setRecent(isRecent);
    try {
        saveMetadata(metadata, getMetadataFile(messageId));
    } catch (IOException e) {
        log.error("Can't read metadata file for message ID <" + messageId + ">", e);
    }
}
Also used : EmailMetadata(i2p.bote.email.EmailMetadata) IOException(java.io.IOException)

Example 7 with EmailMetadata

use of i2p.bote.email.EmailMetadata in project i2p.i2p-bote by i2p.

the class EmailFolder method setNew.

/**
 * Flags an email "new" (if <code>isNew</code> is <code>true</code>) or
 * "old" (if <code>isNew</code> is <code>false</code>).
 * @param messageId
 * @param isNew
 * @throws GeneralSecurityException
 * @throws PasswordException
 */
public void setNew(String messageId, boolean isNew) throws PasswordException, GeneralSecurityException {
    EmailMetadata metadata = getMetadata(messageId);
    metadata.setUnread(isNew);
    try {
        saveMetadata(metadata, getMetadataFile(messageId));
    } catch (IOException e) {
        log.error("Can't read metadata file for message ID <" + messageId + ">", e);
    }
}
Also used : EmailMetadata(i2p.bote.email.EmailMetadata) IOException(java.io.IOException)

Example 8 with EmailMetadata

use of i2p.bote.email.EmailMetadata in project i2p.i2p-bote by i2p.

the class EmailFolder method getMetadata.

private EmailMetadata getMetadata(File file) throws IOException, GeneralSecurityException, PasswordException {
    InputStream metadataStream = new BufferedInputStream(new EncryptedInputStream(new FileInputStream(file), passwordHolder));
    EmailMetadata metadata = new EmailMetadata(metadataStream);
    return metadata;
}
Also used : EncryptedInputStream(i2p.bote.fileencryption.EncryptedInputStream) BufferedInputStream(java.io.BufferedInputStream) BufferedInputStream(java.io.BufferedInputStream) FileInputStream(java.io.FileInputStream) EncryptedInputStream(i2p.bote.fileencryption.EncryptedInputStream) InputStream(java.io.InputStream) EmailMetadata(i2p.bote.email.EmailMetadata) FileInputStream(java.io.FileInputStream)

Aggregations

EmailMetadata (i2p.bote.email.EmailMetadata)8 IOException (java.io.IOException)5 UniqueId (i2p.bote.UniqueId)1 EmailDestination (i2p.bote.email.EmailDestination)1 EmailIdentity (i2p.bote.email.EmailIdentity)1 PacketInfo (i2p.bote.email.EmailMetadata.PacketInfo)1 EncryptedInputStream (i2p.bote.fileencryption.EncryptedInputStream)1 PasswordException (i2p.bote.fileencryption.PasswordException)1 EmailStatus (i2p.bote.folder.Outbox.EmailStatus)1 DhtException (i2p.bote.network.DhtException)1 EncryptedEmailPacket (i2p.bote.packet.dht.EncryptedEmailPacket)1 IndexPacket (i2p.bote.packet.dht.IndexPacket)1 UnencryptedEmailPacket (i2p.bote.packet.dht.UnencryptedEmailPacket)1 BufferedInputStream (java.io.BufferedInputStream)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 GeneralSecurityException (java.security.GeneralSecurityException)1 MessagingException (javax.mail.MessagingException)1