config

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: 16 Imported by: 0

Documentation

Overview

Package config contains the wrappers for gomuks configurations and sessions.

Index

Constants

View Source
const FilterVersion = 1

Variables

View Source
var DefaultKeybindings string
View Source
var InlineURLsProbablySupported bool

Functions

This section is empty.

Types

type AuthCache

type AuthCache struct {
	NextBatch       string `yaml:"next_batch"`
	FilterID        string `yaml:"filter_id"`
	FilterVersion   int    `yaml:"filter_version"`
	InitialSyncDone bool   `yaml:"initial_sync_done"`
}

type Config

type Config struct {
	UserID      id.UserID   `yaml:"mxid"`
	DeviceID    id.DeviceID `yaml:"device_id"`
	AccessToken string      `yaml:"access_token"`
	HS          string      `yaml:"homeserver"`

	RoomCacheSize int   `yaml:"room_cache_size"`
	RoomCacheAge  int64 `yaml:"room_cache_age"`

	NotifySound        bool `yaml:"notify_sound"`
	SendToVerifiedOnly bool `yaml:"send_to_verified_only"`

	Backspace1RemovesWord bool `yaml:"backspace1_removes_word"`
	Backspace2RemovesWord bool `yaml:"backspace2_removes_word"`

	AlwaysClearScreen bool `yaml:"always_clear_screen"`

	Dir          string `yaml:"-"`
	DataDir      string `yaml:"data_dir"`
	CacheDir     string `yaml:"cache_dir"`
	HistoryPath  string `yaml:"history_path"`
	RoomListPath string `yaml:"room_list_path"`
	MediaDir     string `yaml:"media_dir"`
	DownloadDir  string `yaml:"download_dir"`
	StateDir     string `yaml:"state_dir"`

	Preferences UserPreferences        `yaml:"-"`
	AuthCache   AuthCache              `yaml:"-"`
	Rooms       *rooms.RoomCache       `yaml:"-"`
	PushRules   *pushrules.PushRuleset `yaml:"-"`
	Keybindings ParsedKeybindings      `yaml:"-"`
	// contains filtered or unexported fields
}

Config contains the main config of gomuks.

func NewConfig

func NewConfig(configDir, dataDir, cacheDir, downloadDir string) *Config

NewConfig creates a config that loads data from the given directory.

func (*Config) Clear

func (config *Config) Clear()

Clear clears the session cache and removes all history.

func (*Config) ClearData

func (config *Config) ClearData()

ClearData clears non-temporary session data.

func (*Config) CreateCacheDirs

func (config *Config) CreateCacheDirs()

func (*Config) DeleteSession

func (config *Config) DeleteSession()

func (*Config) GetUserID

func (config *Config) GetUserID() id.UserID

func (*Config) Load

func (config *Config) Load()

Load loads the config from config.yaml in the directory given to the config struct.

func (*Config) LoadAll

func (config *Config) LoadAll()

func (*Config) LoadAuthCache

func (config *Config) LoadAuthCache()

func (*Config) LoadFilterID

func (config *Config) LoadFilterID(_ id.UserID) string

func (*Config) LoadKeybindings added in v0.3.0

func (config *Config) LoadKeybindings()

func (*Config) LoadNextBatch

func (config *Config) LoadNextBatch(_ id.UserID) string

func (*Config) LoadPreferences

func (config *Config) LoadPreferences()

func (*Config) LoadPushRules

func (config *Config) LoadPushRules()

func (*Config) LoadRoom

func (config *Config) LoadRoom(_ id.RoomID) *mautrix.Room

func (*Config) Save

func (config *Config) Save()

Save saves this config to config.yaml in the directory given to the config struct.

func (*Config) SaveAll

func (config *Config) SaveAll()

func (*Config) SaveAuthCache

func (config *Config) SaveAuthCache()

func (*Config) SaveFilterID

func (config *Config) SaveFilterID(_ id.UserID, filterID string)

func (*Config) SaveKeybindings added in v0.3.0

func (config *Config) SaveKeybindings()

func (*Config) SaveNextBatch

func (config *Config) SaveNextBatch(_ id.UserID, nextBatch string)

func (*Config) SavePreferences

func (config *Config) SavePreferences()

func (*Config) SavePushRules

func (config *Config) SavePushRules()

func (*Config) SaveRoom

func (config *Config) SaveRoom(_ *mautrix.Room)

type Keybind added in v0.3.0

type Keybind struct {
	Mod tcell.ModMask
	Key tcell.Key
	Ch  rune
}

type ParsedKeybindings added in v0.3.0

type ParsedKeybindings struct {
	Main   map[Keybind]string
	Room   map[Keybind]string
	Modal  map[Keybind]string
	Visual map[Keybind]string
}

type RawKeybindings added in v0.3.0

type RawKeybindings struct {
	Main   map[string]string `yaml:"main,omitempty"`
	Room   map[string]string `yaml:"room,omitempty"`
	Modal  map[string]string `yaml:"modal,omitempty"`
	Visual map[string]string `yaml:"visual,omitempty"`
}

type UserPreferences

type UserPreferences struct {
	HideUserList         bool `yaml:"hide_user_list"`
	HideRoomList         bool `yaml:"hide_room_list"`
	HideTimestamp        bool `yaml:"hide_timestamp"`
	BareMessageView      bool `yaml:"bare_message_view"`
	DisableImages        bool `yaml:"disable_images"`
	DisableTypingNotifs  bool `yaml:"disable_typing_notifs"`
	DisableEmojis        bool `yaml:"disable_emojis"`
	DisableMarkdown      bool `yaml:"disable_markdown"`
	DisableHTML          bool `yaml:"disable_html"`
	DisableDownloads     bool `yaml:"disable_downloads"`
	DisableNotifications bool `yaml:"disable_notifications"`
	DisableShowURLs      bool `yaml:"disable_show_urls"`
	AltEnterToSend       bool `yaml:"alt_enter_to_send"`

	InlineURLMode string `yaml:"inline_url_mode"`
}

func (*UserPreferences) EnableInlineURLs added in v0.3.0

func (up *UserPreferences) EnableInlineURLs() bool

Jump to

Keyboard shortcuts

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