mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-22 06:11:55 -06:00
9582827493
- This PR moves and refactors the [code](https://github.com/matrix-org/dendrite/blob/main/setup/mscs/msc2946/msc2946.go) for [MSC2946](https://github.com/matrix-org/matrix-spec-proposals/pull/2946) ('Space Summaries') to integrate it into the rest of the codebase. - Means space summaries are no longer hidden behind an MSC flag - Solves #3096 Signed-off-by: Sam Wedgwood <sam@wedgwood.dev>
38 lines
1,022 B
Go
38 lines
1,022 B
Go
package config
|
|
|
|
type MSCs struct {
|
|
Matrix *Global `yaml:"-"`
|
|
|
|
// The MSCs to enable. Supported MSCs include:
|
|
// 'msc2444': Peeking over federation - https://github.com/matrix-org/matrix-doc/pull/2444
|
|
// 'msc2753': Peeking via /sync - https://github.com/matrix-org/matrix-doc/pull/2753
|
|
// 'msc2836': Threading - https://github.com/matrix-org/matrix-doc/pull/2836
|
|
MSCs []string `yaml:"mscs"`
|
|
|
|
Database DatabaseOptions `yaml:"database,omitempty"`
|
|
}
|
|
|
|
func (c *MSCs) Defaults(opts DefaultOpts) {
|
|
if opts.Generate {
|
|
if !opts.SingleDatabase {
|
|
c.Database.ConnectionString = "file:mscs.db"
|
|
}
|
|
}
|
|
}
|
|
|
|
// Enabled returns true if the given msc is enabled. Should in the form 'msc12345'.
|
|
func (c *MSCs) Enabled(msc string) bool {
|
|
for _, m := range c.MSCs {
|
|
if m == msc {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (c *MSCs) Verify(configErrs *ConfigErrors) {
|
|
if c.Matrix.DatabaseOptions.ConnectionString == "" {
|
|
checkNotEmpty(configErrs, "mscs.database.connection_string", string(c.Database.ConnectionString))
|
|
}
|
|
}
|