...

Package owner

import "vminko.org/dscuss/owner"
Overview
Index

Overview ▾

Owner is the user which owns the current network node. Unlike other users, it has access to the Storage of this node and the private key of the user.

func Register

func Register(dir, nickname, info string, subs subs.Subscriptions) error

type Owner

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

func New(dir, nickname string) (*Owner, error)

func (*Owner) Close

func (o *Owner) Close()

type Profile

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

func NewProfile(db *sqlite.ProfileDatabase, id *entity.ID) *Profile

func (*Profile) Close

func (p *Profile) Close() error

func (*Profile) GetFullHistory

func (p *Profile) GetFullHistory() []*entity.UserHistory

func (*Profile) GetModerators

func (p *Profile) GetModerators() []*entity.ID

func (*Profile) GetSubscriptions

func (p *Profile) GetSubscriptions() subs.Subscriptions

func (*Profile) GetUserHistory

func (p *Profile) GetUserHistory(id *entity.ID) (*entity.UserHistory, error)

func (*Profile) HasModerator

func (p *Profile) HasModerator(id *entity.ID) (bool, error)

func (*Profile) PutModerator

func (p *Profile) PutModerator(id *entity.ID) error

func (*Profile) PutSubscription

func (p *Profile) PutSubscription(t subs.Topic) error

func (*Profile) PutUserHistory

func (p *Profile) PutUserHistory(h *entity.UserHistory) error

func (*Profile) RemoveModerator

func (p *Profile) RemoveModerator(id *entity.ID) error

func (*Profile) RemoveSubscription

func (p *Profile) RemoveSubscription(t subs.Topic) error

type ThreadModerator

type ThreadModerator struct {
    // contains filtered or unexported fields
}

func (*ThreadModerator) Handle

func (tm *ThreadModerator) Handle(n *thread.Node) (*entity.Message, error)

type View

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

func NewView(profile *Profile, storage *storage.Storage) *View

func (*View) IsUserBanned

func (v *View) IsUserBanned(uid *entity.ID) (bool, error)

func (*View) ModerateMessage

func (v *View) ModerateMessage(m *entity.Message) (*entity.Message, error)

func (*View) ModerateMessages

func (v *View) ModerateMessages(brd []*entity.Message) (res []*entity.Message, err error)

func (*View) ModerateThread

func (v *View) ModerateThread(t *thread.Node) (*thread.Node, error)