about summary refs log tree commit diff
path: root/MatrixAntiDmSpam.Core/RoomInviteHandler.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-05-24 21:17:17 +0200
committerRory& <root@rory.gay>2025-05-24 21:17:17 +0200
commit56a9125672968b7c11b6d138fb3ca1851fe7e90e (patch)
treef918e9075840e9d483a7e23427f4b0a9b8f68c38 /MatrixAntiDmSpam.Core/RoomInviteHandler.cs
parentImplement hook that runs *before* rejecting an invite (diff)
downloadMatrixAntiDmSpam-master.tar.xz
Make rejecting invites not depend on having a log room configured HEAD master
Diffstat (limited to '')
-rw-r--r--MatrixAntiDmSpam.Core/RoomInviteHandler.cs9
1 files changed, 3 insertions, 6 deletions
diff --git a/MatrixAntiDmSpam.Core/RoomInviteHandler.cs b/MatrixAntiDmSpam.Core/RoomInviteHandler.cs

index 41f4011..d4d97d6 100644 --- a/MatrixAntiDmSpam.Core/RoomInviteHandler.cs +++ b/MatrixAntiDmSpam.Core/RoomInviteHandler.cs
@@ -55,9 +55,9 @@ public class RoomInviteHandler(ILogger<RoomInviteHandler> logger, AntiDmSpamConf var message = new MessageBuilder() .WithBody("Received invite to ").WithMention(invite.RoomId, await roomNameTask).WithBody(" from ").WithMention(invite.MemberEvent.Sender!, await inviterNameTask) .Build(); - + message.AdditionalData!["gay.rory.invite_logger.invite_data_uri"] = JsonDocument.Parse($"\"{await inviteDataFileUriTask}\"").RootElement; - + await LogRoom.SendMessageEventAsync(message); if (config.LogInviteDataAsFile) { @@ -71,10 +71,7 @@ public class RoomInviteHandler(ILogger<RoomInviteHandler> logger, AntiDmSpamConf } } - public async Task RejectInvite(RoomInviteContext invite, MessageBuilder reason) { - if (LogRoom is not null) - _ = LogRoom.SendMessageEventAsync(reason.Build()); - + public async Task RejectInvite(RoomInviteContext invite) { try { await invite.Homeserver.GetRoom(invite.RoomId).LeaveAsync(); }