Skip to content

Commit

Permalink
Add support for versioned expire timers
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesús Higueras committed Sep 15, 2024
1 parent 4916dcf commit 086ced7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
26 changes: 14 additions & 12 deletions libsignal-service/protobuf/SignalService.proto
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ message DataMessage {
optional GroupContextV2 groupV2 = 15;
optional uint32 flags = 4;
optional uint32 expireTimer = 5;
optional uint32 expireTimerVersion = 23;
optional bytes profileKey = 6;
optional uint64 timestamp = 7;
optional Quote quote = 8;
Expand Down Expand Up @@ -792,17 +793,18 @@ message ContactDetails {
optional uint32 length = 2;
}

optional string number = 1;
optional string aci = 9;
optional string name = 2;
optional Avatar avatar = 3;
optional string color = 4;
optional Verified verified = 5;
optional bytes profileKey = 6;
reserved /*blocked*/ 7;
optional uint32 expireTimer = 8;
optional uint32 inboxPosition = 10;
optional bool archived = 11;
optional string number = 1;
optional string aci = 9;
optional string name = 2;
optional Avatar avatar = 3;
optional string color = 4;
optional Verified verified = 5;
optional bytes profileKey = 6;
reserved /*blocked*/ 7;
optional uint32 expireTimer = 8;
optional uint32 expireTimerVersion = 12;
optional uint32 inboxPosition = 10;
optional bool archived = 11;
}

message GroupDetails {
Expand Down Expand Up @@ -854,4 +856,4 @@ message PniSignatureMessage {
message EditMessage {
optional uint64 targetSentTimestamp = 1;
optional DataMessage dataMessage = 2;
}
}
2 changes: 2 additions & 0 deletions libsignal-service/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub struct Contact {
pub verified: Verified,
pub profile_key: Vec<u8>,
pub expire_timer: u32,
pub expire_timer_version: u32,
pub inbox_position: u32,
pub archived: bool,
#[serde(skip)]
Expand Down Expand Up @@ -69,6 +70,7 @@ impl Contact {
verified: contact_details.verified.clone().unwrap_or_default(),
profile_key: contact_details.profile_key().to_vec(),
expire_timer: contact_details.expire_timer(),
expire_timer_version: contact_details.expire_timer_version(),
inbox_position: contact_details.inbox_position(),
archived: contact_details.archived(),
avatar: contact_details.avatar.and_then(|avatar| {
Expand Down
6 changes: 5 additions & 1 deletion libsignal-service/src/push_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,16 @@ pub struct LinkAccountAttributes {
#[serde(rename_all = "camelCase")]
pub struct LinkCapabilities {
pub delete_sync: bool,
pub versioned_expiration_timer: bool,
}

// https://github.com/signalapp/Signal-Desktop/blob/1e57db6aa4786dcddc944349e4894333ac2ffc9e/ts/textsecure/WebAPI.ts#L1287
impl Default for LinkCapabilities {
fn default() -> Self {
Self { delete_sync: true }
Self {
delete_sync: true,
versioned_expiration_timer: true,
}
}
}

Expand Down

0 comments on commit 086ced7

Please sign in to comment.