From 66c7cd61b5d719bff58b6beb7c0dc5c46926cacf Mon Sep 17 00:00:00 2001
From: Nicolas Jager <nicolas.jager@savoirfairelinux.com>
Date: Wed, 24 Jan 2018 12:01:33 -0500
Subject: [PATCH] rename newUnreadMessage to newInteraction
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- newUnreadMessage was used only for messages. It will soon be used for
  data transfer.

- WARNING : all lrc clients need to be updated

Change-Id: Ie7b48767b36ea449c2405d796ed6faa6ea02ba51
Reviewed-by: Anthony Léonard <anthony.leonard@savoirfairelinux.com>
---
 src/api/conversationmodel.h |  7 ++++---
 src/conversationmodel.cpp   | 10 +++++-----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/api/conversationmodel.h b/src/api/conversationmodel.h
index 795604f7..6a2a2af4 100644
--- a/src/api/conversationmodel.h
+++ b/src/api/conversationmodel.h
@@ -155,10 +155,11 @@ public:
 Q_SIGNALS:
     /**
      * Emitted when a conversation receives a new interaction
-     * @param uid of msg
-     * @param msg
+     * @param uid of conversation
+     * @param interactionId
+     * @param interactionInfo
      */
-    void newUnreadMessage(const std::string& uid, uint64_t msgId, const interaction::Info& msg) const; // [jn] rendre cette fonction plus générique en remplaçant message par interaction
+    void newInteraction(const std::string& uid, uint64_t interactionId, const interaction::Info& interactionInfo) const;
     /**
      * Emitted when an interaction got a new status
      * @param convUid conversation which owns the interaction
diff --git a/src/conversationmodel.cpp b/src/conversationmodel.cpp
index f1195270..7f34fc70 100644
--- a/src/conversationmodel.cpp
+++ b/src/conversationmodel.cpp
@@ -549,7 +549,7 @@ ConversationModel::sendMessage(const std::string& uid, const std::string& body)
     conversation.lastMessageUid = msgId;
     pimpl_->dirtyConversations = true;
     // Emit this signal for chatview in the client
-    emit newUnreadMessage(convId, msgId, msg);
+    emit newInteraction(convId, msgId, msg);
     // This conversation is now at the top of the list
     pimpl_->sortConversations();
     // The order has changed, informs the client to redraw the list
@@ -863,7 +863,7 @@ ConversationModelPimpl::slotPendingContactAccepted(const std::string& uri)
             auto conversationIdx = indexOf(conv[0]);
             conversations[conversationIdx].interactions.emplace(msgId, msg);
             dirtyConversations = true;
-            emit linked.newUnreadMessage(conv[0], msgId, msg);
+            emit linked.newInteraction(conv[0], msgId, msg);
         } catch (std::out_of_range& e) {
             qDebug() << "ConversationModelPimpl::slotContactAdded can't find contact";
         }
@@ -1073,7 +1073,7 @@ ConversationModelPimpl::addOrUpdateCallMessage(const std::string& callId, const
             }
             dirtyConversations = true;
             if (newInteraction)
-                emit linked.newUnreadMessage(conversation.uid, msgId, msg);
+                emit linked.newInteraction(conversation.uid, msgId, msg);
             else
                 emit linked.interactionStatusUpdated(conversation.uid, msgId, msg);
             sortConversations();
@@ -1143,7 +1143,7 @@ ConversationModelPimpl::addIncomingMessage(const std::string& from,
         conversations[conversationIdx].lastMessageUid = msgId;
     }
     dirtyConversations = true;
-    emit linked.newUnreadMessage(conv[0], msgId, msg);
+    emit linked.newInteraction(conv[0], msgId, msg);
     sortConversations();
     emit linked.modelSorted();
 }
@@ -1231,7 +1231,7 @@ ConversationModelPimpl::slotIncomingTransfer(const std::string& uid,
                                              const std::size_t size,
                                              const std::size_t offset)
 {
-    emit linked.newUnreadMessage("", -1, {});
+    emit linked.newInteraction("", -1, {});
 }
 
 void
-- 
GitLab