Use resend automatically for datasync

This commit is contained in:
Andrea Maria Piana 2020-07-15 08:31:39 +02:00
parent c88df6c1c7
commit e89e36b081
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
2 changed files with 10 additions and 8 deletions

View File

@ -160,7 +160,7 @@ func (p *MessageProcessor) sendPrivate(
messageID := v1protocol.MessageID(&p.identity.PublicKey, wrappedMessage)
if p.featureFlags.Datasync {
if p.featureFlags.Datasync && rawMessage.ResendAutomatically {
if err := p.addToDataSync(recipient, wrappedMessage); err != nil {
return nil, errors.Wrap(err, "failed to send message with datasync")
}

View File

@ -1201,10 +1201,11 @@ func (m *Messenger) ReSendChatMessage(ctx context.Context, messageID string) err
}
_, err = m.dispatchMessage(ctx, &common.RawMessage{
LocalChatID: chat.ID,
Payload: message.Payload,
MessageType: message.MessageType,
Recipients: message.Recipients,
LocalChatID: chat.ID,
Payload: message.Payload,
MessageType: message.MessageType,
Recipients: message.Recipients,
ResendAutomatically: message.ResendAutomatically,
})
return err
}
@ -1402,9 +1403,10 @@ func (m *Messenger) SendChatMessage(ctx context.Context, message *Message) (*Mes
}
id, err := m.dispatchMessage(ctx, &common.RawMessage{
LocalChatID: chat.ID,
Payload: encodedMessage,
MessageType: protobuf.ApplicationMetadataMessage_CHAT_MESSAGE,
LocalChatID: chat.ID,
Payload: encodedMessage,
MessageType: protobuf.ApplicationMetadataMessage_CHAT_MESSAGE,
ResendAutomatically: true,
})
if err != nil {
return nil, err