From ecc471059c7a1f3972c65c17827538de43430f05 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Tue, 14 Jan 2020 10:57:36 -0500
Subject: [PATCH] message engine: retry messages for each new detected device

Change-Id: I01337b82106959cebd3e522d2051ee64a46a14de
---
 src/jamidht/jamiaccount.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp
index 99e08a4175..c23bd4fe4f 100644
--- a/src/jamidht/jamiaccount.cpp
+++ b/src/jamidht/jamiaccount.cpp
@@ -1589,6 +1589,10 @@ JamiAccount::trackPresence(const dht::InfoHash& h, BuddyInfo& buddy)
                 ++buddy->second.devices_cnt;
             isConnected = buddy->second.devices_cnt > 0;
         }
+        if (not expired) {
+            // Retry messages every time a new device announce its presence
+            messageEngine_.onPeerOnline(h.toString());
+        }
         if (isConnected and not wasConnected) {
             onTrackedBuddyOnline(h);
         } else if (not isConnected and wasConnected) {
@@ -1615,7 +1619,6 @@ JamiAccount::onTrackedBuddyOnline(const dht::InfoHash& contactId)
     JAMI_DBG("Buddy %s online", contactId.toString().c_str());
     std::string id(contactId.toString());
     emitSignal<DRing::PresenceSignal::NewBuddyNotification>(getAccountID(), id, 1,  "");
-    messageEngine_.onPeerOnline(id);
 }
 
 void
-- 
GitLab