msgstore

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeFilename

func EscapeFilename(unsafe string) (safe string)

func IsFSStore

func IsFSStore(store Store) bool

func IsMemoryStore

func IsMemoryStore(store Store) bool

func NewDBStore

func NewDBStore(db database.Database) *dbMessageStore

func NewFSStore

func NewFSStore(root string, user *database.User) *fsMessageStore

func NewMemoryStore

func NewMemoryStore() *memoryMessageStore

func ParseMsgID

func ParseMsgID(s string, body msgIDBody) (netID int64, target string, err error)

Types

type ChatHistoryStore

type ChatHistoryStore interface {
	Store

	// ListTargets lists channels and nicknames by time of the latest message.
	// It returns up to limit targets, starting from start and ending on end,
	// both excluded. end may be before or after start.
	// If events is false, only PRIVMSG/NOTICE messages are considered.
	ListTargets(ctx context.Context, network *database.Network, start, end time.Time, limit int, events bool) ([]ChatHistoryTarget, error)
	// LoadBeforeTime loads up to limit messages before start down to end. The
	// returned messages must be between and excluding the provided bounds.
	// end is before start.
	// If events is false, only PRIVMSG/NOTICE messages are considered.
	LoadBeforeTime(ctx context.Context, start, end time.Time, options *LoadMessageOptions) ([]*irc.Message, error)
	// LoadAfterTime loads up to limit messages after start up to end. The
	// returned messages must be between and excluding the provided bounds.
	// end is after start.
	// If events is false, only PRIVMSG/NOTICE messages are considered.
	LoadAfterTime(ctx context.Context, start, end time.Time, options *LoadMessageOptions) ([]*irc.Message, error)
}

ChatHistoryStore is a message store that supports chat history operations.

type ChatHistoryTarget

type ChatHistoryTarget struct {
	Name          string
	LatestMessage time.Time
}

type LoadMessageOptions

type LoadMessageOptions struct {
	Network *database.Network
	Entity  string
	Limit   int
	Events  bool
}

type RenameNetworkStore

type RenameNetworkStore interface {
	Store

	RenameNetwork(oldNet, newNet *database.Network) error
}

RenameNetworkStore is a message store which needs to be notified of network name changes.

type SearchMessageOptions

type SearchMessageOptions struct {
	Start time.Time
	End   time.Time
	Limit int
	From  string
	In    string
	Text  string
}

type SearchStore

type SearchStore interface {
	Store

	// Search returns messages matching the specified options.
	Search(ctx context.Context, network *database.Network, options *SearchMessageOptions) ([]*irc.Message, error)
}

SearchStore is a message store that supports server-side search operations.

type Store

type Store interface {
	Close() error
	// LastMsgID queries the last message ID for the given network, entity and
	// date. The message ID returned may not refer to a valid message, but can be
	// used in history queries.
	LastMsgID(network *database.Network, entity string, t time.Time) (string, error)
	// LoadLatestID queries the latest non-event messages for the given network,
	// entity and date, up to a count of limit messages, sorted from oldest to newest.
	LoadLatestID(ctx context.Context, id string, options *LoadMessageOptions) ([]*irc.Message, error)
	Append(network *database.Network, entity string, msg *irc.Message) (id string, err error)
}

Store is a per-user store for IRC messages.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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