mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 22:22:46 +00:00
Initial storage for Implementation of push notification
This commit is contained in:
parent
d6e9b7b307
commit
dd8b05c310
18 changed files with 537 additions and 0 deletions
|
@ -29,6 +29,7 @@ import (
|
|||
"github.com/matrix-org/dendrite/userapi/api"
|
||||
"github.com/matrix-org/dendrite/userapi/storage/accounts"
|
||||
"github.com/matrix-org/dendrite/userapi/storage/devices"
|
||||
"github.com/matrix-org/dendrite/userapi/storage/pushers"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/matrix-org/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
@ -37,6 +38,7 @@ import (
|
|||
type UserInternalAPI struct {
|
||||
AccountDB accounts.Database
|
||||
DeviceDB devices.Database
|
||||
PusherDB pushers.Database
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
// AppServices is the list of all registered AS
|
||||
AppServices []config.ApplicationService
|
||||
|
@ -306,6 +308,22 @@ func (a *UserInternalAPI) QueryDevices(ctx context.Context, req *api.QueryDevice
|
|||
return nil
|
||||
}
|
||||
|
||||
func (a *UserInternalAPI) QueryPushers(ctx context.Context, req *api.QueryPushersRequest, res *api.QueryPushersResponse) error {
|
||||
local, domain, err := gomatrixserverlib.SplitID('@', req.UserID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if domain != a.ServerName {
|
||||
return fmt.Errorf("cannot query pushers of remote users: got %s want %s", domain, a.ServerName)
|
||||
}
|
||||
pushers, err := a.PusherDB.GetPushersByLocalpart(ctx, local)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
res.Pushers = pushers
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *UserInternalAPI) QueryAccountData(ctx context.Context, req *api.QueryAccountDataRequest, res *api.QueryAccountDataResponse) error {
|
||||
local, domain, err := gomatrixserverlib.SplitID('@', req.UserID)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue