Update common.BuildEvent

This commit is contained in:
Neil Alexander 2020-03-06 11:23:11 +00:00
parent 85e658ca06
commit a4401e3fb0

View file

@ -47,16 +47,17 @@ func BuildEvent(
return nil, err
}
fmt.Println("BUILDING EVENT FOR ROOM", builder.RoomID)
roomVersion := 2
vQueryReq := api.QueryRoomVersionForRoomIDRequest{RoomID: builder.RoomID}
vQueryRes := api.QueryRoomVersionForRoomIDResponse{}
if e := queryAPI.QueryRoomVersionForRoomID(ctx, &vQueryReq, &vQueryRes); e != nil {
fmt.Println("Eaux neaux, an error occured:", e)
if e := queryAPI.QueryRoomVersionForRoomID(ctx, &vQueryReq, &vQueryRes); e == nil {
roomVersion = vQueryRes.RoomVersion
}
fmt.Println("Building event for", roomVersion)
fmt.Println("ROOM VERSION IS", roomVersion)
// FIXME: Why don't we delegate to the BuildEvent function from
// gomatrixserverlib here?
// TODO: Room versions affect the below
eventID := fmt.Sprintf("$%s:%s", util.RandomString(16), cfg.Matrix.ServerName)
event, err := builder.Build(eventID, evTime, cfg.Matrix.ServerName, cfg.Matrix.KeyID, cfg.Matrix.PrivateKey)