-
Notifications
You must be signed in to change notification settings - Fork 244
/
delete_message.go
51 lines (39 loc) · 1.48 KB
/
delete_message.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package protocol
import (
"crypto/ecdsa"
"github.com/golang/protobuf/proto"
"github.com/status-im/status-go/protocol/protobuf"
)
// DeleteMessage represents a delete of a message from a user in the application layer, used for persistence, querying and
// signaling
type DeleteMessage struct {
*protobuf.DeleteMessage
// ID is the ID of the message that has been edited
ID string `json:"id,omitempty"`
// From is a public key of the author of the edit reaction.
From string `json:"from,omitempty"`
// SigPubKey is the ecdsa encoded public key of the edit author
SigPubKey *ecdsa.PublicKey `json:"-"`
}
func NewDeleteMessage() *DeleteMessage {
return &DeleteMessage{DeleteMessage: &protobuf.DeleteMessage{}}
}
// GetSigPubKey returns an ecdsa encoded public key
// this function is required to implement the ChatEntity interface
func (e *DeleteMessage) GetSigPubKey() *ecdsa.PublicKey {
return e.SigPubKey
}
// GetProtoBuf returns the struct's embedded protobuf struct
// this function is required to implement the ChatEntity interface
func (e *DeleteMessage) GetProtobuf() proto.Message {
return e.DeleteMessage
}
// SetMessageType a setter for the MessageType field
// this function is required to implement the ChatEntity interface
func (e *DeleteMessage) SetMessageType(messageType protobuf.MessageType) {
e.MessageType = messageType
}
// WrapGroupMessage indicates whether we should wrap this in membership information
func (e *DeleteMessage) WrapGroupMessage() bool {
return false
}