mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-25 05:01:41 +00:00
parent
abf71649b0
commit
7e745665a4
@ -3,8 +3,6 @@ package pushgateway
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// A Client is how interactions with a Push Gateway is done.
|
// A Client is how interactions with a Push Gateway is done.
|
||||||
@ -50,7 +48,7 @@ type Device struct {
|
|||||||
AppID string `json:"app_id"` // Required
|
AppID string `json:"app_id"` // Required
|
||||||
Data map[string]interface{} `json:"data"` // Required. UNSPEC: Sytests require this to allow unknown keys.
|
Data map[string]interface{} `json:"data"` // Required. UNSPEC: Sytests require this to allow unknown keys.
|
||||||
PushKey string `json:"pushkey"` // Required
|
PushKey string `json:"pushkey"` // Required
|
||||||
PushKeyTS gomatrixserverlib.Timestamp `json:"pushkey_ts,omitempty"`
|
PushKeyTS int64 `json:"pushkey_ts,omitempty"`
|
||||||
Tweaks map[string]interface{} `json:"tweaks,omitempty"`
|
Tweaks map[string]interface{} `json:"tweaks,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,7 +494,7 @@ type PerformPusherDeletionRequest struct {
|
|||||||
type Pusher struct {
|
type Pusher struct {
|
||||||
SessionID int64 `json:"session_id,omitempty"`
|
SessionID int64 `json:"session_id,omitempty"`
|
||||||
PushKey string `json:"pushkey"`
|
PushKey string `json:"pushkey"`
|
||||||
PushKeyTS gomatrixserverlib.Timestamp `json:"pushkey_ts,omitempty"`
|
PushKeyTS int64 `json:"pushkey_ts,omitempty"`
|
||||||
Kind PusherKind `json:"kind"`
|
Kind PusherKind `json:"kind"`
|
||||||
AppID string `json:"app_id"`
|
AppID string `json:"app_id"`
|
||||||
AppDisplayName string `json:"app_display_name"`
|
AppDisplayName string `json:"app_display_name"`
|
||||||
|
@ -653,7 +653,7 @@ func (a *UserInternalAPI) PerformPusherSet(ctx context.Context, req *api.Perform
|
|||||||
return a.DB.RemovePusher(ctx, req.Pusher.AppID, req.Pusher.PushKey, req.Localpart)
|
return a.DB.RemovePusher(ctx, req.Pusher.AppID, req.Pusher.PushKey, req.Localpart)
|
||||||
}
|
}
|
||||||
if req.Pusher.PushKeyTS == 0 {
|
if req.Pusher.PushKeyTS == 0 {
|
||||||
req.Pusher.PushKeyTS = gomatrixserverlib.AsTimestamp(time.Now())
|
req.Pusher.PushKeyTS = int64(time.Now().Second())
|
||||||
}
|
}
|
||||||
return a.DB.UpsertPusher(ctx, req.Pusher, req.Localpart)
|
return a.DB.UpsertPusher(ctx, req.Pusher, req.Localpart)
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ import (
|
|||||||
"github.com/matrix-org/dendrite/internal/sqlutil"
|
"github.com/matrix-org/dendrite/internal/sqlutil"
|
||||||
"github.com/matrix-org/dendrite/userapi/api"
|
"github.com/matrix-org/dendrite/userapi/api"
|
||||||
"github.com/matrix-org/dendrite/userapi/storage/tables"
|
"github.com/matrix-org/dendrite/userapi/storage/tables"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -95,7 +94,7 @@ type pushersStatements struct {
|
|||||||
// Returns nil error success.
|
// Returns nil error success.
|
||||||
func (s *pushersStatements) InsertPusher(
|
func (s *pushersStatements) InsertPusher(
|
||||||
ctx context.Context, txn *sql.Tx, session_id int64,
|
ctx context.Context, txn *sql.Tx, session_id int64,
|
||||||
pushkey string, pushkeyTS gomatrixserverlib.Timestamp, kind api.PusherKind, appid, appdisplayname, devicedisplayname, profiletag, lang, data, localpart string,
|
pushkey string, pushkeyTS int64, kind api.PusherKind, appid, appdisplayname, devicedisplayname, profiletag, lang, data, localpart string,
|
||||||
) error {
|
) error {
|
||||||
_, err := sqlutil.TxStmt(txn, s.insertPusherStmt).ExecContext(ctx, localpart, session_id, pushkey, pushkeyTS, kind, appid, appdisplayname, devicedisplayname, profiletag, lang, data)
|
_, err := sqlutil.TxStmt(txn, s.insertPusherStmt).ExecContext(ctx, localpart, session_id, pushkey, pushkeyTS, kind, appid, appdisplayname, devicedisplayname, profiletag, lang, data)
|
||||||
logrus.Debugf("Created pusher %d", session_id)
|
logrus.Debugf("Created pusher %d", session_id)
|
||||||
|
@ -23,7 +23,6 @@ import (
|
|||||||
"github.com/matrix-org/dendrite/internal/sqlutil"
|
"github.com/matrix-org/dendrite/internal/sqlutil"
|
||||||
"github.com/matrix-org/dendrite/userapi/api"
|
"github.com/matrix-org/dendrite/userapi/api"
|
||||||
"github.com/matrix-org/dendrite/userapi/storage/tables"
|
"github.com/matrix-org/dendrite/userapi/storage/tables"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -95,7 +94,7 @@ type pushersStatements struct {
|
|||||||
// Returns nil error success.
|
// Returns nil error success.
|
||||||
func (s *pushersStatements) InsertPusher(
|
func (s *pushersStatements) InsertPusher(
|
||||||
ctx context.Context, txn *sql.Tx, session_id int64,
|
ctx context.Context, txn *sql.Tx, session_id int64,
|
||||||
pushkey string, pushkeyTS gomatrixserverlib.Timestamp, kind api.PusherKind, appid, appdisplayname, devicedisplayname, profiletag, lang, data, localpart string,
|
pushkey string, pushkeyTS int64, kind api.PusherKind, appid, appdisplayname, devicedisplayname, profiletag, lang, data, localpart string,
|
||||||
) error {
|
) error {
|
||||||
_, err := s.insertPusherStmt.ExecContext(ctx, localpart, session_id, pushkey, pushkeyTS, kind, appid, appdisplayname, devicedisplayname, profiletag, lang, data)
|
_, err := s.insertPusherStmt.ExecContext(ctx, localpart, session_id, pushkey, pushkeyTS, kind, appid, appdisplayname, devicedisplayname, profiletag, lang, data)
|
||||||
logrus.Debugf("Created pusher %d", session_id)
|
logrus.Debugf("Created pusher %d", session_id)
|
||||||
|
@ -21,7 +21,6 @@ import (
|
|||||||
|
|
||||||
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
|
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
|
||||||
"github.com/matrix-org/dendrite/userapi/api"
|
"github.com/matrix-org/dendrite/userapi/api"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type AccountDataTable interface {
|
type AccountDataTable interface {
|
||||||
@ -96,7 +95,7 @@ type ThreePIDTable interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PusherTable interface {
|
type PusherTable interface {
|
||||||
InsertPusher(ctx context.Context, txn *sql.Tx, session_id int64, pushkey string, pushkeyTS gomatrixserverlib.Timestamp, kind api.PusherKind, appid, appdisplayname, devicedisplayname, profiletag, lang, data, localpart string) error
|
InsertPusher(ctx context.Context, txn *sql.Tx, session_id int64, pushkey string, pushkeyTS int64, kind api.PusherKind, appid, appdisplayname, devicedisplayname, profiletag, lang, data, localpart string) error
|
||||||
SelectPushers(ctx context.Context, txn *sql.Tx, localpart string) ([]api.Pusher, error)
|
SelectPushers(ctx context.Context, txn *sql.Tx, localpart string) ([]api.Pusher, error)
|
||||||
DeletePusher(ctx context.Context, txn *sql.Tx, appid, pushkey, localpart string) error
|
DeletePusher(ctx context.Context, txn *sql.Tx, appid, pushkey, localpart string) error
|
||||||
DeletePushers(ctx context.Context, txn *sql.Tx, appid, pushkey string) error
|
DeletePushers(ctx context.Context, txn *sql.Tx, appid, pushkey string) error
|
||||||
|
Loading…
Reference in New Issue
Block a user