mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
fab9603547
- Add `crypto_database_path` and `crypto_passphrase` configuration - Integrate cryptohelper for decrypting `m.room.encrypted` events - Handle both plaintext and encrypted messages in `handleMessageEvent` - Enable `goolm` build tag for libsignal crypto support Fixes #1840.
21 lines
549 B
Go
21 lines
549 B
Go
package matrix
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"github.com/sipeed/picoclaw/pkg/bus"
|
|
"github.com/sipeed/picoclaw/pkg/channels"
|
|
"github.com/sipeed/picoclaw/pkg/config"
|
|
)
|
|
|
|
func init() {
|
|
channels.RegisterFactory("matrix", func(cfg *config.Config, b *bus.MessageBus) (channels.Channel, error) {
|
|
matrixCfg := cfg.Channels.Matrix
|
|
cryptoDatabasePath := matrixCfg.CryptoDatabasePath
|
|
if cryptoDatabasePath == "" {
|
|
cryptoDatabasePath = filepath.Join(cfg.WorkspacePath(), "matrix")
|
|
}
|
|
return NewMatrixChannel(matrixCfg, b, cryptoDatabasePath)
|
|
})
|
|
}
|