mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-10 06:53:00 +00:00
e473320e73
- New package `perform` which contains all `Perform` functions - New package `helpers` which contains helper functions used by both perform and query/input functions. - Perform invite/leave have no idea how to `WriteOutputEvents` and this is now returned from `PerformInvite` or `PerformLeave` respectively. Still to do: - RSAPI is fed into the inviter/joiner/leaver - this introduces circular logic so will need to be removed. - Put query operations in a `query` package. - Put input operations (and output) in an `input` package. - Factor out helper functions as much as possible, possibly rejigging the storage layer in the process.
26 lines
470 B
Go
26 lines
470 B
Go
package perform
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/matrix-org/dendrite/roomserver/api"
|
|
"github.com/matrix-org/dendrite/roomserver/storage"
|
|
)
|
|
|
|
type Publisher struct {
|
|
DB storage.Database
|
|
}
|
|
|
|
func (r *Publisher) PerformPublish(
|
|
ctx context.Context,
|
|
req *api.PerformPublishRequest,
|
|
res *api.PerformPublishResponse,
|
|
) {
|
|
err := r.DB.PublishRoom(ctx, req.RoomID, req.Visibility == "public")
|
|
if err != nil {
|
|
res.Error = &api.PerformError{
|
|
Msg: err.Error(),
|
|
}
|
|
}
|
|
}
|