notification: wait for cloning conversation

https://git.jami.net/savoirfairelinux/jami-daemon/-/issues/776
Change-Id: Ia314c1a9cc7cbac2fc349916e3bb31a96068e590
diff --git a/Ring/jamiNotificationExtension/Adapter.mm b/Ring/jamiNotificationExtension/Adapter.mm
index 4e310d8..b47264a 100644
--- a/Ring/jamiNotificationExtension/Adapter.mm
+++ b/Ring/jamiNotificationExtension/Adapter.mm
@@ -126,6 +126,15 @@
             }
         }));
 
+    confHandlers.insert(exportable_callback<ConversationSignal::ConversationCloned>(
+        [weakDelegate = Adapter.delegate](const std::string& account_id) {
+            id<AdapterDelegate> delegate = weakDelegate;
+            if (delegate) {
+                NSString* accountId = [NSString stringWithUTF8String:account_id.c_str()];
+                [delegate conversationClonedWithAccountId:accountId];
+            }
+        }));
+
     confHandlers.insert(exportable_callback<ConversationSignal::ConversationRequestReceived>([weakDelegate = Adapter.delegate](const std::string& accountId, const std::string& conversationId, std::map<std::string, std::string> metadata) {
         id<AdapterDelegate> delegate = weakDelegate;
         if (delegate) {
@@ -238,6 +247,10 @@
             // this value is not a PeerConnectionRequest
             // check if it a TrustRequest
             auto conversationRequest = unpacked.get().as<dht::TrustRequest>();
+            if (conversationRequest.confirm) {
+                // request confirmation. We need to wait for conversation to clone
+                return @{@"": @"application/clone"};
+            }
             if (!conversationRequest.conversationId.empty()) {
                 if (conversationRequest.service == "cx.ring") {
                     // return git message type to start daemon