logger.debug("Received invalid message from blocked contact, ignoring.");
} else {
final var senderProfile = context.getProfileHelper().getRecipientProfile(sender);
- final var selfProfile = context.getProfileHelper()
- .getRecipientProfile(account.getSelfRecipientId());
+ final var selfProfile = context.getProfileHelper().getSelfProfile();
if ((!sender.equals(account.getSelfRecipientId()) || e.getSenderDevice() != account.getDeviceId())
&& senderProfile != null
&& senderProfile.getCapabilities().contains(Profile.Capability.senderKey)
String aboutEmoji,
Optional<File> avatar
) throws IOException {
- var profile = getRecipientProfile(account.getSelfRecipientId());
+ var profile = getSelfProfile();
var builder = profile == null ? Profile.newBuilder() : Profile.newBuilder(profile);
if (givenName != null) {
builder.withGivenName(givenName);
account.getProfileStore().storeProfile(account.getSelfRecipientId(), newProfile);
}
+ public Profile getSelfProfile() {
+ return getRecipientProfile(account.getSelfRecipientId());
+ }
+
public List<Profile> getRecipientProfile(List<RecipientId> recipientIds) {
try {
account.getRecipientStore().setBulkUpdating(true);
}
private Set<RecipientId> getSenderKeyCapableRecipientIds(final Set<RecipientId> recipientIds) {
- final var selfProfile = context.getProfileHelper().getRecipientProfile(account.getSelfRecipientId());
+ final var selfProfile = context.getProfileHelper().getSelfProfile();
if (selfProfile == null || !selfProfile.getCapabilities().contains(Profile.Capability.senderKey)) {
logger.debug("Not all of our devices support sender key. Using legacy.");
return Set.of();
private byte[] getSelfUnidentifiedAccessKey(boolean noRefresh) {
var selfProfile = noRefresh
? account.getProfileStore().getProfile(account.getSelfRecipientId())
- : context.getProfileHelper().getRecipientProfile(account.getSelfRecipientId());
+ : context.getProfileHelper().getSelfProfile();
if (selfProfile != null
&& selfProfile.getUnidentifiedAccessMode() == Profile.UnidentifiedAccessMode.UNRESTRICTED) {
return createUnrestrictedUnidentifiedAccess();