From 73aea70f5c45b2284103a0ee1eb72ab2e0726583 Mon Sep 17 00:00:00 2001 From: Erik Winter Date: Sun, 18 Jun 2023 09:26:41 +0200 Subject: [PATCH] configure processing invites --- bot/matrix.go | 5 ++++- main.go | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bot/matrix.go b/bot/matrix.go index 0efd38a..d25945d 100644 --- a/bot/matrix.go +++ b/bot/matrix.go @@ -20,6 +20,7 @@ type MatrixConfig struct { RoomID string DBPath string Pickle string + AcceptInvites bool } type Matrix struct { @@ -60,7 +61,9 @@ func (m *Matrix) Init() error { } m.client.Crypto = m.cryptoHelper - m.AddEventHandler(m.InviteHandler()) + if m.config.AcceptInvites { + m.AddEventHandler(m.InviteHandler()) + } return nil } diff --git a/main.go b/main.go index 3b108f0..df21a8a 100644 --- a/main.go +++ b/main.go @@ -33,6 +33,7 @@ func main() { RoomID: getParam("MATRIX_ROOM_ID", "!room:localhost"), DBPath: getParam("MATRIX_DB_PATH", "matrix.db"), Pickle: getParam("MATRIX_PICKLE", "matrix.pickle"), + AcceptInvites: getParam("MATRIX_ACCEPT_INVITES", "false") == "true", } mtrx := bot.NewMatrix(mtrxConf, mflx, logger) if err := mtrx.Init(); err != nil {