Changeset 1283 for trunk/src/org/expeditee/auth/Mail.java
- Timestamp:
- 04/05/19 10:25:31 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/auth/Mail.java
r1277 r1283 2 2 3 3 import java.io.File; 4 import java.io.FileNotFoundException; 4 5 import java.io.IOException; 5 6 import java.nio.file.Path; … … 17 18 import java.sql.SQLException; 18 19 import java.sql.Statement; 20 import java.text.ParseException; 21 import java.text.SimpleDateFormat; 19 22 import java.util.ArrayList; 20 23 import java.util.Arrays; 21 24 import java.util.Base64; 25 import java.util.Date; 22 26 import java.util.HashMap; 23 27 import java.util.List; 24 28 import java.util.Map; 29 import java.util.Scanner; 25 30 26 31 import javax.crypto.BadPaddingException; … … 78 83 PublicKey publicKey = null; 79 84 try { 80 publicKey = Authenticator .getInstance().getPublicKey(colleagueName);85 publicKey = AuthenticatorBrowser.getInstance().getPublicKey(colleagueName); 81 86 } catch (InvalidKeySpecException | NoSuchAlgorithmException | KeyStoreException | CertificateException 82 87 | ClassNotFoundException | IOException | SQLException e) { … … 182 187 } 183 188 184 //String arguments = new String(c.doFinal(Base64.getDecoder().decode(mail.args))); 185 filtered.add(new MailEntry(mail.timestamp, sender, receiverDecrypted, message, message2, options)); 189 Path lastAccessedFile = Paths.get(FrameIO.DEAD_DROPS_PATH).resolve(sender).resolve(name + ".last-accessed"); 190 SimpleDateFormat format = new SimpleDateFormat("ddMMMyyyy[HH:mm]"); 191 MailEntry mailEntry = new MailEntry(mail.timestamp, sender, receiverDecrypted, message, message2, options); 192 try (Scanner in = new Scanner(lastAccessedFile.toFile())) { 193 Date lastAccessedTimestamp = format.parse(in.nextLine()); 194 Date mailTimestamp = format.parse(mail.timestamp); 195 if (mailTimestamp.after(lastAccessedTimestamp)) { 196 filtered.add(mailEntry); 197 } 198 } catch (FileNotFoundException e) { 199 // It may not have been created yet, then err on the safe side and add it in. 200 filtered.add(mailEntry); 201 } catch (ParseException e) { 202 // If we fail to parse, then err on the safe side and add it in. 203 filtered.add(mailEntry); 204 } 205 186 206 } 187 207 }
Note:
See TracChangeset
for help on using the changeset viewer.