Commit 8c254175 authored by Sébastien Blin's avatar Sébastien Blin

callmodel: handle conference's informations

Change-Id: Id32f6a03a7d4a7df9bc7c9b744002f847099713d
parent a05f5b93
......@@ -26,6 +26,8 @@
#include <ctime>
#include <chrono>
#include "typedefs.h"
namespace lrc
{
......@@ -143,6 +145,7 @@ struct Info
bool videoMuted = false;
bool isAudioOnly = false;
Layout layout = Layout::GRID;
VectorMapStringString participantsInfos = {};
};
static inline bool
......
......@@ -241,6 +241,11 @@ Q_SIGNALS:
* @param callId
*/
void callStatusChanged(const QString& callId, int code) const;
/**
* Emitted when the rendered image changed
* @param confId
*/
void onParticipantsChanged(const QString& confId) const;
/**
* Emitted when a call starts
* @param callId
......
......@@ -36,6 +36,7 @@
#include "dbus/callmanager.h"
#include "vcard.h"
#include "video/renderer.h"
#include "typedefs.h"
// Ring daemon
#include <media_const.h>
......@@ -183,6 +184,12 @@ public Q_SLOTS:
* @param urgentCount
*/
void slotVoiceMailNotify(const QString& accountId, int newCount, int oldCount, int urgentCount);
/**
* Listen from CallManager when a conference layout is updated
* @param confId
* @param infos
*/
void slotOnConferenceInfosUpdated(const QString& confId, const VectorMapStringString& infos);
};
NewCallModel::NewCallModel(const account::Info& owner, const CallbacksHandler& callbacksHandler)
......@@ -506,6 +513,7 @@ NewCallModelPimpl::NewCallModelPimpl(const NewCallModel& linked, const Callbacks
connect(&callbacksHandler, &CallbacksHandler::incomingVCardChunk, this, &NewCallModelPimpl::slotincomingVCardChunk);
connect(&callbacksHandler, &CallbacksHandler::conferenceCreated, this , &NewCallModelPimpl::slotConferenceCreated);
connect(&callbacksHandler, &CallbacksHandler::voiceMailNotify, this, &NewCallModelPimpl::slotVoiceMailNotify);
connect(&CallManager::instance(), &CallManagerInterface::onConferenceInfosUpdated, this, &NewCallModelPimpl::slotOnConferenceInfosUpdated);
#ifndef ENABLE_LIBWRAP
// Only necessary with dbus since the daemon runs separately
......@@ -543,6 +551,8 @@ NewCallModelPimpl::initCallFromDaemon()
callInfo->videoMuted = details["VIDEO_MUTED"] == "true";
callInfo->audioMuted = details["AUDIO_MUTED"] == "true";
callInfo->type = call::Type::DIALOG;
VectorMapStringString infos = CallManager::instance().getConferenceInfos(callId);
callInfo->participantsInfos = infos;
calls.emplace(callId, std::move(callInfo));
// NOTE/BUG: the videorenderer can't know that the client has restarted
// So, for now, a user will have to manually restart the medias until
......@@ -575,6 +585,8 @@ NewCallModelPimpl::initConferencesFromDaemon()
}
if (!isForThisAccount) break;
callInfo->type = call::Type::CONFERENCE;
VectorMapStringString infos = CallManager::instance().getConferenceInfos(callId);
callInfo->participantsInfos = infos;
calls.emplace(callId, std::move(callInfo));
}
}
......@@ -832,6 +844,23 @@ NewCallModelPimpl::slotVoiceMailNotify(const QString& accountId, int newCount, i
emit linked.voiceMailNotify(accountId, newCount, oldCount, urgentCount);
}
void
NewCallModelPimpl::slotOnConferenceInfosUpdated(const QString& confId, const VectorMapStringString& infos)
{
auto it = calls.find(confId);
if (it == calls.end() or not it->second)
return;
qDebug() << "New conference layout received for call " << confId;
// if Jami, remove @ring.dht
it->second->participantsInfos = infos;
for (auto& i: it->second->participantsInfos)
i["uri"].replace("@ring.dht", "");
emit linked.onParticipantsChanged(confId);
}
bool
NewCallModel::hasCall(const QString& callId) const
{
......@@ -850,7 +879,7 @@ NewCallModelPimpl::slotConferenceCreated(const QString& confId)
QStringList callList = CallManager::instance().getParticipantList(confId);
foreach(const auto& call, callList) {
emit linked.callAddedToConference(call, confId);
// Remove acll from pendingConferences_
// Remove call from pendingConferences_
pendingConferences_.erase(call);
}
......
......@@ -118,6 +118,11 @@ public:
LOG_DRING_SIGNAL2("onRtcpReportReceived",QString(callID.c_str()), convertStringInt(report));
Q_EMIT onRtcpReportReceived(QString(callID.c_str()), convertStringInt(report));
}),
exportable_callback<CallSignal::OnConferenceInfosUpdated>(
[this] (const std::string& confId, const std::vector<std::map<std::string, std::string>>& infos) {
LOG_DRING_SIGNAL2("onConferenceInfosUpdated",QString(confId.c_str()),convertVecMap(infos));
Q_EMIT onConferenceInfosUpdated(QString(confId.c_str()), convertVecMap(infos));
}),
exportable_callback<CallSignal::PeerHold>(
[this] (const std::string &callID, bool state) {
LOG_DRING_SIGNAL2("peerHold",QString(callID.c_str()), state);
......@@ -201,6 +206,14 @@ public Q_SLOTS: // METHODS
return temp;
}
VectorMapStringString getConferenceInfos(const QString &confId)
{
VectorMapStringString temp =
convertVecMap(DRing::getConferenceInfos(
confId.toStdString()));
return temp;
}
QString getConferenceId(const QString &callID)
{
QString temp(DRing::getConferenceId(callID.toStdString()).c_str());
......@@ -399,6 +412,7 @@ Q_SIGNALS: // SIGNALS
void conferenceRemoved(const QString &confID);
void recordingStateChanged(const QString &callID, bool recordingState);
void onRtcpReportReceived(const QString &callID, MapStringInt report);
void onConferenceInfosUpdated(const QString &confId, VectorMapStringString infos);
void audioMuted(const QString &callID, bool state);
void videoMuted(const QString &callID, bool state);
void peerHold(const QString &callID, bool state);
......
......@@ -722,7 +722,7 @@ public Q_SLOTS: // METHODS
}
bool setMessageDisplayed(const QString& accountId, const QString& contactId, const QString& messageId, int status) {
DRing::setMessageDisplayed(accountId.toStdString(), contactId.toStdString(), messageId.toStdString(), status);
return DRing::setMessageDisplayed(accountId.toStdString(), contactId.toStdString(), messageId.toStdString(), status);
}
Q_SIGNALS: // SIGNALS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment