From 43be1a828c9c0e9f54ce7c14388203e437fa4bbd Mon Sep 17 00:00:00 2001
From: Taras Smakula <tarassmakula@gmail.com>
Date: Tue, 3 Jan 2023 15:30:29 +0200
Subject: [PATCH] Implement knock

---
 .../session/room/membership/DefaultMembershipService.kt    | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/DefaultMembershipService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/DefaultMembershipService.kt
index 20708b38..ae7f6246 100644
--- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/DefaultMembershipService.kt
+++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/DefaultMembershipService.kt
@@ -44,6 +44,7 @@ import org.matrix.android.sdk.internal.query.process
 import org.matrix.android.sdk.internal.session.room.RoomDataSource
 import org.matrix.android.sdk.internal.session.room.membership.admin.MembershipAdminTask
 import org.matrix.android.sdk.internal.session.room.membership.joining.InviteTask
+import org.matrix.android.sdk.internal.session.room.membership.joining.KnockTask
 import org.matrix.android.sdk.internal.session.room.membership.threepid.InviteThreePidTask
 import org.matrix.android.sdk.internal.util.fetchCopied
 
@@ -54,6 +55,7 @@ internal class DefaultMembershipService @AssistedInject constructor(
         private val inviteTask: InviteTask,
         private val inviteThreePidTask: InviteThreePidTask,
         private val membershipAdminTask: MembershipAdminTask,
+        private val knockTask: KnockTask,
         private val roomDataSource: RoomDataSource,
         private val cryptoService: CryptoService,
         @UserId
@@ -164,4 +166,9 @@ internal class DefaultMembershipService @AssistedInject constructor(
         val params = InviteThreePidTask.Params(roomId, threePid)
         return inviteThreePidTask.execute(params)
     }
+
+    override suspend fun knock(userId: String, reason: String?) {
+        val params = KnockTask.Params(roomId, reason)
+        knockTask.execute(params)
+    }
 }
-- 
GitLab