aboutsummaryrefslogtreecommitdiff
path: root/internal/eventutil
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-11-15 15:05:23 +0000
committerNeil Alexander <neilalexander@users.noreply.github.com>2022-11-15 15:05:23 +0000
commit6650712a1c0dec282b47b7ba14bc8c2e06a385d8 (patch)
tree12ca755c5c33d3489417f9355dda3f1b7983c779 /internal/eventutil
parentf4ee3977340c84d321767d347795b1dcd05ac459 (diff)
Federation fixes for virtual hosting
Diffstat (limited to 'internal/eventutil')
-rw-r--r--internal/eventutil/events.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/internal/eventutil/events.go b/internal/eventutil/events.go
index d9623196..c572d883 100644
--- a/internal/eventutil/events.go
+++ b/internal/eventutil/events.go
@@ -38,7 +38,8 @@ var ErrRoomNoExists = errors.New("room does not exist")
// Returns an error if something else went wrong
func QueryAndBuildEvent(
ctx context.Context,
- builder *gomatrixserverlib.EventBuilder, cfg *config.Global, evTime time.Time,
+ builder *gomatrixserverlib.EventBuilder, cfg *config.Global,
+ identity *gomatrixserverlib.SigningIdentity, evTime time.Time,
rsAPI api.QueryLatestEventsAndStateAPI, queryRes *api.QueryLatestEventsAndStateResponse,
) (*gomatrixserverlib.HeaderedEvent, error) {
if queryRes == nil {
@@ -50,24 +51,24 @@ func QueryAndBuildEvent(
// This can pass through a ErrRoomNoExists to the caller
return nil, err
}
- return BuildEvent(ctx, builder, cfg, evTime, eventsNeeded, queryRes)
+ return BuildEvent(ctx, builder, cfg, identity, evTime, eventsNeeded, queryRes)
}
// BuildEvent builds a Matrix event from the builder and QueryLatestEventsAndStateResponse
// provided.
func BuildEvent(
ctx context.Context,
- builder *gomatrixserverlib.EventBuilder, cfg *config.Global, evTime time.Time,
+ builder *gomatrixserverlib.EventBuilder, cfg *config.Global,
+ identity *gomatrixserverlib.SigningIdentity, evTime time.Time,
eventsNeeded *gomatrixserverlib.StateNeeded, queryRes *api.QueryLatestEventsAndStateResponse,
) (*gomatrixserverlib.HeaderedEvent, error) {
- err := addPrevEventsToEvent(builder, eventsNeeded, queryRes)
- if err != nil {
+ if err := addPrevEventsToEvent(builder, eventsNeeded, queryRes); err != nil {
return nil, err
}
event, err := builder.Build(
- evTime, cfg.ServerName, cfg.KeyID,
- cfg.PrivateKey, queryRes.RoomVersion,
+ evTime, identity.ServerName, identity.KeyID,
+ identity.PrivateKey, queryRes.RoomVersion,
)
if err != nil {
return nil, err