ifc

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package ifc contains interfaces to allow circular function calls without circular imports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Crypto

type Crypto interface {
	Load() error
	FlushStore() error
	ProcessSyncResponse(resp *mautrix.RespSync, since string) bool
	ProcessInRoomVerification(evt *event.Event) error
	HandleMemberEvent(*event.Event)
	DecryptMegolmEvent(*event.Event) (*event.Event, error)
	EncryptMegolmEvent(id.RoomID, event.Type, interface{}) (*event.EncryptedEventContent, error)
	ShareGroupSession(id.RoomID, []id.UserID) error
	Fingerprint() string
}

type Gomuks

type Gomuks interface {
	Matrix() MatrixContainer
	UI() GomuksUI
	Config() *config.Config
	Version() string

	Start()
	Stop(save bool)
}

Gomuks is the wrapper for everything.

type GomuksUI

type GomuksUI interface {
	Render()
	HandleNewPreferences()
	OnLogin()
	OnLogout()
	MainView() MainView

	Init()
	Start() error
	Stop()
	Finish()
}

type MainView

type MainView interface {
	GetRoom(roomID id.RoomID) RoomView
	AddRoom(room *rooms.Room)
	RemoveRoom(room *rooms.Room)
	SetRooms(rooms *rooms.RoomCache)
	Bump(room *rooms.Room)

	UpdateTags(room *rooms.Room)

	SetTyping(roomID id.RoomID, users []id.UserID)
	OpenSyncingModal() SyncingModal

	NotifyMessage(room *rooms.Room, message Message, should pushrules.PushActionArrayShould)
}

type MatrixContainer

type MatrixContainer interface {
	Client() *mautrix.Client
	Preferences() *config.UserPreferences
	InitClient() error
	Initialized() bool

	Start()
	Stop()

	Login(user, password string) error
	Logout()
	UIAFallback(authType mautrix.AuthType, sessionID string) error

	SendPreferencesToMatrix()
	PrepareMarkdownMessage(roomID id.RoomID, msgtype event.MessageType, text, html string, relation *Relation) *muksevt.Event
	PrepareMediaMessage(room *rooms.Room, path string, relation *Relation) (*muksevt.Event, error)
	SendEvent(evt *muksevt.Event) (id.EventID, error)
	Redact(roomID id.RoomID, eventID id.EventID, reason string) error
	SendTyping(roomID id.RoomID, typing bool)
	MarkRead(roomID id.RoomID, eventID id.EventID)
	JoinRoom(roomID id.RoomID, server string) (*rooms.Room, error)
	LeaveRoom(roomID id.RoomID) error
	CreateRoom(req *mautrix.ReqCreateRoom) (*rooms.Room, error)

	FetchMembers(room *rooms.Room) error
	GetHistory(room *rooms.Room, limit int, dbPointer uint64) ([]*muksevt.Event, uint64, error)
	GetEvent(room *rooms.Room, eventID id.EventID) (*muksevt.Event, error)
	GetRoom(roomID id.RoomID) *rooms.Room
	GetOrCreateRoom(roomID id.RoomID) *rooms.Room

	UploadMedia(path string, encrypt bool) (*UploadedMediaInfo, error)
	Download(uri id.ContentURI, file *attachment.EncryptedFile) ([]byte, error)
	DownloadToDisk(uri id.ContentURI, file *attachment.EncryptedFile, target string) (string, error)
	GetDownloadURL(uri id.ContentURI) string
	GetCachePath(uri id.ContentURI) string

	Crypto() Crypto
}

type Message

type Message interface {
	ID() id.EventID
	Time() time.Time
	NotificationSenderName() string
	NotificationContent() string

	SetIsHighlight(highlight bool)
	SetID(id id.EventID)
}

type Relation

type Relation struct {
	Type  event.RelationType
	Event *muksevt.Event
}

type RoomView

type RoomView interface {
	MxRoom() *rooms.Room

	SetCompletions(completions []string)
	SetTyping(users []id.UserID)
	UpdateUserList()

	AddEvent(evt *muksevt.Event) Message
	AddRedaction(evt *muksevt.Event)
	AddEdit(evt *muksevt.Event)
	AddReaction(evt *muksevt.Event, key string)
	GetEvent(eventID id.EventID) Message
	AddServiceMessage(message string)
}

type SyncingModal

type SyncingModal interface {
	SetIndeterminate()
	SetMessage(string)
	SetSteps(int)
	Step()
	Close()
}

type UIProvider

type UIProvider func(gmx Gomuks) GomuksUI

type UploadedMediaInfo added in v0.2.0

type UploadedMediaInfo struct {
	*mautrix.RespMediaUpload
	EncryptionInfo *attachment.EncryptedFile
	MsgType        event.MessageType
	Name           string
	Info           *event.FileInfo
}

Jump to

Keyboard shortcuts

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