mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 08:13:09 -06:00
Add presence to eduserver
This commit is contained in:
parent
ebdae1f0c1
commit
2ae8084fd3
|
|
@ -75,6 +75,17 @@ type InputReceiptEventRequest struct {
|
|||
// InputReceiptEventResponse is a response to InputReceiptEventRequest
|
||||
type InputReceiptEventResponse struct{}
|
||||
|
||||
// InputPresenceRequest is a request to EDUServerInputAPI
|
||||
type InputPresenceRequest struct {
|
||||
UserID string `json:"user_id"`
|
||||
Status string `json:"status"`
|
||||
StatusMsg string `json:"status_msg"`
|
||||
Timestamp gomatrixserverlib.Timestamp `json:"timestamp"`
|
||||
}
|
||||
|
||||
// InputPresenceResponse is a response to InputPresenceRequest
|
||||
type InputPresenceResponse struct{}
|
||||
|
||||
// EDUServerInputAPI is used to write events to the typing server.
|
||||
type EDUServerInputAPI interface {
|
||||
InputTypingEvent(
|
||||
|
|
@ -94,4 +105,10 @@ type EDUServerInputAPI interface {
|
|||
request *InputReceiptEventRequest,
|
||||
response *InputReceiptEventResponse,
|
||||
) error
|
||||
|
||||
InputPresence(
|
||||
ctx context.Context,
|
||||
request *InputPresenceRequest,
|
||||
response *InputPresenceResponse,
|
||||
) error
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,3 +85,11 @@ type FederationReceiptData struct {
|
|||
Data ReceiptTS `json:"data"`
|
||||
EventIDs []string `json:"event_ids"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,3 +86,20 @@ func SendReceipt(
|
|||
response := InputReceiptEventResponse{}
|
||||
return eduAPI.InputReceiptEvent(ctx, &request, &response)
|
||||
}
|
||||
|
||||
// SetPresence sends a presence change to the EDU Server
|
||||
func SetPresence(
|
||||
ctx context.Context,
|
||||
eduAPI EDUServerInputAPI,
|
||||
userID, status, statusMsg string,
|
||||
timestamp gomatrixserverlib.Timestamp,
|
||||
) error {
|
||||
request := InputPresenceRequest{
|
||||
UserID: userID,
|
||||
Status: status,
|
||||
StatusMsg: statusMsg,
|
||||
Timestamp: timestamp,
|
||||
}
|
||||
response := InputPresenceResponse{}
|
||||
return eduAPI.InputPresence(ctx, &request, &response)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue