mirror of
https://github.com/status-im/status-go.git
synced 2026-08-30 16:41:20 +00:00
Part of the Go project layout migration, item 27. Pure move plus import-path rewrite across 502 files. No API or behaviour change. `internal/` keeps the messaging application logic unimportable from outside the module, which is what the issue asks for -- status-go is consumed through the C-bindings in mobile/, not as a Go library. Things that had to follow the move, beyond the Go imports: - tools/generate-handlers/template.txt. messenger_handlers.go is generated, and the template hard-codes the imports it emits, so the generated file kept importing protocol/common and failed typecheck. - .gitignore. The ignore rule for that generated file was pinned to the old path; without moving it, a 1486-line generated file starts being tracked. - Makefile: the logosstorage and torrent test targets (both the archive packages and ./protocol itself), the archive README, migration-protocol. - scripts/run_unit_tests.sh, which names the protocol package explicitly to shard its tests. - scripts/cleanup_generated_files.sh and .golangci.yml. scripts/migration_check.sh also needed a fix that is not specific to this move: it validated every file the branch touched under a migration dir against the timestamp naming rule, and a directory rename makes every migration in it look newly added. It now excludes renames, so moving a migration is not mistaken for adding one. refs #7067
55 lines
1.6 KiB
Go
55 lines
1.6 KiB
Go
package protocol
|
|
|
|
import (
|
|
"crypto/ecdsa"
|
|
|
|
"github.com/golang/protobuf/proto"
|
|
|
|
"github.com/status-im/status-go/internal/protocol/protobuf"
|
|
)
|
|
|
|
// EditMessage represents an edit of a message from a user in the application layer, used for persistence, querying and
|
|
// signaling
|
|
type EditMessage struct {
|
|
*protobuf.EditMessage
|
|
|
|
// 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:"-"`
|
|
|
|
// LocalChatID is the chatID of the local chat (one-to-one are not symmetric)
|
|
LocalChatID string `json:"localChatId"`
|
|
}
|
|
|
|
func NewEditMessage() *EditMessage {
|
|
return &EditMessage{EditMessage: &protobuf.EditMessage{}}
|
|
}
|
|
|
|
// GetSigPubKey returns an ecdsa encoded public key
|
|
// this function is required to implement the ChatEntity interface
|
|
func (e *EditMessage) 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 *EditMessage) GetProtobuf() proto.Message {
|
|
return e.EditMessage
|
|
}
|
|
|
|
// SetMessageType a setter for the MessageType field
|
|
// this function is required to implement the ChatEntity interface
|
|
func (e *EditMessage) SetMessageType(messageType protobuf.MessageType) {
|
|
e.MessageType = messageType
|
|
}
|
|
|
|
// WrapGroupMessage indicates whether we should wrap this in membership information
|
|
func (e *EditMessage) WrapGroupMessage() bool {
|
|
return false
|
|
}
|