private byte[] createSentTranscriptMessage(byte[] content, May <SignalServiceAddress> recipient, ulong timestamp) { { try { Content.Builder container = Content.CreateBuilder(); SyncMessage.Builder syncMessage = SyncMessage.CreateBuilder(); SyncMessage.Types.Sent.Builder sentMessage = SyncMessage.Types.Sent.CreateBuilder(); sentMessage.SetTimestamp(timestamp); sentMessage.SetMessage(DataMessage.ParseFrom(content)); if (recipient.HasValue) { sentMessage.SetDestination(recipient.ForceGetValue().getNumber()); } return(container.SetSyncMessage(syncMessage.SetSent(sentMessage)).Build().ToByteArray());; } catch (InvalidProtocolBufferException e) { throw new Exception(e.Message); } } }
private byte[] createMultiDeviceSentTranscriptContent(byte[] content, May <SignalServiceAddress> recipient, ulong timestamp) { try { Content.Builder container = Content.CreateBuilder(); SyncMessage.Builder syncMessage = SyncMessage.CreateBuilder(); SyncMessage.Types.Sent.Builder sentMessage = SyncMessage.Types.Sent.CreateBuilder(); DataMessage dataMessage = DataMessage.ParseFrom(content); sentMessage.SetTimestamp(timestamp); sentMessage.SetMessage(dataMessage); if (recipient.HasValue) { sentMessage.SetDestination(recipient.ForceGetValue().getNumber()); } if (dataMessage.ExpireTimer > 0) { sentMessage.SetExpirationStartTimestamp((ulong)Util.CurrentTimeMillis()); } return(container.SetSyncMessage(syncMessage.SetSent(sentMessage)).Build().ToByteArray()); } catch (InvalidProtocolBufferException e) { throw new Exception(e.Message); } }
private async Task <byte[]> createMultiDeviceGroupsContent(SignalServiceAttachmentStream groups) { Content.Builder container = Content.CreateBuilder(); SyncMessage.Builder builder = SyncMessage.CreateBuilder(); builder.SetGroups(SyncMessage.Types.Groups.CreateBuilder() .SetBlob(await createAttachmentPointer(groups))); return(container.SetSyncMessage(builder).Build().ToByteArray()); }
private async Task <byte[]> createMultiDeviceContactsContent(TextSecureAttachmentStream contacts) { Content.Builder container = Content.CreateBuilder(); SyncMessage.Builder builder = SyncMessage.CreateBuilder(); builder.SetContacts(SyncMessage.Types.Contacts.CreateBuilder() .SetBlob(await createAttachmentPointer(contacts))); return(container.SetSyncMessage(builder).Build().ToByteArray()); }
private byte[] createMultiDeviceBlockedContent(BlockedListMessage blocked) { Content.Builder container = Content.CreateBuilder(); SyncMessage.Builder syncMessage = SyncMessage.CreateBuilder(); SyncMessage.Types.Blocked.Builder blockedMessage = SyncMessage.Types.Blocked.CreateBuilder(); blockedMessage.AddRangeNumbers(blocked.getNumbers()); return(container.SetSyncMessage(syncMessage.SetBlocked(blockedMessage)).Build().ToByteArray()); }
private byte[] createMultiDeviceReadContent(List <ReadMessage> readMessages) { Content.Builder container = Content.CreateBuilder(); SyncMessage.Builder builder = SyncMessage.CreateBuilder(); foreach (ReadMessage readMessage in readMessages) { builder.AddRead(SyncMessage.Types.Read.CreateBuilder() .SetTimestamp((ulong)readMessage.getTimestamp()) .SetSender(readMessage.getSender())); } return(container.SetSyncMessage(builder).Build().ToByteArray()); }