func Register(dir, nickname, info string, subs subs.Subscriptions) error
Owner represents the owner of the current node in the network.
type Owner struct { User *entity.User Storage *storage.Storage Profile *Profile Signer *crypto.Signer View *View }
func New(dir, nickname string) (*Owner, error)
func (o *Owner) Close()
Profile is a proxy for the profile database, which implements caching and provides few additional functions for managing owner's settings.
type Profile struct {
// contains filtered or unexported fields
}
func NewProfile(db *sqlite.ProfileDatabase, id *entity.ID) *Profile
func (p *Profile) Close() error
func (p *Profile) GetFullHistory() []*entity.UserHistory
func (p *Profile) GetModerators() []*entity.ID
func (p *Profile) GetSubscriptions() subs.Subscriptions
func (p *Profile) GetUserHistory(id *entity.ID) (*entity.UserHistory, error)
func (p *Profile) HasModerator(id *entity.ID) (bool, error)
func (p *Profile) PutModerator(id *entity.ID) error
func (p *Profile) PutSubscription(t subs.Topic) error
func (p *Profile) PutUserHistory(h *entity.UserHistory) error
func (p *Profile) RemoveModerator(id *entity.ID) error
func (p *Profile) RemoveSubscription(t subs.Topic) error
type ThreadModerator struct {
// contains filtered or unexported fields
}
func (tm *ThreadModerator) Handle(n *thread.Node) (*entity.Message, error)
View personalizes content for the owner. It applies operation performed by the owner's moderators.
type View struct {
// contains filtered or unexported fields
}
func NewView(profile *Profile, storage *storage.Storage) *View
func (v *View) IsUserBanned(uid *entity.ID) (bool, error)
func (v *View) ModerateMessage(m *entity.Message) (*entity.Message, error)
func (v *View) ModerateMessages(brd []*entity.Message) (res []*entity.Message, err error)
func (v *View) ModerateThread(t *thread.Node) (*thread.Node, error)