mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 22:22:46 +00:00
This PR adds a new consumer for typing notifications in syncapi. It also brings changes to syncserver.go and some related files so EDUs can better fit in /sync responses. Fixes #635. Fixes #574.
This commit is contained in:
parent
f8463063ac
commit
29841bed6b
19 changed files with 712 additions and 252 deletions
|
@ -57,15 +57,21 @@ func (t *TypingServerInputAPI) InputTypingEvent(
|
|||
}
|
||||
|
||||
func (t *TypingServerInputAPI) sendEvent(ite *api.InputTypingEvent) error {
|
||||
userIDs := t.Cache.GetTypingUsers(ite.RoomID)
|
||||
ev := &api.TypingEvent{
|
||||
Type: gomatrixserverlib.MTyping,
|
||||
RoomID: ite.RoomID,
|
||||
UserID: ite.UserID,
|
||||
Typing: ite.Typing,
|
||||
}
|
||||
ote := &api.OutputTypingEvent{
|
||||
Event: *ev,
|
||||
TypingUsers: userIDs,
|
||||
Event: *ev,
|
||||
}
|
||||
|
||||
if ev.Typing {
|
||||
expireTime := ite.OriginServerTS.Time().Add(
|
||||
time.Duration(ite.Timeout) * time.Millisecond,
|
||||
)
|
||||
ote.ExpireTime = &expireTime
|
||||
}
|
||||
|
||||
eventJSON, err := json.Marshal(ote)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue