hicli

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package hicli contains a highly opinionated high-level framework for developing instant messaging clients on Matrix.

Index

Constants

View Source
const MaxParallelRequests = 5

Variables

View Source
var ErrFailedToCheckServerVersions = errors.New("failed to check server versions")
View Source
var ErrOutdatedServer = errors.New("homeserver is outdated")
View Source
var ErrPaginationAlreadyInProgress = errors.New("pagination is already in progress")
View Source
var ErrTimelineReset = errors.New("got limited timeline sync response")
View Source
var InitialDeviceDisplayName = "mautrix hiclient"
View Source
var MinimumSpecVersion = mautrix.SpecV11

Functions

This section is empty.

Types

type EventsDecrypted

type EventsDecrypted struct {
	PreviewRowIDs map[id.RoomID]database.EventRowID `json:"room_preview_rowids"`
	Events        []*database.Event                 `json:"events"`
}

type HiClient

type HiClient struct {
	DB          *database.Database
	Account     *database.Account
	Client      *mautrix.Client
	Crypto      *crypto.OlmMachine
	CryptoStore *crypto.SQLCryptoStore
	ClientStore *database.ClientStateStore
	Log         zerolog.Logger

	Verified bool

	KeyBackupVersion id.KeyBackupVersion
	KeyBackupKey     *backup.MegolmBackupKey

	EventHandler func(evt any)
	// contains filtered or unexported fields
}

func New

func New(rawDB, cryptoDB *dbutil.Database, log zerolog.Logger, pickleKey []byte, evtHandler func(any)) *HiClient

func (*HiClient) CheckServerVersions

func (h *HiClient) CheckServerVersions(ctx context.Context) error

func (*HiClient) Encrypt

func (h *HiClient) Encrypt(ctx context.Context, room *database.Room, evtType event.Type, content any) (encrypted *event.EncryptedEventContent, err error)

func (*HiClient) EnsureGroupSessionShared

func (h *HiClient) EnsureGroupSessionShared(ctx context.Context, roomID id.RoomID) error

func (*HiClient) FetchKeysForOutdatedUsers

func (h *HiClient) FetchKeysForOutdatedUsers(ctx context.Context) error

func (*HiClient) GetEvent

func (h *HiClient) GetEvent(ctx context.Context, roomID id.RoomID, eventID id.EventID) (*database.Event, error)

func (*HiClient) GetEventsByRowIDs

func (h *HiClient) GetEventsByRowIDs(ctx context.Context, rowIDs []database.EventRowID) ([]*database.Event, error)

func (*HiClient) IsLoggedIn

func (h *HiClient) IsLoggedIn() bool

func (*HiClient) Login

func (h *HiClient) Login(ctx context.Context, req *mautrix.ReqLogin) error

func (*HiClient) LoginAndVerify

func (h *HiClient) LoginAndVerify(ctx context.Context, homeserverURL, username, password, recoveryCode string) error

func (*HiClient) LoginPassword

func (h *HiClient) LoginPassword(ctx context.Context, homeserverURL, username, password string) error

func (*HiClient) Paginate

func (h *HiClient) Paginate(ctx context.Context, roomID id.RoomID, maxTimelineID database.TimelineRowID, limit int) ([]*database.Event, error)

func (*HiClient) PaginateServer

func (h *HiClient) PaginateServer(ctx context.Context, roomID id.RoomID, limit int) ([]*database.Event, error)

func (*HiClient) RequestQueuedSessions

func (h *HiClient) RequestQueuedSessions(ctx context.Context) (bool, error)

func (*HiClient) RunRequestQueue

func (h *HiClient) RunRequestQueue(ctx context.Context)

func (*HiClient) Send

func (h *HiClient) Send(ctx context.Context, roomID id.RoomID, evtType event.Type, content any) (*database.Event, error)

func (*HiClient) Start

func (h *HiClient) Start(ctx context.Context, userID id.UserID, expectedAccount *database.Account) error

func (*HiClient) Stop

func (h *HiClient) Stop()

func (*HiClient) Sync

func (h *HiClient) Sync()

func (*HiClient) VerifyWithRecoveryCode

func (h *HiClient) VerifyWithRecoveryCode(ctx context.Context, code string) error

func (*HiClient) WakeupRequestQueue

func (h *HiClient) WakeupRequestQueue()

type SendComplete

type SendComplete struct {
	Event *database.Event `json:"event"`
	Error error           `json:"error"`
}

type SyncComplete

type SyncComplete struct {
	Rooms map[id.RoomID]*SyncRoom `json:"rooms"`
}

type SyncRoom

type SyncRoom struct {
	Meta     *database.Room              `json:"meta"`
	Timeline []database.TimelineRowTuple `json:"timeline"`
	Events   []*database.Event           `json:"events"`
	Reset    bool                        `json:"reset"`
}

type Typing

type Typing struct {
	RoomID id.RoomID `json:"room_id"`
	event.TypingEventContent
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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