// Profiles are cache for 24h before retrieving them again
if (profileEntry == null || profileEntry.getProfile() == null || now - profileEntry.getLastUpdateTimestamp() > 24 * 60 * 60 * 1000) {
SignalProfile profile = retrieveRecipientProfile(address, unidentifiedAccess, profileKey);
- profileEntry = new SignalProfileEntry(profileKey, now, profile);
- account.getProfileStore().updateProfile(address, profileEntry);
+ account.getProfileStore().updateProfile(address, profileKey, now, profile);
+ return profile;
}
return profileEntry.getProfile();
}
if (!(exception instanceof org.whispersystems.libsignal.UntrustedIdentityException)) {
File cacheFile = null;
try {
- cacheFile = getMessageCacheFile(envelope.getSourceE164().get(), now, envelope.getTimestamp());
+ String source = envelope.getSourceE164().isPresent() ? envelope.getSourceE164().get() : "";
+ cacheFile = getMessageCacheFile(source, now, envelope.getTimestamp());
Files.delete(cacheFile.toPath());
// Try to delete directory if empty
new File(getMessageCachePath()).delete();