2026-03-07 17:44:24 +00:00
|
|
|
package matrix
|
|
|
|
|
|
|
|
|
|
import (
|
2026-03-20 15:24:46 +00:00
|
|
|
"path/filepath"
|
|
|
|
|
|
2026-03-07 17:44:24 +00:00
|
|
|
"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) {
|
2026-03-20 15:24:46 +00:00
|
|
|
matrixCfg := cfg.Channels.Matrix
|
|
|
|
|
cryptoDatabasePath := matrixCfg.CryptoDatabasePath
|
|
|
|
|
if cryptoDatabasePath == "" {
|
|
|
|
|
cryptoDatabasePath = filepath.Join(cfg.WorkspacePath(), "matrix")
|
|
|
|
|
}
|
|
|
|
|
return NewMatrixChannel(matrixCfg, b, cryptoDatabasePath)
|
2026-03-07 17:44:24 +00:00
|
|
|
})
|
|
|
|
|
}
|