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