chat

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: AGPL-3.0 Imports: 6 Imported by: ? 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

This section is empty.

Types

type Chat

type Chat struct {
	// Readers for files to be attached to the next message the client sends in this chat
	Attachments []io.Reader
	// Data for each message in the chat
	//  Key (int) - Message ID
	//  Val (Message) - Message data
	Messages     map[int]*Message
	MessagesBind map[int]binding.String
	// Chat metadata
	Metadata   ChatMetadata
	ReplyingTo []int
}

Cache and data for a chat

func NewChat added in v0.4.0

func NewChat(metadataRaw *prot.ChatMetadataRaw) *Chat

func (*Chat) CacheMessages added in v0.4.0

func (chat *Chat) CacheMessages(messagesRaw []prot.MessageRaw, u *user.UserCache) error

type ChatCache

type ChatCache struct {
	// Cache and data for each loaded chat
	//  Key (int) - Chat ID
	//  Val (*Chat) - Chat cache and data
	Chats map[int]*Chat
	// Cache and data for chat currently shown on screen, is null if there is no chat on screen
	ThisChat *Chat
}

func NewChatCache

func NewChatCache() *ChatCache

type ChatMetadata added in v0.4.0

type ChatMetadata struct {
	// A description of what the chat is about
	Description string
	// ID of the chat
	ID int
	// Is the chat public?
	IsPublic bool
	// ID of the last message in the chat. Should be set to -1 and not 0 when creating a chat to prevent and off by 1 error
	LastMessageID int
	// Usernames of everyone who has access to the chat
	Members []string
	// The name of the chat
	Name string
	// Total number of messages in the chat. This should not be updated while the chat is loaded and instead should be calculated from the field `LastMessageID` when saving metadata
	NumberOfMessages int
}

type Message added in v0.4.0

type Message struct {
	Content    string
	ID         int
	RepliedIDs []int
	Time       int64
	Username   *string
}

Jump to

Keyboard shortcuts

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