mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-29 01:33:10 -06:00
Add missing files
This commit is contained in:
parent
f759107604
commit
bf8211b654
|
|
@ -20,6 +20,7 @@ package api
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"github.com/matrix-org/dendrite/userapi/types"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -77,10 +78,10 @@ type InputReceiptEventResponse struct{}
|
||||||
|
|
||||||
// InputPresenceRequest is a request to EDUServerInputAPI
|
// InputPresenceRequest is a request to EDUServerInputAPI
|
||||||
type InputPresenceRequest struct {
|
type InputPresenceRequest struct {
|
||||||
UserID string `json:"user_id"`
|
UserID string `json:"user_id"`
|
||||||
Status string `json:"status"`
|
Presence types.PresenceStatus `json:"status"`
|
||||||
StatusMsg string `json:"status_msg"`
|
StatusMsg string `json:"status_msg"`
|
||||||
Timestamp gomatrixserverlib.Timestamp `json:"timestamp"`
|
LastActiveTS gomatrixserverlib.Timestamp `json:"timestamp"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// InputPresenceResponse is a response to InputPresenceRequest
|
// InputPresenceResponse is a response to InputPresenceRequest
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package api
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/matrix-org/dendrite/userapi/types"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -88,8 +89,9 @@ type FederationReceiptData struct {
|
||||||
|
|
||||||
// OutputPresence is an entry in the presence output kafka log
|
// OutputPresence is an entry in the presence output kafka log
|
||||||
type OutputPresence struct {
|
type OutputPresence struct {
|
||||||
UserID string `json:"user_id"`
|
UserID string `json:"user_id"`
|
||||||
Status string `json:"status"`
|
Presence types.PresenceStatus `json:"presence"`
|
||||||
StatusMsg string `json:"status_msg"`
|
StatusMsg string `json:"status_msg,omitempty"`
|
||||||
Timestamp gomatrixserverlib.Timestamp `json:"timestamp"`
|
LastActiveTS gomatrixserverlib.Timestamp `json:"-"`
|
||||||
|
LastActiveAgo int64 `json:"last_active_ago,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/matrix-org/dendrite/userapi/types"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -91,14 +92,15 @@ func SendReceipt(
|
||||||
func SetPresence(
|
func SetPresence(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
eduAPI EDUServerInputAPI,
|
eduAPI EDUServerInputAPI,
|
||||||
userID, status, statusMsg string,
|
userID, statusMsg string,
|
||||||
|
presence types.PresenceStatus,
|
||||||
timestamp gomatrixserverlib.Timestamp,
|
timestamp gomatrixserverlib.Timestamp,
|
||||||
) error {
|
) error {
|
||||||
request := InputPresenceRequest{
|
request := InputPresenceRequest{
|
||||||
UserID: userID,
|
UserID: userID,
|
||||||
Status: status,
|
Presence: presence,
|
||||||
StatusMsg: statusMsg,
|
StatusMsg: statusMsg,
|
||||||
Timestamp: timestamp,
|
LastActiveTS: timestamp,
|
||||||
}
|
}
|
||||||
response := InputPresenceResponse{}
|
response := InputPresenceResponse{}
|
||||||
return eduAPI.InputPresence(ctx, &request, &response)
|
return eduAPI.InputPresence(ctx, &request, &response)
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ func NewInternalAPI(
|
||||||
OutputTypingEventTopic: cfg.Matrix.Kafka.TopicFor(config.TopicOutputTypingEvent),
|
OutputTypingEventTopic: cfg.Matrix.Kafka.TopicFor(config.TopicOutputTypingEvent),
|
||||||
OutputSendToDeviceEventTopic: cfg.Matrix.Kafka.TopicFor(config.TopicOutputSendToDeviceEvent),
|
OutputSendToDeviceEventTopic: cfg.Matrix.Kafka.TopicFor(config.TopicOutputSendToDeviceEvent),
|
||||||
OutputReceiptEventTopic: cfg.Matrix.Kafka.TopicFor(config.TopicOutputReceiptEvent),
|
OutputReceiptEventTopic: cfg.Matrix.Kafka.TopicFor(config.TopicOutputReceiptEvent),
|
||||||
|
OutputPresenceTopic: cfg.Matrix.Kafka.TopicFor(config.TopicOutputPresenceData),
|
||||||
ServerName: cfg.Matrix.ServerName,
|
ServerName: cfg.Matrix.ServerName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -218,14 +218,14 @@ func (t *EDUServerInputAPI) InputPresence(
|
||||||
) error {
|
) error {
|
||||||
logrus.WithFields(logrus.Fields{
|
logrus.WithFields(logrus.Fields{
|
||||||
"user_id": request.UserID,
|
"user_id": request.UserID,
|
||||||
"status": request.Status,
|
"status": request.Presence,
|
||||||
"status_msg": request.StatusMsg,
|
"status_msg": request.StatusMsg,
|
||||||
}).Infof("Producing to topic '%s'", t.OutputPresenceTopic)
|
}).Infof("Producing to topic '%s'", t.OutputPresenceTopic)
|
||||||
output := &api.OutputPresence{
|
output := &api.OutputPresence{
|
||||||
UserID: request.UserID,
|
UserID: request.UserID,
|
||||||
Status: request.Status,
|
Presence: request.Presence,
|
||||||
StatusMsg: request.StatusMsg,
|
StatusMsg: request.StatusMsg,
|
||||||
Timestamp: request.Timestamp,
|
LastActiveTS: request.LastActiveTS,
|
||||||
}
|
}
|
||||||
js, err := json.Marshal(output)
|
js, err := json.Marshal(output)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ const (
|
||||||
TopicOutputRoomEvent = "OutputRoomEvent"
|
TopicOutputRoomEvent = "OutputRoomEvent"
|
||||||
TopicOutputClientData = "OutputClientData"
|
TopicOutputClientData = "OutputClientData"
|
||||||
TopicOutputReceiptEvent = "OutputReceiptEvent"
|
TopicOutputReceiptEvent = "OutputReceiptEvent"
|
||||||
|
TopicOutputPresenceData = "OutputPresenceData"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Kafka struct {
|
type Kafka struct {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue