From 9379af23ec08622d9c0719654a2e78d9f2d71cc4 Mon Sep 17 00:00:00 2001
From: Adrien Beraud <adreien.beraud@savoirfairelinux.com>
Date: Wed, 5 Jun 2024 09:51:47 -0400
Subject: [PATCH] callmodel: don't send profile

profile was not saved at reception anymore, this was wasting bandwidth

Change-Id: I3cbc1f1683a1e5a4b14616404cde5e27e07623e5
---
 src/libclient/callmodel.cpp | 32 --------------------------------
 1 file changed, 32 deletions(-)

diff --git a/src/libclient/callmodel.cpp b/src/libclient/callmodel.cpp
index 373c0f3a5..6e3dc741e 100644
--- a/src/libclient/callmodel.cpp
+++ b/src/libclient/callmodel.cpp
@@ -145,12 +145,6 @@ public:
 
     QStringList getCallIds();
 
-    /**
-     * Send the profile VCard into a call
-     * @param callId
-     */
-    void sendProfile(const QString& callId);
-
     CallModel::CallInfoMap calls;
     CallModel::CallParticipantsModelMap participantsModel;
     const CallbacksHandler& callbacksHandler;
@@ -1550,7 +1544,6 @@ CallModelPimpl::slotCallStateChanged(const QString& accountId,
             || previousStatus == call::Status::OUTGOING_RINGING) {
             call->startTime = std::chrono::steady_clock::now();
             Q_EMIT linked.callStarted(callId);
-            sendProfile(callId);
         }
         // Add to calls if in pendingConferences_
         for (int i = 0; i < pendingConferencees_.size(); ++i) {
@@ -1783,31 +1776,6 @@ CallModelPimpl::slotConferenceChanged(const QString& accountId,
     Q_EMIT linked.currentCallChanged(currentCall_);
 }
 
-void
-CallModelPimpl::sendProfile(const QString& callId)
-{
-    auto vCard = linked.owner.accountModel->accountVCard(linked.owner.id);
-
-    std::random_device rdev;
-    auto key = std::to_string(dis(rdev));
-
-    int i = 0;
-    int total = vCard.size() / 1000 + (vCard.size() % 1000 ? 1 : 0);
-    while (vCard.size()) {
-        auto sizeLimit = std::min(1000, static_cast<int>(vCard.size()));
-        MapStringString chunk;
-        chunk[QString("%1; id=%2,part=%3,of=%4")
-                  .arg(lrc::vCard::PROFILE_VCF)
-                  .arg(key.c_str())
-                  .arg(QString::number(i + 1))
-                  .arg(QString::number(total))]
-            = vCard.left(sizeLimit);
-        vCard.remove(0, sizeLimit);
-        ++i;
-        CallManager::instance().sendTextMessage(linked.owner.id, callId, chunk, false);
-    }
-}
-
 void
 CallModelPimpl::onRemoteRecordingChanged(const QString& callId, const QString& peerUri, bool state)
 {
-- 
GitLab