mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Extract sending of expiration timer update to separate method
This commit is contained in:
parent
e048b1886d
commit
1aba9f370e
1 changed files with 6 additions and 3 deletions
|
@ -759,13 +759,16 @@ public class Manager implements Closeable {
|
|||
* Change the expiration timer for a contact
|
||||
*/
|
||||
public void setExpirationTimer(SignalServiceAddress address, int messageExpirationTimer) throws IOException {
|
||||
final SignalServiceDataMessage.Builder messageBuilder = SignalServiceDataMessage.newBuilder();
|
||||
ContactInfo contact = account.getContactStore().getContact(address);
|
||||
contact.messageExpirationTime = messageExpirationTimer;
|
||||
account.getContactStore().updateContact(contact);
|
||||
sendExpirationTimerUpdate(address);
|
||||
account.save();
|
||||
messageBuilder.withExpiration(messageExpirationTimer);
|
||||
messageBuilder.asExpirationUpdate();
|
||||
}
|
||||
|
||||
private void sendExpirationTimerUpdate(SignalServiceAddress address) throws IOException {
|
||||
final SignalServiceDataMessage.Builder messageBuilder = SignalServiceDataMessage.newBuilder()
|
||||
.asExpirationUpdate();
|
||||
sendMessage(messageBuilder, Collections.singleton(address));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue