config

package
v0.10.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	NameQualityPush    = 3
	NameQualityContact = 2
	NameQualityPhone   = 1
)

Variables

View Source
var SpacedBlocks = [][]string{
	{"homeserver", "software"},
	{"appservice"},
	{"appservice", "hostname"},
	{"appservice", "database"},
	{"appservice", "id"},
	{"appservice", "as_token"},
	{"analytics"},
	{"metrics"},
	{"whatsapp"},
	{"bridge"},
	{"bridge", "command_prefix"},
	{"bridge", "management_room_text"},
	{"bridge", "encryption"},
	{"bridge", "provisioning"},
	{"bridge", "permissions"},
	{"bridge", "relay"},
	{"logging"},
}

Functions

func DoUpgrade added in v0.5.0

func DoUpgrade(helper *up.Helper)

Types

type BridgeConfig

type BridgeConfig struct {
	UsernameTemplate    string `yaml:"username_template"`
	DisplaynameTemplate string `yaml:"displayname_template"`

	PersonalFilteringSpaces bool `yaml:"personal_filtering_spaces"`

	DeliveryReceipts      bool `yaml:"delivery_receipts"`
	MessageStatusEvents   bool `yaml:"message_status_events"`
	MessageErrorNotices   bool `yaml:"message_error_notices"`
	PortalMessageBuffer   int  `yaml:"portal_message_buffer"`
	CallStartNotices      bool `yaml:"call_start_notices"`
	IdentityChangeNotices bool `yaml:"identity_change_notices"`

	HistorySync struct {
		Backfill bool `yaml:"backfill"`

		RequestFullSync bool `yaml:"request_full_sync"`
		FullSyncConfig  struct {
			DaysLimit    uint32 `yaml:"days_limit"`
			SizeLimit    uint32 `yaml:"size_mb_limit"`
			StorageQuota uint32 `yaml:"storage_quota_mb"`
		}
		MaxInitialConversations int `yaml:"max_initial_conversations"`
		MessageCount            int `yaml:"message_count"`
		UnreadHoursThreshold    int `yaml:"unread_hours_threshold"`

		Immediate struct {
			WorkerCount int `yaml:"worker_count"`
			MaxEvents   int `yaml:"max_events"`
		} `yaml:"immediate"`

		MediaRequests struct {
			AutoRequestMedia bool               `yaml:"auto_request_media"`
			RequestMethod    MediaRequestMethod `yaml:"request_method"`
			RequestLocalTime int                `yaml:"request_local_time"`
			MaxAsyncHandle   int64              `yaml:"max_async_handle"`
		} `yaml:"media_requests"`

		Deferred []DeferredConfig `yaml:"deferred"`
	} `yaml:"history_sync"`
	UserAvatarSync    bool `yaml:"user_avatar_sync"`
	BridgeMatrixLeave bool `yaml:"bridge_matrix_leave"`

	SyncDirectChatList     bool `yaml:"sync_direct_chat_list"`
	SyncManualMarkedUnread bool `yaml:"sync_manual_marked_unread"`
	DefaultBridgePresence  bool `yaml:"default_bridge_presence"`
	SendPresenceOnTyping   bool `yaml:"send_presence_on_typing"`

	ForceActiveDeliveryReceipts bool `yaml:"force_active_delivery_receipts"`

	DoublePuppetConfig bridgeconfig.DoublePuppetConfig `yaml:",inline"`

	PrivateChatPortalMeta string `yaml:"private_chat_portal_meta"`
	ParallelMemberSync    bool   `yaml:"parallel_member_sync"`
	BridgeNotices         bool   `yaml:"bridge_notices"`
	ResendBridgeInfo      bool   `yaml:"resend_bridge_info"`
	MuteBridging          bool   `yaml:"mute_bridging"`
	ArchiveTag            string `yaml:"archive_tag"`
	PinnedTag             string `yaml:"pinned_tag"`
	TagOnlyOnCreate       bool   `yaml:"tag_only_on_create"`
	MarkReadOnlyOnCreate  bool   `yaml:"mark_read_only_on_create"`
	EnableStatusBroadcast bool   `yaml:"enable_status_broadcast"`
	MuteStatusBroadcast   bool   `yaml:"mute_status_broadcast"`
	StatusBroadcastTag    string `yaml:"status_broadcast_tag"`
	WhatsappThumbnail     bool   `yaml:"whatsapp_thumbnail"`
	AllowUserInvite       bool   `yaml:"allow_user_invite"`
	FederateRooms         bool   `yaml:"federate_rooms"`
	URLPreviews           bool   `yaml:"url_previews"`
	CaptionInMessage      bool   `yaml:"caption_in_message"`
	BeeperGalleries       bool   `yaml:"beeper_galleries"`
	ExtEvPolls            bool   `yaml:"extev_polls"`
	CrossRoomReplies      bool   `yaml:"cross_room_replies"`
	DisableReplyFallbacks bool   `yaml:"disable_reply_fallbacks"`

	MessageHandlingTimeout struct {
		ErrorAfterStr string `yaml:"error_after"`
		DeadlineStr   string `yaml:"deadline"`

		ErrorAfter time.Duration `yaml:"-"`
		Deadline   time.Duration `yaml:"-"`
	} `yaml:"message_handling_timeout"`

	DisableStatusBroadcastSend bool `yaml:"disable_status_broadcast_send"`

	DisableBridgeAlerts   bool `yaml:"disable_bridge_alerts"`
	CrashOnStreamReplaced bool `yaml:"crash_on_stream_replaced"`

	CommandPrefix string `yaml:"command_prefix"`

	ManagementRoomText bridgeconfig.ManagementRoomTexts `yaml:"management_room_text"`

	Encryption bridgeconfig.EncryptionConfig `yaml:"encryption"`

	Provisioning struct {
		Prefix         string `yaml:"prefix"`
		SharedSecret   string `yaml:"shared_secret"`
		DebugEndpoints bool   `yaml:"debug_endpoints"`
	} `yaml:"provisioning"`

	Permissions bridgeconfig.PermissionConfig `yaml:"permissions"`

	Relay RelaybotConfig `yaml:"relay"`

	ParsedUsernameTemplate *template.Template `yaml:"-"`
	// contains filtered or unexported fields
}

func (BridgeConfig) EnableMessageErrorNotices added in v0.6.0

func (bc BridgeConfig) EnableMessageErrorNotices() bool

func (BridgeConfig) EnableMessageStatusEvents added in v0.6.0

func (bc BridgeConfig) EnableMessageStatusEvents() bool

func (BridgeConfig) FormatDisplayname

func (bc BridgeConfig) FormatDisplayname(jid types.JID, contact types.ContactInfo) (string, int8)

func (BridgeConfig) FormatUsername

func (bc BridgeConfig) FormatUsername(username string) string

func (BridgeConfig) GetCommandPrefix added in v0.5.0

func (bc BridgeConfig) GetCommandPrefix() string

func (BridgeConfig) GetDoublePuppetConfig added in v0.10.1

func (bc BridgeConfig) GetDoublePuppetConfig() bridgeconfig.DoublePuppetConfig

func (BridgeConfig) GetEncryptionConfig added in v0.5.0

func (bc BridgeConfig) GetEncryptionConfig() bridgeconfig.EncryptionConfig

func (BridgeConfig) GetManagementRoomTexts added in v0.5.0

func (bc BridgeConfig) GetManagementRoomTexts() bridgeconfig.ManagementRoomTexts

func (BridgeConfig) GetResendBridgeInfo added in v0.6.0

func (bc BridgeConfig) GetResendBridgeInfo() bool

func (*BridgeConfig) UnmarshalYAML

func (bc *BridgeConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

func (BridgeConfig) Validate added in v0.6.0

func (bc BridgeConfig) Validate() error

type Config

type Config struct {
	*bridgeconfig.BaseConfig `yaml:",inline"`

	Analytics struct {
		Host   string `yaml:"host"`
		Token  string `yaml:"token"`
		UserID string `yaml:"user_id"`
	}

	Metrics struct {
		Enabled bool   `yaml:"enabled"`
		Listen  string `yaml:"listen"`
	} `yaml:"metrics"`

	WhatsApp struct {
		OSName      string `yaml:"os_name"`
		BrowserName string `yaml:"browser_name"`
	} `yaml:"whatsapp"`

	Bridge BridgeConfig `yaml:"bridge"`
}

func (*Config) CanAutoDoublePuppet added in v0.2.1

func (config *Config) CanAutoDoublePuppet(userID id.UserID) bool

type DeferredConfig added in v0.4.0

type DeferredConfig struct {
	StartDaysAgo   int `yaml:"start_days_ago"`
	MaxBatchEvents int `yaml:"max_batch_events"`
	BatchDelay     int `yaml:"batch_delay"`
}

type MediaRequestMethod added in v0.4.0

type MediaRequestMethod string
const (
	MediaRequestMethodImmediate MediaRequestMethod = "immediate"
	MediaRequestMethodLocalTime                    = "local_time"
)

type RelaybotConfig

type RelaybotConfig struct {
	Enabled        bool                         `yaml:"enabled"`
	AdminOnly      bool                         `yaml:"admin_only"`
	MessageFormats map[event.MessageType]string `yaml:"message_formats"`
	// contains filtered or unexported fields
}

func (*RelaybotConfig) FormatMessage

func (rc *RelaybotConfig) FormatMessage(content *event.MessageEventContent, sender id.UserID, member event.MemberEventContent) (string, error)

func (*RelaybotConfig) UnmarshalYAML

func (rc *RelaybotConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type Sender

type Sender struct {
	UserID string
	event.MemberEventContent
}

type UsernameTemplateArgs

type UsernameTemplateArgs struct {
	UserID id.UserID
}

Jump to

Keyboard shortcuts

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