public synchronized void checkForMail(String key) throws PasswordException, IOException, GeneralSecurityException { if (!isCheckingForMail()) { previousMailCheckTime = lastMailCheckTime; lastMailCheckTime = System.currentTimeMillis(); } EmailIdentity identity = identities.get(key); if (identity != null) checkForMail(identity); }
public void remove(String key) throws PasswordException, IOException, GeneralSecurityException { initializeIfNeeded(); EmailIdentity identity = get(key); if (identity != null) { identities.remove(identity); // if we deleted the default identity, set a new default if (identity.isDefaultIdentity() && !identities.isEmpty()) identities.iterator().next().setDefaultIdentity(true); // when the last identity is deleted, remove the file; see isEmpty() if (identities.isEmpty() && !identitiesFile.delete()) log.error("Can't delete file: " + identitiesFile.getAbsolutePath()); for (IdentitiesListener listener : identitiesListeners) listener.identityRemoved(key); } }
public static EmailIdentity getIdentity(String key) throws PasswordException, IOException, GeneralSecurityException { return I2PBote.getInstance().getIdentities().get(key); }
/** * Looks for a Base64-encoded Email Destination in a string and returns * the identity that matches the Email Destination. If no Email Destination * is found, or if it doesn't match any Email Identity, <code>null</code> * is returned. * @param address * @throws PasswordException * @throws GeneralSecurityException * @throws IOException */ public EmailIdentity extractIdentity(String address) throws PasswordException, IOException, GeneralSecurityException { initializeIfNeeded(); String destinationStr = EmailDestination.extractBase64Dest(address); if (destinationStr != null) return get(destinationStr); else return null; }
EmailIdentity identity = identities.get(base64dest); if (identity != null) return identity.getPublicName() + " <" + identity.toBase64() + "@bote>"; // TODO: Make @bote optional
EmailIdentity identity = identities.get(base64dest); if (identity != null) return identity.getPublicName();
/** Publishes an email destination in the address directory. */ public void publishDestination(String destination, byte[] picture, String text) throws PasswordException, IOException, GeneralSecurityException, DhtException, InterruptedException { EmailIdentity identity = identities.get(destination); if (identity != null) { identity.setPicture(picture); identity.setText(text); if (identity.getFingerprint() == null) identity.generateFingerprint(); // if no fingerprint exists, generate one and save it in the next step identities.save(); Contact entry = new Contact(identity, identities, picture, text, identity.getFingerprint()); dht.store(entry); } }
EmailIdentity identity = identities.get(base64dest); if (identity != null) return identity.getPublicName() + " <" + identity.toBase64() + ">";
else { Identities newIdentities = new Identities(identitiesFile, passwordHolder); PublicKey newPublicKey = newIdentities.get(identity).getPublicSigningKey(); PrivateKey newPrivateKey = newIdentities.get(identity).getPrivateSigningKey(); publicKeyChanged = !Arrays.equals(encodedPublicKey, newPublicKey.getEncoded()); privateKeyChanged = !Arrays.equals(encodedPrivateKey, newPrivateKey.getEncoded());
identity = identities.get(key);