Added emoji reaction retraction message type unmarshalling

This commit is contained in:
Samuel Hawksby-Robinson 2020-07-22 13:59:53 +01:00 committed by Andrea Maria Piana
parent 5ee3a0a1b5
commit 5823ebe446
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
2 changed files with 21 additions and 0 deletions

View File

@ -8,6 +8,7 @@ type EmojiReaction struct {
// ID calculated as keccak256(compressedAuthorPubKey, data) where data is unencrypted payload.
ID string
// Clock Lamport timestamp of the chat message
Clock uint64
// MessageID the ID of the target message that the user wishes to react to

View File

@ -410,6 +410,26 @@ func (m *StatusMessage) HandleApplication() error {
return nil
}
case protobuf.ApplicationMetadataMessage_EMOJI_REACTION:
var message protobuf.EmojiReaction
err := proto.Unmarshal(m.DecryptedPayload, &message)
if err != nil {
m.ParsedMessage = nil
log.Printf("[message::DecodeMessage] could not decode EmojiReaction: %#x, err: %v", m.Hash, err.Error())
} else {
m.ParsedMessage = message
return nil
}
case protobuf.ApplicationMetadataMessage_EMOJI_REACTION_RETRACTION:
var message protobuf.EmojiReactionRetraction
err := proto.Unmarshal(m.DecryptedPayload, &message)
if err != nil {
m.ParsedMessage = nil
log.Printf("[message::DecodeMessage] could not decode EmojiReactionRetraction: %#x, err: %v", m.Hash, err.Error())
} else {
m.ParsedMessage = message
return nil
}
}
return nil
}