mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Contact config - message expiration time (#308)
Co-authored-by: Matus Kosut <matus.kosut@ntnu.no>
This commit is contained in:
parent
1e0aa8929d
commit
b382a4260b
3 changed files with 35 additions and 4 deletions
|
@ -758,10 +758,23 @@ public class Manager implements Closeable {
|
|||
/**
|
||||
* Change the expiration timer for a contact
|
||||
*/
|
||||
public void setExpirationTimer(SignalServiceAddress address, int messageExpirationTimer) {
|
||||
ContactInfo c = account.getContactStore().getContact(address);
|
||||
c.messageExpirationTime = messageExpirationTimer;
|
||||
account.getContactStore().updateContact(c);
|
||||
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);
|
||||
account.save();
|
||||
messageBuilder.withExpiration(messageExpirationTimer);
|
||||
messageBuilder.asExpirationUpdate();
|
||||
sendMessage(messageBuilder, Collections.singleton(address));
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the expiration timer for a contact
|
||||
*/
|
||||
public void setExpirationTimer(String number, int messageExpirationTimer) throws IOException, InvalidNumberException {
|
||||
SignalServiceAddress address = canonicalizeAndResolveSignalServiceAddress(number);
|
||||
setExpirationTimer(address, messageExpirationTimer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue