Added emoji reaction message type validation

This commit is contained in:
Samuel Hawksby-Robinson 2020-07-10 14:07:26 +01:00 committed by Andrea Maria Piana
parent 154a169ffb
commit a0e7e0751c
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
1 changed files with 21 additions and 0 deletions

View File

@ -204,6 +204,27 @@ func ValidateReceivedChatMessage(message *protobuf.ChatMessage, whisperTimestamp
if image.Type == protobuf.ImageMessage_UNKNOWN_IMAGE_TYPE {
return errors.New("image type unknown")
}
case protobuf.ChatMessage_EMOJI_REACTION:
if message.Payload == nil {
return errors.New("no emoji reaction data")
}
emojiR := message.GetEmojiReaction()
if emojiR == nil {
return errors.New("no emoji reaction data")
}
if emojiR.Type == protobuf.EmojiReaction_UNKNOWN_EMOJI_REACTION_TYPE {
return errors.New("emoji reaction type unknown")
}
case protobuf.ChatMessage_EMOJI_REACTION_RETRACTION:
if message.Payload == nil {
return errors.New("no emoji reaction retraction data")
}
emojiRR := message.GetEmojiReactionRetraction()
if emojiRR == nil {
return errors.New("no emoji reaction retraction data")
}
}
if message.ContentType == protobuf.ChatMessage_AUDIO {