All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.auties.whatsapp.model.chat.ChatSpec Maven / Gradle / Ivy

package it.auties.whatsapp.model.chat;

import it.auties.whatsapp.model.chat.Chat;
import it.auties.protobuf.stream.ProtobufInputStream;
import it.auties.protobuf.stream.ProtobufOutputStream;
import it.auties.protobuf.model.ProtobufWireType;

public class ChatSpec {
    public static byte[] encode(Chat protoInputObject) {
        if (protoInputObject == null) {
            return null;
        }
        var outputStream = new ProtobufOutputStream(sizeOf(protoInputObject));
        var jid = protoInputObject.jid;
        if (jid != null) {
            var jid0 = jid.toString();
            if (jid0 != null) {
                outputStream.writeString(1, jid0);
            }
        }
        if (protoInputObject.historySyncMessages != null) {
            for (var historySyncMessagesEntry : protoInputObject.historySyncMessages) { 
                outputStream.writeBytes(2, it.auties.whatsapp.model.sync.HistorySyncMessageSpec.encode(historySyncMessagesEntry));
            }
        }
        var newJid = protoInputObject.newJid;
        if (newJid != null) {
            var newJid0 = newJid.toString();
            if (newJid0 != null) {
                outputStream.writeString(3, newJid0);
            }
        }
        var oldJid = protoInputObject.oldJid;
        if (oldJid != null) {
            var oldJid0 = oldJid.toString();
            if (oldJid0 != null) {
                outputStream.writeString(4, oldJid0);
            }
        }
        outputStream.writeUInt32(6, protoInputObject.unreadMessagesCount);
        outputStream.writeBool(7, protoInputObject.readOnly);
        outputStream.writeBool(8, protoInputObject.endOfHistoryTransfer);
        var ephemeralMessageDuration = protoInputObject.ephemeralMessageDuration;
        if (ephemeralMessageDuration != null) {
            var ephemeralMessageDuration0 = ephemeralMessageDuration.periodSeconds();
            outputStream.writeUInt32(9, ephemeralMessageDuration0);
        }
        outputStream.writeInt64(10, protoInputObject.ephemeralMessagesToggleTimeSeconds);
        outputStream.writeInt32(11, it.auties.whatsapp.model.chat.ChatEndOfHistoryTransferTypeSpec.encode(protoInputObject.endOfHistoryTransferType));
        outputStream.writeUInt64(12, protoInputObject.timestampSeconds);
        outputStream.writeString(13, protoInputObject.name);
        outputStream.writeBool(15, protoInputObject.notSpam);
        outputStream.writeBool(16, protoInputObject.archived);
        outputStream.writeBytes(17, it.auties.whatsapp.model.chat.ChatDisappearSpec.encode(protoInputObject.disappearInitiator));
        outputStream.writeBool(19, protoInputObject.markedAsUnread);
        if (protoInputObject.participants != null) {
            for (var participantsEntry : protoInputObject.participants) { 
                outputStream.writeBytes(20, it.auties.whatsapp.model.chat.GroupParticipantSpec.encode(participantsEntry));
            }
        }
        outputStream.writeBytes(21, protoInputObject.token);
        outputStream.writeUInt64(22, protoInputObject.tokenTimestampSeconds);
        outputStream.writeBytes(23, protoInputObject.identityKey);
        outputStream.writeUInt32(24, protoInputObject.pinnedTimestampSeconds);
        var mute = protoInputObject.mute;
        if (mute != null) {
            var mute0 = mute.endTimeStamp();
            outputStream.writeUInt64(25, mute0);
        }
        outputStream.writeBytes(26, it.auties.whatsapp.model.chat.ChatWallpaperSpec.encode(protoInputObject.wallpaper));
        outputStream.writeInt32(27, it.auties.whatsapp.model.media.MediaVisibilitySpec.encode(protoInputObject.mediaVisibility));
        outputStream.writeUInt64(28, protoInputObject.tokenSenderTimestampSeconds);
        outputStream.writeBool(29, protoInputObject.suspended);
        outputStream.writeBool(30, protoInputObject.terminated);
        outputStream.writeUInt64(31, protoInputObject.foundationTimestampSeconds);
        var founder = protoInputObject.founder;
        if (founder != null) {
            var founder0 = founder.toString();
            if (founder0 != null) {
                outputStream.writeString(32, founder0);
            }
        }
        outputStream.writeString(33, protoInputObject.description);
        outputStream.writeBool(34, protoInputObject.support);
        outputStream.writeBool(35, protoInputObject.parentGroup);
        outputStream.writeBool(36, protoInputObject.defaultSubGroup);
        var parentGroupJid = protoInputObject.parentGroupJid;
        if (parentGroupJid != null) {
            var parentGroupJid0 = parentGroupJid.toString();
            if (parentGroupJid0 != null) {
                outputStream.writeString(37, parentGroupJid0);
            }
        }
        outputStream.writeString(38, protoInputObject.displayName);
        var phoneJid = protoInputObject.phoneJid;
        if (phoneJid != null) {
            var phoneJid0 = phoneJid.toString();
            if (phoneJid0 != null) {
                outputStream.writeString(39, phoneJid0);
            }
        }
        outputStream.writeBool(40, protoInputObject.shareOwnPhoneNumber);
        outputStream.writeBool(41, protoInputObject.pnhDuplicateLidThread);
        var lidJid = protoInputObject.lidJid;
        if (lidJid != null) {
            var lidJid0 = lidJid.toString();
            if (lidJid0 != null) {
                outputStream.writeString(42, lidJid0);
            }
        }
        if (protoInputObject.presences != null) {
            for (var presencesEntry : protoInputObject.presences.entrySet()) { 
                var presencesOutputStream = new ProtobufOutputStream(sizeOfPresences(presencesEntry));
                var presences = presencesEntry.getKey();
                if (presences != null) {
                    var presences0 = presences.toString();
                    if (presences0 != null) {
                        presencesOutputStream.writeString(1, presences0);
                    }
                }
                presencesOutputStream.writeInt32(2, it.auties.whatsapp.model.contact.ContactStatusSpec.encode(presencesEntry.getValue()));
                outputStream.writeBytes(999, presencesOutputStream.toByteArray());
            }
        }
        if (protoInputObject.participantsPreKeys != null) {
            for (var participantsPreKeysEntry : protoInputObject.participantsPreKeys) { 
                var participantsPreKeys = participantsPreKeysEntry;
                if (participantsPreKeys != null) {
                    var participantsPreKeys0 = participantsPreKeys.toString();
                    if (participantsPreKeys0 != null) {
                        outputStream.writeString(1000, participantsPreKeys0);
                    }
                }
            }
        }
        if (protoInputObject.pastParticipants != null) {
            for (var pastParticipantsEntry : protoInputObject.pastParticipants) { 
                outputStream.writeBytes(1001, it.auties.whatsapp.model.chat.GroupPastParticipantSpec.encode(pastParticipantsEntry));
            }
        }
        return outputStream.toByteArray();
    }

    public static Chat decode(byte[] input) {
        if (input == null) {
            return null;
        }
        var protoInputStream = new ProtobufInputStream(input);
        it.auties.whatsapp.model.jid.Jid jid = null;
        it.auties.whatsapp.util.ConcurrentLinkedSet historySyncMessages = new it.auties.whatsapp.util.ConcurrentLinkedSet();
        it.auties.whatsapp.model.jid.Jid newJid = null;
        it.auties.whatsapp.model.jid.Jid oldJid = null;
        int unreadMessagesCount = 0;
        boolean readOnly = false;
        boolean endOfHistoryTransfer = false;
        it.auties.whatsapp.model.chat.ChatEphemeralTimer ephemeralMessageDuration = null;
        long ephemeralMessagesToggleTimeSeconds = 0l;
        it.auties.whatsapp.model.chat.Chat.EndOfHistoryTransferType endOfHistoryTransferType = null;
        long timestampSeconds = 0l;
        java.lang.String name = null;
        boolean notSpam = false;
        boolean archived = false;
        it.auties.whatsapp.model.chat.ChatDisappear disappearInitiator = null;
        boolean markedAsUnread = false;
        java.util.List participants = it.auties.protobuf.builtin.ProtobufRepeatedMixin.newList();
        byte[] token = null;
        long tokenTimestampSeconds = 0l;
        byte[] identityKey = null;
        int pinnedTimestampSeconds = 0;
        it.auties.whatsapp.model.chat.ChatMute mute = null;
        it.auties.whatsapp.model.chat.ChatWallpaper wallpaper = null;
        it.auties.whatsapp.model.media.MediaVisibility mediaVisibility = null;
        long tokenSenderTimestampSeconds = 0l;
        boolean suspended = false;
        boolean terminated = false;
        long foundationTimestampSeconds = 0l;
        it.auties.whatsapp.model.jid.Jid founder = null;
        java.lang.String description = null;
        boolean support = false;
        boolean parentGroup = false;
        boolean defaultSubGroup = false;
        it.auties.whatsapp.model.jid.Jid parentGroupJid = null;
        java.lang.String displayName = null;
        it.auties.whatsapp.model.jid.Jid phoneJid = null;
        boolean shareOwnPhoneNumber = false;
        boolean pnhDuplicateLidThread = false;
        it.auties.whatsapp.model.jid.Jid lidJid = null;
        java.util.concurrent.ConcurrentHashMap presences = new java.util.concurrent.ConcurrentHashMap();
        java.util.Set participantsPreKeys = it.auties.protobuf.builtin.ProtobufRepeatedMixin.newSet();
        java.util.Set pastParticipants = it.auties.protobuf.builtin.ProtobufRepeatedMixin.newSet();
        while (protoInputStream.readTag()) {
            var protoFieldIndex = protoInputStream.index();
            switch (protoFieldIndex) {
                case 1 -> jid = it.auties.whatsapp.model.jid.Jid.ofProtobuf(protoInputStream.readString());
                case 2 -> historySyncMessages.add(it.auties.whatsapp.model.sync.HistorySyncMessageSpec.decode(protoInputStream.readBytes()));
                case 3 -> newJid = it.auties.whatsapp.model.jid.Jid.ofProtobuf(protoInputStream.readString());
                case 4 -> oldJid = it.auties.whatsapp.model.jid.Jid.ofProtobuf(protoInputStream.readString());
                case 6 -> unreadMessagesCount = protoInputStream.readInt32();
                case 7 -> readOnly = protoInputStream.readBool();
                case 8 -> endOfHistoryTransfer = protoInputStream.readBool();
                case 9 -> ephemeralMessageDuration = it.auties.whatsapp.model.chat.ChatEphemeralTimer.of(protoInputStream.readInt32());
                case 10 -> ephemeralMessagesToggleTimeSeconds = protoInputStream.readInt64();
                case 11 -> endOfHistoryTransferType = it.auties.whatsapp.model.chat.ChatEndOfHistoryTransferTypeSpec.decode(protoInputStream.readInt32()).orElse(null);
                case 12 -> timestampSeconds = protoInputStream.readInt64();
                case 13 -> name = protoInputStream.readString();
                case 15 -> notSpam = protoInputStream.readBool();
                case 16 -> archived = protoInputStream.readBool();
                case 17 -> disappearInitiator = it.auties.whatsapp.model.chat.ChatDisappearSpec.decode(protoInputStream.readBytes());
                case 19 -> markedAsUnread = protoInputStream.readBool();
                case 20 -> participants.add(it.auties.whatsapp.model.chat.GroupParticipantSpec.decode(protoInputStream.readBytes()));
                case 21 -> token = protoInputStream.readBytes();
                case 22 -> tokenTimestampSeconds = protoInputStream.readInt64();
                case 23 -> identityKey = protoInputStream.readBytes();
                case 24 -> pinnedTimestampSeconds = protoInputStream.readInt32();
                case 25 -> mute = it.auties.whatsapp.model.chat.ChatMute.ofProtobuf(protoInputStream.readInt64());
                case 26 -> wallpaper = it.auties.whatsapp.model.chat.ChatWallpaperSpec.decode(protoInputStream.readBytes());
                case 27 -> mediaVisibility = it.auties.whatsapp.model.media.MediaVisibilitySpec.decode(protoInputStream.readInt32()).orElse(null);
                case 28 -> tokenSenderTimestampSeconds = protoInputStream.readInt64();
                case 29 -> suspended = protoInputStream.readBool();
                case 30 -> terminated = protoInputStream.readBool();
                case 31 -> foundationTimestampSeconds = protoInputStream.readInt64();
                case 32 -> founder = it.auties.whatsapp.model.jid.Jid.ofProtobuf(protoInputStream.readString());
                case 33 -> description = protoInputStream.readString();
                case 34 -> support = protoInputStream.readBool();
                case 35 -> parentGroup = protoInputStream.readBool();
                case 36 -> defaultSubGroup = protoInputStream.readBool();
                case 37 -> parentGroupJid = it.auties.whatsapp.model.jid.Jid.ofProtobuf(protoInputStream.readString());
                case 38 -> displayName = protoInputStream.readString();
                case 39 -> phoneJid = it.auties.whatsapp.model.jid.Jid.ofProtobuf(protoInputStream.readString());
                case 40 -> shareOwnPhoneNumber = protoInputStream.readBool();
                case 41 -> pnhDuplicateLidThread = protoInputStream.readBool();
                case 42 -> lidJid = it.auties.whatsapp.model.jid.Jid.ofProtobuf(protoInputStream.readString());
                case 999 -> {
                    var presencesInputStream = new ProtobufInputStream(protoInputStream.readBytes());
                    it.auties.whatsapp.model.jid.Jid presencesKey = null;
                    it.auties.whatsapp.model.contact.ContactStatus presencesValue = null;
                    while (presencesInputStream.readTag()) {
                        switch (presencesInputStream.index()) {
                            case 1 -> presencesKey = it.auties.whatsapp.model.jid.Jid.ofProtobuf(presencesInputStream.readString());
                            case 2 -> presencesValue = it.auties.whatsapp.model.contact.ContactStatusSpec.decode(presencesInputStream.readInt32()).orElse(null);
                        }
                    }
                    presences.put(presencesKey, presencesValue);
                }
                case 1000 -> participantsPreKeys.add(it.auties.whatsapp.model.jid.Jid.ofProtobuf(protoInputStream.readString()));
                case 1001 -> pastParticipants.add(it.auties.whatsapp.model.chat.GroupPastParticipantSpec.decode(protoInputStream.readBytes()));
                default -> protoInputStream.skipBytes();
            }
        }
        return new it.auties.whatsapp.model.chat.Chat(jid, historySyncMessages, newJid, oldJid, unreadMessagesCount, readOnly, endOfHistoryTransfer, ephemeralMessageDuration, ephemeralMessagesToggleTimeSeconds, endOfHistoryTransferType, timestampSeconds, name, notSpam, archived, disappearInitiator, markedAsUnread, participants, token, tokenTimestampSeconds, identityKey, pinnedTimestampSeconds, mute, wallpaper, mediaVisibility, tokenSenderTimestampSeconds, suspended, terminated, foundationTimestampSeconds, founder, description, support, parentGroup, defaultSubGroup, parentGroupJid, displayName, phoneJid, shareOwnPhoneNumber, pnhDuplicateLidThread, lidJid, presences, participantsPreKeys, pastParticipants);
    }

    public static int sizeOf(Chat object) {
        if (object == null) {
            return 0;
        }
        var protoSize = 0;
        var jid = object.jid;
        if (jid != null) {
            var jid0 = jid.toString();
            if (jid0 != null) {
                protoSize += ProtobufOutputStream.getFieldSize(1, 2);
                protoSize += ProtobufOutputStream.getStringSize(jid0);
            }
        }
        var historySyncMessagesRepeatedField = object.historySyncMessages;
        if (historySyncMessagesRepeatedField != null) {
            for (var historySyncMessagesEntry : historySyncMessagesRepeatedField) { 
                if (historySyncMessagesEntry != null) {
                    protoSize += ProtobufOutputStream.getFieldSize(2, 2);
                    var historySyncMessagesEntrySerializedSize = it.auties.whatsapp.model.sync.HistorySyncMessageSpec.sizeOf(historySyncMessagesEntry);
                    protoSize += ProtobufOutputStream.getVarIntSize(historySyncMessagesEntrySerializedSize);
                    protoSize += historySyncMessagesEntrySerializedSize;
                }
            }
        }
        var newJid = object.newJid;
        if (newJid != null) {
            var newJid0 = newJid.toString();
            if (newJid0 != null) {
                protoSize += ProtobufOutputStream.getFieldSize(3, 2);
                protoSize += ProtobufOutputStream.getStringSize(newJid0);
            }
        }
        var oldJid = object.oldJid;
        if (oldJid != null) {
            var oldJid0 = oldJid.toString();
            if (oldJid0 != null) {
                protoSize += ProtobufOutputStream.getFieldSize(4, 2);
                protoSize += ProtobufOutputStream.getStringSize(oldJid0);
            }
        }
        var unreadMessagesCount = object.unreadMessagesCount;
        protoSize += ProtobufOutputStream.getFieldSize(6, 0);
        protoSize += ProtobufOutputStream.getVarIntSize(unreadMessagesCount);
        var readOnly = object.readOnly;
        protoSize += ProtobufOutputStream.getFieldSize(7, 0);
        protoSize += 1;
        var endOfHistoryTransfer = object.endOfHistoryTransfer;
        protoSize += ProtobufOutputStream.getFieldSize(8, 0);
        protoSize += 1;
        var ephemeralMessageDuration = object.ephemeralMessageDuration;
        if (ephemeralMessageDuration != null) {
            var ephemeralMessageDuration0 = ephemeralMessageDuration.periodSeconds();
            protoSize += ProtobufOutputStream.getFieldSize(9, 0);
            protoSize += ProtobufOutputStream.getVarIntSize(ephemeralMessageDuration0);
        }
        var ephemeralMessagesToggleTimeSeconds = object.ephemeralMessagesToggleTimeSeconds;
        protoSize += ProtobufOutputStream.getFieldSize(10, 0);
        protoSize += ProtobufOutputStream.getVarIntSize(ephemeralMessagesToggleTimeSeconds);
        var endOfHistoryTransferType = object.endOfHistoryTransferType;
        if (endOfHistoryTransferType != null) {
            protoSize += ProtobufOutputStream.getFieldSize(11, 2);
            var endOfHistoryTransferTypeSerializedSize = it.auties.whatsapp.model.chat.ChatEndOfHistoryTransferTypeSpec.sizeOf(endOfHistoryTransferType);
            protoSize += endOfHistoryTransferTypeSerializedSize;
        }
        var timestampSeconds = object.timestampSeconds;
        protoSize += ProtobufOutputStream.getFieldSize(12, 0);
        protoSize += ProtobufOutputStream.getVarIntSize(timestampSeconds);
        var name = object.name;
        if (name != null) {
            protoSize += ProtobufOutputStream.getFieldSize(13, 2);
            protoSize += ProtobufOutputStream.getStringSize(name);
        }
        var notSpam = object.notSpam;
        protoSize += ProtobufOutputStream.getFieldSize(15, 0);
        protoSize += 1;
        var archived = object.archived;
        protoSize += ProtobufOutputStream.getFieldSize(16, 0);
        protoSize += 1;
        var disappearInitiator = object.disappearInitiator;
        if (disappearInitiator != null) {
            protoSize += ProtobufOutputStream.getFieldSize(17, 2);
            var disappearInitiatorSerializedSize = it.auties.whatsapp.model.chat.ChatDisappearSpec.sizeOf(disappearInitiator);
            protoSize += ProtobufOutputStream.getVarIntSize(disappearInitiatorSerializedSize);
            protoSize += disappearInitiatorSerializedSize;
        }
        var markedAsUnread = object.markedAsUnread;
        protoSize += ProtobufOutputStream.getFieldSize(19, 0);
        protoSize += 1;
        var participantsRepeatedField = object.participants;
        if (participantsRepeatedField != null) {
            for (var participantsEntry : participantsRepeatedField) { 
                if (participantsEntry != null) {
                    protoSize += ProtobufOutputStream.getFieldSize(20, 2);
                    var participantsEntrySerializedSize = it.auties.whatsapp.model.chat.GroupParticipantSpec.sizeOf(participantsEntry);
                    protoSize += ProtobufOutputStream.getVarIntSize(participantsEntrySerializedSize);
                    protoSize += participantsEntrySerializedSize;
                }
            }
        }
        var token = object.token;
        if (token != null) {
            protoSize += ProtobufOutputStream.getFieldSize(21, 2);
            protoSize += ProtobufOutputStream.getBytesSize(token);
        }
        var tokenTimestampSeconds = object.tokenTimestampSeconds;
        protoSize += ProtobufOutputStream.getFieldSize(22, 0);
        protoSize += ProtobufOutputStream.getVarIntSize(tokenTimestampSeconds);
        var identityKey = object.identityKey;
        if (identityKey != null) {
            protoSize += ProtobufOutputStream.getFieldSize(23, 2);
            protoSize += ProtobufOutputStream.getBytesSize(identityKey);
        }
        var pinnedTimestampSeconds = object.pinnedTimestampSeconds;
        protoSize += ProtobufOutputStream.getFieldSize(24, 0);
        protoSize += ProtobufOutputStream.getVarIntSize(pinnedTimestampSeconds);
        var mute = object.mute;
        if (mute != null) {
            var mute0 = mute.endTimeStamp();
            protoSize += ProtobufOutputStream.getFieldSize(25, 0);
            protoSize += ProtobufOutputStream.getVarIntSize(mute0);
        }
        var wallpaper = object.wallpaper;
        if (wallpaper != null) {
            protoSize += ProtobufOutputStream.getFieldSize(26, 2);
            var wallpaperSerializedSize = it.auties.whatsapp.model.chat.ChatWallpaperSpec.sizeOf(wallpaper);
            protoSize += ProtobufOutputStream.getVarIntSize(wallpaperSerializedSize);
            protoSize += wallpaperSerializedSize;
        }
        var mediaVisibility = object.mediaVisibility;
        if (mediaVisibility != null) {
            protoSize += ProtobufOutputStream.getFieldSize(27, 2);
            var mediaVisibilitySerializedSize = it.auties.whatsapp.model.media.MediaVisibilitySpec.sizeOf(mediaVisibility);
            protoSize += mediaVisibilitySerializedSize;
        }
        var tokenSenderTimestampSeconds = object.tokenSenderTimestampSeconds;
        protoSize += ProtobufOutputStream.getFieldSize(28, 0);
        protoSize += ProtobufOutputStream.getVarIntSize(tokenSenderTimestampSeconds);
        var suspended = object.suspended;
        protoSize += ProtobufOutputStream.getFieldSize(29, 0);
        protoSize += 1;
        var terminated = object.terminated;
        protoSize += ProtobufOutputStream.getFieldSize(30, 0);
        protoSize += 1;
        var foundationTimestampSeconds = object.foundationTimestampSeconds;
        protoSize += ProtobufOutputStream.getFieldSize(31, 0);
        protoSize += ProtobufOutputStream.getVarIntSize(foundationTimestampSeconds);
        var founder = object.founder;
        if (founder != null) {
            var founder0 = founder.toString();
            if (founder0 != null) {
                protoSize += ProtobufOutputStream.getFieldSize(32, 2);
                protoSize += ProtobufOutputStream.getStringSize(founder0);
            }
        }
        var description = object.description;
        if (description != null) {
            protoSize += ProtobufOutputStream.getFieldSize(33, 2);
            protoSize += ProtobufOutputStream.getStringSize(description);
        }
        var support = object.support;
        protoSize += ProtobufOutputStream.getFieldSize(34, 0);
        protoSize += 1;
        var parentGroup = object.parentGroup;
        protoSize += ProtobufOutputStream.getFieldSize(35, 0);
        protoSize += 1;
        var defaultSubGroup = object.defaultSubGroup;
        protoSize += ProtobufOutputStream.getFieldSize(36, 0);
        protoSize += 1;
        var parentGroupJid = object.parentGroupJid;
        if (parentGroupJid != null) {
            var parentGroupJid0 = parentGroupJid.toString();
            if (parentGroupJid0 != null) {
                protoSize += ProtobufOutputStream.getFieldSize(37, 2);
                protoSize += ProtobufOutputStream.getStringSize(parentGroupJid0);
            }
        }
        var displayName = object.displayName;
        if (displayName != null) {
            protoSize += ProtobufOutputStream.getFieldSize(38, 2);
            protoSize += ProtobufOutputStream.getStringSize(displayName);
        }
        var phoneJid = object.phoneJid;
        if (phoneJid != null) {
            var phoneJid0 = phoneJid.toString();
            if (phoneJid0 != null) {
                protoSize += ProtobufOutputStream.getFieldSize(39, 2);
                protoSize += ProtobufOutputStream.getStringSize(phoneJid0);
            }
        }
        var shareOwnPhoneNumber = object.shareOwnPhoneNumber;
        protoSize += ProtobufOutputStream.getFieldSize(40, 0);
        protoSize += 1;
        var pnhDuplicateLidThread = object.pnhDuplicateLidThread;
        protoSize += ProtobufOutputStream.getFieldSize(41, 0);
        protoSize += 1;
        var lidJid = object.lidJid;
        if (lidJid != null) {
            var lidJid0 = lidJid.toString();
            if (lidJid0 != null) {
                protoSize += ProtobufOutputStream.getFieldSize(42, 2);
                protoSize += ProtobufOutputStream.getStringSize(lidJid0);
            }
        }
        var presencesMapField = object.presences;
        if (presencesMapField != null) {
            for (var presencesMapEntry : presencesMapField.entrySet()) { 
                protoSize += ProtobufOutputStream.getFieldSize(999, 2);
                var presencesMapEntrySize = sizeOfPresences(presencesMapEntry);
                protoSize += ProtobufOutputStream.getVarIntSizeUnsigned(presencesMapEntrySize);
                protoSize += presencesMapEntrySize;
            }
        }
        var participantsPreKeysRepeatedField = object.participantsPreKeys;
        if (participantsPreKeysRepeatedField != null) {
            for (var participantsPreKeysEntry : participantsPreKeysRepeatedField) { 
                if (participantsPreKeysEntry != null) {
                    var participantsPreKeysEntry0 = participantsPreKeysEntry.toString();
                    if (participantsPreKeysEntry0 != null) {
                        protoSize += ProtobufOutputStream.getFieldSize(1000, 2);
                        protoSize += ProtobufOutputStream.getStringSize(participantsPreKeysEntry0);
                    }
                }
            }
        }
        var pastParticipantsRepeatedField = object.pastParticipants;
        if (pastParticipantsRepeatedField != null) {
            for (var pastParticipantsEntry : pastParticipantsRepeatedField) { 
                if (pastParticipantsEntry != null) {
                    protoSize += ProtobufOutputStream.getFieldSize(1001, 2);
                    var pastParticipantsEntrySerializedSize = it.auties.whatsapp.model.chat.GroupPastParticipantSpec.sizeOf(pastParticipantsEntry);
                    protoSize += ProtobufOutputStream.getVarIntSize(pastParticipantsEntrySerializedSize);
                    protoSize += pastParticipantsEntrySerializedSize;
                }
            }
        }
        return protoSize;
    }

    private static int sizeOfPresences(java.util.Map.Entry object) {
        var protoSize = 0;
        var objectMapKey = object.getKey();
        var objectMapKey0 = objectMapKey.toString();
        if (objectMapKey0 != null) {
            protoSize += ProtobufOutputStream.getFieldSize(1, 2);
            protoSize += ProtobufOutputStream.getStringSize(objectMapKey0);
        }
        var presencesMapValue = object.getValue();
        if (presencesMapValue != null) {
            protoSize += ProtobufOutputStream.getFieldSize(2, 2);
            var presencesMapValueSerializedSize = it.auties.whatsapp.model.contact.ContactStatusSpec.sizeOf(presencesMapValue);
            protoSize += presencesMapValueSerializedSize;
        }
        return protoSize;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy