From ce70f18d2aafbf81154b5bec5087d631288a2d12 Mon Sep 17 00:00:00 2001
From: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
Date: Fri, 28 Jun 2019 16:41:04 -0400
Subject: [PATCH] lrc: add status code to callStatusChanged signal

Change-Id: I2279c8a59b7dc3f33fba3b703b20b78e24a21d48
---
 src/api/newcallmodel.h    | 2 +-
 src/conversationmodel.cpp | 5 +++--
 src/newcallmodel.cpp      | 5 ++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/api/newcallmodel.h b/src/api/newcallmodel.h
index da82a839..65138c49 100644
--- a/src/api/newcallmodel.h
+++ b/src/api/newcallmodel.h
@@ -197,7 +197,7 @@ Q_SIGNALS:
      * Emitted when a call state changes
      * @param callId
      */
-    void callStatusChanged(const std::string& callId) const;
+    void callStatusChanged(const std::string& callId, int code) const;
     /**
      * Emitted when a call starts
      * @param callId
diff --git a/src/conversationmodel.cpp b/src/conversationmodel.cpp
index 74573643..7609d1af 100644
--- a/src/conversationmodel.cpp
+++ b/src/conversationmodel.cpp
@@ -208,7 +208,7 @@ public Q_SLOTS:
      * Listen from callmodel for calls status changed.
      * @param callId
      */
-    void slotCallStatusChanged(const std::string& callId);
+    void slotCallStatusChanged(const std::string& callId, int code);
     /**
      * Listen from callmodel for writing "Call started"
      * @param callId
@@ -1499,8 +1499,9 @@ ConversationModelPimpl::slotIncomingCall(const std::string& fromId, const std::s
 }
 
 void
-ConversationModelPimpl::slotCallStatusChanged(const std::string& callId)
+ConversationModelPimpl::slotCallStatusChanged(const std::string& callId, int code)
 {
+    Q_UNUSED(code)
     // Get conversation
     auto i = std::find_if(
         conversations.begin(), conversations.end(),
diff --git a/src/newcallmodel.cpp b/src/newcallmodel.cpp
index 537ecac0..cb9dc2b5 100644
--- a/src/newcallmodel.cpp
+++ b/src/newcallmodel.cpp
@@ -506,7 +506,6 @@ NewCallModelPimpl::slotIncomingCall(const std::string& accountId, const std::str
 void
 NewCallModelPimpl::slotCallStateChanged(const std::string& callId, const std::string& state, int code)
 {
-    Q_UNUSED(code)
     if (!linked.hasCall(callId)) return;
 
     auto status = call::to_status(state);
@@ -514,7 +513,7 @@ NewCallModelPimpl::slotCallStateChanged(const std::string& callId, const std::st
 
     if (status == call::Status::ENDED && !call::isTerminating(call->status)) {
         call->status = call::Status::TERMINATING;
-        emit linked.callStatusChanged(callId);
+        emit linked.callStatusChanged(callId, code);
     }
 
     // proper state transition
@@ -530,7 +529,7 @@ NewCallModelPimpl::slotCallStateChanged(const std::string& callId, const std::st
          call::to_string(previousStatus).c_str(), call::to_string(status).c_str());
 
     // NOTE: signal emission order matters, always emit CallStatusChanged before CallEnded
-    emit linked.callStatusChanged(callId);
+    emit linked.callStatusChanged(callId, code);
 
     if (call->status == call::Status::ENDED) {
         emit linked.callEnded(callId);
-- 
GitLab