server

package
v2.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 24 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Code

func Code(err error) string

Word of the kind of refusal the error is, as the routes and the service answer it; empty for a failure that is no refusal

Types

type From

type From struct {
	Profile, Session string
	Limited, Chat    bool
	Scoped           bool
}

Who asks: the profile and session a command was typed in, a person a chat app limits to commands that read, words typed in a chat, and a program of the HTTP API, which reads the messages of its own profile alone

type Listed

type Listed struct {
	Bot roster.Bot
	// Its Bot Chat, nil before it has one and for a bot of a peer
	Chat *sessionsv1.Session
	// A reply runs in its Bot Chat, or a message waits for one
	Busy bool
	// Newest message of its Bot Chat on one line, given by a page alone
	Preview string
	// The newest session of its profile a person picks from, nil for none and for a bot of a peer
	Newest   *sessionsv1.Session
	Standing mail.Standing
	// Title of what its profile runs now that nobody types into, empty for nothing
	Working string
	// The bot of the profile that asks
	Self bool
}

A bot as a list and a page give it: with its Bot Chat, how its messages stand and what its profile works on now

type Refusal

type Refusal struct {
	Code    string
	Message string
}

Words of the refusals of the verbs, which the routes and the service answer with

func (*Refusal) Error

func (r *Refusal) Error() string

type Verbs

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

The bots as the screens, the chats, the HTTP API and other icebaths reach them: each verb on the roster, the relay and the messages

func Register

func Register(registry *server.Registry, cfg *config.Config, store *mail.Store, bots *roster.Roster, messages *relay.Relay,
	host *runner.Runner) *Verbs

Serves the bots to the screens and gives back the verbs for /bots and the HTTP API

func (*Verbs) Add

func (v *Verbs) Add(ctx context.Context, from From, name string, title *string) (Listed, bool, error)

Makes the profile of this icebath a bot, with the title given, or gives a bot another title: the bot as it stands, and whether it was a bot already. Its teammates are told of it from their next messages

func (*Verbs) Bot

func (v *Verbs) Bot(ctx context.Context, from From, words string, count int) (Listed, []mail.Delivery, error)

One bot of this icebath or of a peer of the profile that asks, with the newest of its messages, as many as asked for

func (*Verbs) Chat

func (v *Verbs) Chat(ctx context.Context, from From, words string) (roster.Bot, *sessionsv1.Session, error)

The Bot Chat of the bot of this icebath, made when it has none

func (*Verbs) Fresh

func (v *Verbs) Fresh(ctx context.Context, from From, words string) (roster.Bot, bool, error)

Puts the Bot Chat of the bot of this icebath aside, so its next message starts a new one; whether it had one

func (*Verbs) Message

func (v *Verbs) Message(ctx context.Context, from From, id string, wait time.Duration) (mail.Delivery, error)

The message of the id, once it ended or the wait passed: a program of the HTTP API reads those of its own profile, and those a bot of another icebath sent, whose id that icebath alone knows

func (*Verbs) Messages

func (v *Verbs) Messages(ctx context.Context, from From, words string, statuses []string, limit int, before time.Time) ([]mail.Delivery,
	error)

Messages to and from the bot the words name, or to and from every bot of this icebath for none, newest first; a program of the HTTP API lists those of its own profile alone

func (*Verbs) Receive

func (v *Verbs) Receive(ctx context.Context, from From, handle string, letter mail.Letter) (mail.Delivery, bool, error)

Takes the message a bot of another icebath sends to the bot of the handle, under the same id: the delivery as it stands, once it ended or the wait asked for passed, a minute at most, and whether it was taken before

func (*Verbs) Remove

func (v *Verbs) Remove(ctx context.Context, from From, words string) (roster.Bot, error)

Takes the bot of this icebath off the roster: its profile and its Bot Chat stay, and its teammates no longer hear of it

func (*Verbs) Resend

func (v *Verbs) Resend(ctx context.Context, from From, id string) (mail.Delivery, error)

Sends the message of the id again under a new id, one that did not get through

func (*Verbs) Roll

func (v *Verbs) Roll(ctx context.Context, from From) (roster.Roll, error)

The bots of this icebath as another icebath reads them, the one of the profile it reaches marked as the profile's own

func (*Verbs) Roster

func (v *Verbs) Roster(ctx context.Context, from From) ([]Listed, []roster.Unreached, []string, error)

The bots of this icebath, then those of the peers of the profile that asks, each with its Bot Chat and how its messages stand; the peers whose bots could not be read; and the profiles of this icebath that are no bot

func (*Verbs) Run

func (v *Verbs) Run(ctx context.Context, from From, words string) (string, bool, error)

Runs the words that follow /bots: what they answered, or ok false with what the verb takes when they are not understood. Typed in a chat, the answer is cut to what a chat shows

func (*Verbs) Send

func (v *Verbs) Send(ctx context.Context, from From, words, text, id string, wait time.Duration) (mail.Delivery, bool, error)

Sends what the person wrote to the bot, as a message the bot answers in its Bot Chat as though it was typed there; under the id given, whose message is given again when it was sent before. Waits for its answer as long as asked, ten minutes at most

func (*Verbs) Stop

func (v *Verbs) Stop(ctx context.Context, from From, id, why string) (mail.Delivery, error)

Stops the message of the id, as a person asked

func (*Verbs) Unpause

func (v *Verbs) Unpause(ctx context.Context, from From, words string) (roster.Bot, bool, error)

Lets the messages of bots into the Bot Chat of the bot of this icebath again before the pause of its loop guard is over; whether one held

func (*Verbs) Unsent

func (v *Verbs) Unsent(ctx context.Context, from From, handle string, letter mail.Letter) (mail.Delivery, error)

Settles the id of a message a bot of another icebath could not tell it handed over as never sent, so it is never taken later

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL