diff --git a/src/github.com/matrix-org/dendrite/federationsender/consumers/typingserver.go b/src/github.com/matrix-org/dendrite/federationsender/consumers/typingserver.go index 20ba350b2..ddc926f0d 100644 --- a/src/github.com/matrix-org/dendrite/federationsender/consumers/typingserver.go +++ b/src/github.com/matrix-org/dendrite/federationsender/consumers/typingserver.go @@ -20,7 +20,7 @@ import ( "github.com/matrix-org/dendrite/common/config" "github.com/matrix-org/dendrite/federationsender/queue" "github.com/matrix-org/dendrite/federationsender/storage" - "github.com/matrix-org/dendrite/typingserver/dummy/api" + "github.com/matrix-org/dendrite/typingserver/api" "github.com/matrix-org/gomatrixserverlib" log "github.com/sirupsen/logrus" "gopkg.in/Shopify/sarama.v1" @@ -71,7 +71,7 @@ func (t *OutputTypingEventConsumer) onMessage(msg *sarama.ConsumerMessage) error return nil } - joined, err := t.db.GetJoinedHosts(context.TODO(), ote.Event.RoomID()) + joined, err := t.db.GetJoinedHosts(context.TODO(), ote.Event.RoomID) if err != nil { return err } @@ -81,5 +81,17 @@ func (t *OutputTypingEventConsumer) onMessage(msg *sarama.ConsumerMessage) error names[i] = joined[i].ServerName } - return t.queues.SendEvent(&ote.Event, t.ServerName, names) + edu := &gomatrixserverlib.EDU{ + Type: ote.Event.Type, + Origin: string(t.ServerName), + } + if edu.Content, err = json.Marshal(map[string]interface{}{ + "room_id": ote.Event.RoomID, + "user_id": ote.Event.UserID, + "typing": ote.Event.Typing, + }); err != nil { + return err + } + + return t.queues.SendEDU(edu, t.ServerName, names) } diff --git a/src/github.com/matrix-org/dendrite/typingserver/dummy/api/api.go b/src/github.com/matrix-org/dendrite/typingserver/dummy/api/api.go deleted file mode 100644 index 3533a3a26..000000000 --- a/src/github.com/matrix-org/dendrite/typingserver/dummy/api/api.go +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package api - -import "github.com/matrix-org/gomatrixserverlib" - -// TODO: Remove this package after, typingserver/api is updated to contain a gomatrixserverlib.Event - -// OutputTypingEvent is an entry in typing server output kafka log. -type OutputTypingEvent struct { - // The Event for the typing edu event. - Event gomatrixserverlib.Event `json:"event"` -}