From d8a7942bd3d17f45189ed153a101770e80a6728b Mon Sep 17 00:00:00 2001 From: Quishot WADEV <70950705+Darker935@users.noreply.github.com> Date: Wed, 26 Jun 2024 13:22:54 -0300 Subject: [PATCH] Add files via upload --- .../model/message/model/PinInChat.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/main/java/it/auties/whatsapp/model/message/model/PinInChat.java diff --git a/src/main/java/it/auties/whatsapp/model/message/model/PinInChat.java b/src/main/java/it/auties/whatsapp/model/message/model/PinInChat.java new file mode 100644 index 00000000..de33d0ca --- /dev/null +++ b/src/main/java/it/auties/whatsapp/model/message/model/PinInChat.java @@ -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 serverTimestamp() { return Clock.parseMilliseconds(serverTimestampMilliseconds); } + + public Optional 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; } + } +} \ No newline at end of file