Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Darker935 authored Jun 26, 2024
1 parent 22f892a commit d8a7942
Showing 1 changed file with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package it.auties.whatsapp.model.message.model;

import it.auties.protobuf.annotation.ProtobufEnumIndex;
import it.auties.protobuf.annotation.ProtobufMessageName;
import it.auties.protobuf.annotation.ProtobufProperty;
import it.auties.protobuf.model.ProtobufEnum;
import it.auties.protobuf.model.ProtobufMessage;
import it.auties.protobuf.model.ProtobufType;
import it.auties.whatsapp.model.info.MessageAddOnContextInfo;
import it.auties.whatsapp.model.jid.Jid;
import it.auties.whatsapp.util.Clock;

import java.time.ZonedDateTime;
import java.util.Optional;


/**
* A model class that represents an ephemeral message that was saved manually by the user in a chat
*/
@ProtobufMessageName("PinInChat")
public record PinInChat(
@ProtobufProperty(index = 1, type = ProtobufType.OBJECT)
Type pinType,
@ProtobufProperty(index = 2, type = ProtobufType.OBJECT)
ChatMessageKey key,
@ProtobufProperty(index = 3, type = ProtobufType.INT64)
long clientTimestampInMilliseconds,
@ProtobufProperty(index = 4, type = ProtobufType.INT64)
long serverTimestampMilliseconds,
@ProtobufProperty(index = 5, type = ProtobufType.OBJECT)
MessageAddOnContextInfo messageAddOnContextInfo
) implements ProtobufMessage {
public Optional<ZonedDateTime> serverTimestamp() { return Clock.parseMilliseconds(serverTimestampMilliseconds); }

public Optional<ZonedDateTime> clientTimestamp() { return Clock.parseMilliseconds(clientTimestampInMilliseconds); }

public enum Type implements ProtobufEnum {
UNKNOWN_TYPE(0),
PIN_FOR_ALL(1),
UNDO_PIN_FOR_ALL(2);

final int index;

Type(@ProtobufEnumIndex int index) { this.index = index; }

public int index() { return index; }
}
}

0 comments on commit d8a7942

Please sign in to comment.