diff --git a/channels/errors.go b/channels/errors.go index 6d926af93b1ff292af8ad144680e60638a06fcaf..dd941f86a5d4e3d2d0637567535c2295d17a5e61 100644 --- a/channels/errors.go +++ b/channels/errors.go @@ -18,4 +18,6 @@ var ( "the passed message is too long") WrongPrivateKey = errors.New( "the passed private key does not match the channel") + MessageTypeAlreadyRegistered = errors.New("the given message type has " + + "already been registered") ) diff --git a/channels/eventModel.go b/channels/eventModel.go index 21a14d239391ac533021c6a0cf206ee2b1cbb120..23db8e082d97cbb3d2166c7f4f91824d54674af5 100644 --- a/channels/eventModel.go +++ b/channels/eventModel.go @@ -8,7 +8,6 @@ package channels import ( - "errors" "github.com/golang/protobuf/proto" jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/client/cmix/identity/receptionID" @@ -22,13 +21,10 @@ import ( "gitlab.com/xx_network/primitives/id" ) +// AdminUsername defines the displayed username of admin messages, which are +// unique users for every channel defined by the channel's private key const AdminUsername = "Admin" -var ( - MessageTypeAlreadyRegistered = errors.New("the given message type has " + - "already been registered") -) - // EventModel is an interface which an external party which uses the channels // system passed an object which adheres to in order to get events on the channel type EventModel interface { @@ -72,6 +68,8 @@ type EventModel interface { //UnPinMessage(ChannelID *id.ID, MessageID cryptoChannel.MessageID) } +// MessageTypeReceiveMessage defines handlers for messages of various message +// types. Default ones for Text, Reaction, and AdminText. type MessageTypeReceiveMessage func(channelID *id.ID, messageID cryptoChannel.MessageID, messageType MessageType, senderUsername string, content []byte, timestamp time.Time, diff --git a/channels/interface.go b/channels/interface.go index 38b1f8170c214f585a0f3d5fb09a05e4584ec9fd..ac07646c0abcdf6fe4c37cd97c8e25139ecfbdaf 100644 --- a/channels/interface.go +++ b/channels/interface.go @@ -17,6 +17,10 @@ import ( "time" ) +// ValidForever is used as a validUntil lease when sending to denote the +// message or operation never expires. Note: A message relay must be +// present to enforce this otherwise things expire after 3 weeks due to +// network retention. var ValidForever = time.Duration(math.MaxInt64) type Manager interface { diff --git a/channels/manager.go b/channels/manager.go index 66e112a35eb879b0a7128f39ab3b8dbcc7e19ca6..1600271af693e6f76d1098c84f22b78332932037 100644 --- a/channels/manager.go +++ b/channels/manager.go @@ -5,6 +5,9 @@ // LICENSE file // //////////////////////////////////////////////////////////////////////////////// +// Package channels provides a channels implementation on top of broadcast +// which is capable of handing the user facing features of channels, including +// replies, reactions, and eventually admin commands. package channels import (