mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Send and handle fetch profile sync message
This commit is contained in:
parent
70690fef36
commit
804ad34a08
1 changed files with 22 additions and 1 deletions
|
@ -363,6 +363,11 @@ public class Manager implements Closeable {
|
|||
avatarStore.deleteProfileAvatar(getSelfAddress());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
sendSyncMessage(SignalServiceSyncMessage.forFetchLatest(SignalServiceSyncMessage.FetchType.LOCAL_PROFILE));
|
||||
} catch (UntrustedIdentityException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
public void unregister() throws IOException {
|
||||
|
@ -493,6 +498,12 @@ public class Manager implements Closeable {
|
|||
|
||||
private SignalProfile getRecipientProfile(
|
||||
SignalServiceAddress address
|
||||
) {
|
||||
return getRecipientProfile(address, false);
|
||||
}
|
||||
|
||||
private SignalProfile getRecipientProfile(
|
||||
SignalServiceAddress address, boolean force
|
||||
) {
|
||||
SignalProfileEntry profileEntry = account.getProfileStore().getProfileEntry(address);
|
||||
if (profileEntry == null) {
|
||||
|
@ -501,7 +512,9 @@ public class Manager implements Closeable {
|
|||
long now = new Date().getTime();
|
||||
// Profiles are cached for 24h before retrieving them again
|
||||
if (!profileEntry.isRequestPending() && (
|
||||
profileEntry.getProfile() == null || now - profileEntry.getLastUpdateTimestamp() > 24 * 60 * 60 * 1000
|
||||
force
|
||||
|| profileEntry.getProfile() == null
|
||||
|| now - profileEntry.getLastUpdateTimestamp() > 24 * 60 * 60 * 1000
|
||||
)) {
|
||||
profileEntry.setRequestPending(true);
|
||||
final SignalServiceProfile encryptedProfile;
|
||||
|
@ -1992,6 +2005,14 @@ public class Manager implements Closeable {
|
|||
account.getStickerStore().updateSticker(sticker);
|
||||
}
|
||||
}
|
||||
if (syncMessage.getFetchType().isPresent()) {
|
||||
switch (syncMessage.getFetchType().get()) {
|
||||
case LOCAL_PROFILE:
|
||||
getRecipientProfile(getSelfAddress(), true);
|
||||
case STORAGE_MANIFEST:
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
if (syncMessage.getConfiguration().isPresent()) {
|
||||
// TODO
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue