bot

package
v0.9.20 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoRoom = errors.New("room not found")

Functions

This section is empty.

Types

type Bot

type Bot struct {
	// contains filtered or unexported fields
}

Bot represents matrix bot

func New

func New(
	q *queue.Queue,
	lp *linkpearl.Linkpearl,
	log *zerolog.Logger,
	cfg *config.Manager,
	psdc *psd.Client,
	proxies []string,
	prefix string,
	domains []string,
	admins []string,
	mbxc MBXConfig,
) (*Bot, error)

New creates a new matrix bot

func (*Bot) ActivateMailbox added in v0.9.10

func (b *Bot) ActivateMailbox(ctx context.Context, ownerID id.UserID, roomID id.RoomID, mailbox string) bool

ActivateMailbox using the configured flow

func (*Bot) AllowAuth added in v0.9.4

func (b *Bot) AllowAuth(ctx context.Context, email, password string) (id.RoomID, bool)

AllowAuth check if SMTP login (email) and password are valid

func (*Bot) BanAuth added in v0.9.16

func (b *Bot) BanAuth(ctx context.Context, addr net.Addr)

Ban an address for incorrect auth automatically

func (*Bot) BanAuto added in v0.9.16

func (b *Bot) BanAuto(ctx context.Context, addr net.Addr)

Ban an address automatically

func (*Bot) BanManually added in v0.9.16

func (b *Bot) BanManually(ctx context.Context, addr net.Addr)

Ban an address manually

func (*Bot) Error

func (b *Bot) Error(ctx context.Context, message string, args ...any)

Error message to the log and matrix room

func (*Bot) GetDKIMprivkey added in v0.9.9

func (b *Bot) GetDKIMprivkey(ctx context.Context) string

GetDKIMprivkey returns DKIM private key

func (*Bot) GetIFOptions added in v0.9.6

func (b *Bot) GetIFOptions(ctx context.Context, roomID id.RoomID) email.IncomingFilteringOptions

GetIFOptions returns incoming email filtering options (room settings)

func (*Bot) GetMapping

func (b *Bot) GetMapping(ctx context.Context, mailbox string) (id.RoomID, bool)

GetMapping returns mapping of mailbox = room

func (*Bot) GetRelayConfig added in v0.9.19

func (b *Bot) GetRelayConfig(ctx context.Context, roomID id.RoomID) *url.URL

GetRelayConfig returns relay config for specific room (mailbox) if set

func (*Bot) IncomingEmail added in v0.9.9

func (b *Bot) IncomingEmail(ctx context.Context, eml *email.Email) error

IncomingEmail sends incoming email to matrix room

func (*Bot) IsBanned added in v0.9.9

func (b *Bot) IsBanned(ctx context.Context, addr net.Addr) bool

IsBanned checks if address is banned

func (*Bot) IsGreylisted added in v0.9.9

func (b *Bot) IsGreylisted(ctx context.Context, addr net.Addr) bool

IsGreylisted checks if host is in greylist

func (*Bot) IsTrusted added in v0.9.10

func (b *Bot) IsTrusted(addr net.Addr) bool

IsTrusted checks if address is a trusted (proxy)

func (*Bot) SendEmailReply added in v0.9.9

func (b *Bot) SendEmailReply(ctx context.Context)

SendEmailReply sends replies from matrix thread to email thread

func (*Bot) Sendmail added in v0.9.9

func (b *Bot) Sendmail(ctx context.Context, eventID id.EventID, from, to, data string, relayOverride *url.URL) (bool, error)

Sendmail tries to send email immediately, but if it gets 4xx error (greylisting), the email will be added to the queue and retried several times after that

func (*Bot) SetSendmail added in v0.9.9

func (b *Bot) SetSendmail(sendmail func(string, string, string, *url.URL) error)

SetSendmail sets mail sending func to the bot

func (*Bot) Start

func (b *Bot) Start(statusMsg string) error

Start performs matrix /sync

func (*Bot) Stop

func (b *Bot) Stop()

Stop the bot

func (*Bot) SyncRooms added in v0.9.11

func (b *Bot) SyncRooms()

SyncRooms and mailboxes

type MBXConfig added in v0.9.10

type MBXConfig struct {
	Reserved   []string
	Forwarded  []string
	Activation string
}

Mailboxes config

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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