mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-07 02:23:19 +02:00
conversationmodel: listen for profile changes
Change-Id: I76b0fe1d35fa38ffe82812bc1c97b2565ceb9318
This commit is contained in:
parent
b46acb12d3
commit
c99b409d46
4 changed files with 180 additions and 41 deletions
|
@ -308,6 +308,11 @@ CallbacksHandler::CallbacksHandler(const Lrc& parent)
|
|||
this,
|
||||
&CallbacksHandler::slotMessageReceived,
|
||||
Qt::QueuedConnection);
|
||||
connect(&ConfigurationManager::instance(),
|
||||
&ConfigurationManagerInterface::conversationProfileUpdated,
|
||||
this,
|
||||
&CallbacksHandler::slotConversationProfileUpdated,
|
||||
Qt::QueuedConnection);
|
||||
connect(&ConfigurationManager::instance(),
|
||||
&ConfigurationManagerInterface::conversationRequestReceived,
|
||||
this,
|
||||
|
@ -743,6 +748,14 @@ CallbacksHandler::slotMessageReceived(const QString& accountId,
|
|||
Q_EMIT messageReceived(accountId, conversationId, message);
|
||||
}
|
||||
|
||||
void
|
||||
CallbacksHandler::slotConversationProfileUpdated(const QString& accountId,
|
||||
const QString& conversationId,
|
||||
const MapStringString& profile)
|
||||
{
|
||||
Q_EMIT conversationProfileUpdated(accountId, conversationId, profile);
|
||||
}
|
||||
|
||||
void
|
||||
CallbacksHandler::slotConversationRequestReceived(const QString& accountId,
|
||||
const QString& conversationId,
|
||||
|
|
|
@ -353,6 +353,9 @@ Q_SIGNALS:
|
|||
void messageReceived(const QString& accountId,
|
||||
const QString& conversationId,
|
||||
const MapStringString& message);
|
||||
void conversationProfileUpdated(const QString& accountId,
|
||||
const QString& conversationId,
|
||||
const MapStringString& profile);
|
||||
void conversationRequestReceived(const QString& accountId,
|
||||
const QString& conversationId,
|
||||
const MapStringString& metadatas);
|
||||
|
@ -661,6 +664,9 @@ private Q_SLOTS:
|
|||
void slotMessageReceived(const QString& accountId,
|
||||
const QString& conversationId,
|
||||
const MapStringString& message);
|
||||
void slotConversationProfileUpdated(const QString& accountId,
|
||||
const QString& conversationId,
|
||||
const MapStringString& message);
|
||||
void slotConversationRequestReceived(const QString& accountId,
|
||||
const QString& conversationId,
|
||||
const MapStringString& metadatas);
|
||||
|
|
|
@ -363,6 +363,9 @@ public Q_SLOTS:
|
|||
void slotMessageReceived(const QString& accountId,
|
||||
const QString& conversationId,
|
||||
const MapStringString& message);
|
||||
void slotConversationProfileUpdated(const QString& accountId,
|
||||
const QString& conversationId,
|
||||
const MapStringString& profile);
|
||||
void slotConversationRequestReceived(const QString& accountId,
|
||||
const QString& conversationId,
|
||||
const MapStringString& metadatas);
|
||||
|
@ -1804,6 +1807,10 @@ ConversationModelPimpl::ConversationModelPimpl(const ConversationModel& linked,
|
|||
&CallbacksHandler::messageReceived,
|
||||
this,
|
||||
&ConversationModelPimpl::slotMessageReceived);
|
||||
connect(&callbacksHandler,
|
||||
&CallbacksHandler::conversationProfileUpdated,
|
||||
this,
|
||||
&ConversationModelPimpl::slotConversationProfileUpdated);
|
||||
connect(&callbacksHandler,
|
||||
&CallbacksHandler::conversationRequestReceived,
|
||||
this,
|
||||
|
@ -1940,6 +1947,10 @@ ConversationModelPimpl::~ConversationModelPimpl()
|
|||
&CallbacksHandler::messageReceived,
|
||||
this,
|
||||
&ConversationModelPimpl::slotMessageReceived);
|
||||
disconnect(&callbacksHandler,
|
||||
&CallbacksHandler::conversationProfileUpdated,
|
||||
this,
|
||||
&ConversationModelPimpl::slotConversationProfileUpdated);
|
||||
disconnect(&callbacksHandler,
|
||||
&CallbacksHandler::conversationRequestReceived,
|
||||
this,
|
||||
|
@ -2340,15 +2351,7 @@ ConversationModelPimpl::slotMessageReceived(const QString& accountId,
|
|||
}
|
||||
try {
|
||||
auto& conversation = getConversationForUid(conversationId).get();
|
||||
if (message["type"].isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (message["type"] == "application/update-profile") {
|
||||
// Refresh infos
|
||||
MapStringString details = ConfigurationManager::instance()
|
||||
.conversationInfos(linked.owner.id, conversationId);
|
||||
conversation.infos = details;
|
||||
Q_EMIT linked.profileUpdated(conversationId);
|
||||
if (message["type"].isEmpty() || message["type"] == "application/update-profile") {
|
||||
return;
|
||||
}
|
||||
if (message["type"] == "initial") {
|
||||
|
@ -2428,6 +2431,22 @@ ConversationModelPimpl::slotMessageReceived(const QString& accountId,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ConversationModelPimpl::slotConversationProfileUpdated(const QString& accountId,
|
||||
const QString& conversationId,
|
||||
const MapStringString& profile)
|
||||
{
|
||||
if (accountId != linked.owner.id) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
auto& conversation = getConversationForUid(conversationId).get();
|
||||
conversation.infos = profile;
|
||||
Q_EMIT linked.profileUpdated(conversationId);
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ConversationModelPimpl::insertSwarmInteraction(const QString& interactionId,
|
||||
const interaction::Info& interaction,
|
||||
|
@ -2583,14 +2602,14 @@ ConversationModelPimpl::slotConversationRemoved(const QString& accountId,
|
|||
removeConversation();
|
||||
|
||||
if (conversation.mode == conversation::Mode::ONE_TO_ONE) {
|
||||
|
||||
// If it's a 1:1 conversation and we don't have any more conversation
|
||||
// we can remove the contact
|
||||
auto contactRemoved = true;
|
||||
try {
|
||||
auto& conv = getConversationForPeerUri(contactUri).get();
|
||||
contactRemoved = !conv.isSwarm();
|
||||
} catch (...) {}
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
if (contact.isBanned && contactRemoved) {
|
||||
// Add 1:1 conv for banned
|
||||
|
|
|
@ -288,6 +288,14 @@ public:
|
|||
QString(conversationId.c_str()),
|
||||
convertMap(message));
|
||||
}),
|
||||
exportable_callback<ConversationSignal::ConversationProfileUpdated>(
|
||||
[this](const std::string& accountId,
|
||||
const std::string& conversationId,
|
||||
const std::map<std::string, std::string>& profile) {
|
||||
Q_EMIT conversationProfileUpdated(QString(accountId.c_str()),
|
||||
QString(conversationId.c_str()),
|
||||
convertMap(profile));
|
||||
}),
|
||||
exportable_callback<ConversationSignal::ConversationRequestReceived>(
|
||||
[this](const std::string& accountId,
|
||||
const std::string& conversationId,
|
||||
|
@ -508,11 +516,20 @@ public Q_SLOTS: // METHODS
|
|||
return temp;
|
||||
}
|
||||
|
||||
int getHistoryLimit() { return DRing::getHistoryLimit(); }
|
||||
int getHistoryLimit()
|
||||
{
|
||||
return DRing::getHistoryLimit();
|
||||
}
|
||||
|
||||
bool getIsAlwaysRecording() { return DRing::getIsAlwaysRecording(); }
|
||||
bool getIsAlwaysRecording()
|
||||
{
|
||||
return DRing::getIsAlwaysRecording();
|
||||
}
|
||||
|
||||
bool getNoiseSuppressState() { return DRing::getNoiseSuppressState(); }
|
||||
bool getNoiseSuppressState()
|
||||
{
|
||||
return DRing::getNoiseSuppressState();
|
||||
}
|
||||
|
||||
QString getRecordPath()
|
||||
{
|
||||
|
@ -520,9 +537,15 @@ public Q_SLOTS: // METHODS
|
|||
return temp;
|
||||
}
|
||||
|
||||
bool getRecordPreview() { return DRing::getRecordPreview(); }
|
||||
bool getRecordPreview()
|
||||
{
|
||||
return DRing::getRecordPreview();
|
||||
}
|
||||
|
||||
int getRecordQuality() { return DRing::getRecordQuality(); }
|
||||
int getRecordQuality()
|
||||
{
|
||||
return DRing::getRecordQuality();
|
||||
}
|
||||
|
||||
QStringList getSupportedAudioManagers()
|
||||
{
|
||||
|
@ -580,27 +603,60 @@ public Q_SLOTS: // METHODS
|
|||
return temp;
|
||||
}
|
||||
|
||||
double getVolume(const QString& device) { return DRing::getVolume(device.toStdString()); }
|
||||
double getVolume(const QString& device)
|
||||
{
|
||||
return DRing::getVolume(device.toStdString());
|
||||
}
|
||||
|
||||
bool isAgcEnabled() { return DRing::isAgcEnabled(); }
|
||||
bool isAgcEnabled()
|
||||
{
|
||||
return DRing::isAgcEnabled();
|
||||
}
|
||||
|
||||
bool isCaptureMuted() { return DRing::isCaptureMuted(); }
|
||||
bool isCaptureMuted()
|
||||
{
|
||||
return DRing::isCaptureMuted();
|
||||
}
|
||||
|
||||
bool isDtmfMuted() { return DRing::isDtmfMuted(); }
|
||||
bool isDtmfMuted()
|
||||
{
|
||||
return DRing::isDtmfMuted();
|
||||
}
|
||||
|
||||
bool isPlaybackMuted() { return DRing::isPlaybackMuted(); }
|
||||
bool isPlaybackMuted()
|
||||
{
|
||||
return DRing::isPlaybackMuted();
|
||||
}
|
||||
|
||||
void muteCapture(bool mute) { DRing::muteCapture(mute); }
|
||||
void muteCapture(bool mute)
|
||||
{
|
||||
DRing::muteCapture(mute);
|
||||
}
|
||||
|
||||
void muteDtmf(bool mute) { DRing::muteDtmf(mute); }
|
||||
void muteDtmf(bool mute)
|
||||
{
|
||||
DRing::muteDtmf(mute);
|
||||
}
|
||||
|
||||
void mutePlayback(bool mute) { DRing::mutePlayback(mute); }
|
||||
void mutePlayback(bool mute)
|
||||
{
|
||||
DRing::mutePlayback(mute);
|
||||
}
|
||||
|
||||
void registerAllAccounts() { DRing::registerAllAccounts(); }
|
||||
void registerAllAccounts()
|
||||
{
|
||||
DRing::registerAllAccounts();
|
||||
}
|
||||
|
||||
void monitor(bool continuous) { DRing::monitor(continuous); }
|
||||
void monitor(bool continuous)
|
||||
{
|
||||
DRing::monitor(continuous);
|
||||
}
|
||||
|
||||
void removeAccount(const QString& accountID) { DRing::removeAccount(accountID.toStdString()); }
|
||||
void removeAccount(const QString& accountID)
|
||||
{
|
||||
DRing::removeAccount(accountID.toStdString());
|
||||
}
|
||||
|
||||
bool changeAccountPassword(const QString& id,
|
||||
const QString& currentPassword,
|
||||
|
@ -621,7 +677,10 @@ public Q_SLOTS: // METHODS
|
|||
DRing::setAccountDetails(accountID.toStdString(), convertMap(details));
|
||||
}
|
||||
|
||||
void setAccountsOrder(const QString& order) { DRing::setAccountsOrder(order.toStdString()); }
|
||||
void setAccountsOrder(const QString& order)
|
||||
{
|
||||
DRing::setAccountsOrder(order.toStdString());
|
||||
}
|
||||
|
||||
void setActiveCodecList(const QString& accountID, VectorUInt& list)
|
||||
{
|
||||
|
@ -630,20 +689,35 @@ public Q_SLOTS: // METHODS
|
|||
std::vector<unsigned>(list.begin(), list.end()));
|
||||
}
|
||||
|
||||
void setAgcState(bool enabled) { DRing::setAgcState(enabled); }
|
||||
void setAgcState(bool enabled)
|
||||
{
|
||||
DRing::setAgcState(enabled);
|
||||
}
|
||||
|
||||
void setAudioInputDevice(int index) { DRing::setAudioInputDevice(index); }
|
||||
void setAudioInputDevice(int index)
|
||||
{
|
||||
DRing::setAudioInputDevice(index);
|
||||
}
|
||||
|
||||
bool setAudioManager(const QString& api) { return DRing::setAudioManager(api.toStdString()); }
|
||||
bool setAudioManager(const QString& api)
|
||||
{
|
||||
return DRing::setAudioManager(api.toStdString());
|
||||
}
|
||||
|
||||
void setAudioOutputDevice(int index) { DRing::setAudioOutputDevice(index); }
|
||||
void setAudioOutputDevice(int index)
|
||||
{
|
||||
DRing::setAudioOutputDevice(index);
|
||||
}
|
||||
|
||||
void setAudioPlugin(const QString& audioPlugin)
|
||||
{
|
||||
DRing::setAudioPlugin(audioPlugin.toStdString());
|
||||
}
|
||||
|
||||
void setAudioRingtoneDevice(int index) { DRing::setAudioRingtoneDevice(index); }
|
||||
void setAudioRingtoneDevice(int index)
|
||||
{
|
||||
DRing::setAudioRingtoneDevice(index);
|
||||
}
|
||||
|
||||
void setCredentials(const QString& accountID, VectorMapStringString credentialInformation)
|
||||
{
|
||||
|
@ -654,11 +728,20 @@ public Q_SLOTS: // METHODS
|
|||
DRing::setCredentials(accountID.toStdString(), temp);
|
||||
}
|
||||
|
||||
void setHistoryLimit(int days) { DRing::setHistoryLimit(days); }
|
||||
void setHistoryLimit(int days)
|
||||
{
|
||||
DRing::setHistoryLimit(days);
|
||||
}
|
||||
|
||||
void setIsAlwaysRecording(bool enabled) { DRing::setIsAlwaysRecording(enabled); }
|
||||
void setIsAlwaysRecording(bool enabled)
|
||||
{
|
||||
DRing::setIsAlwaysRecording(enabled);
|
||||
}
|
||||
|
||||
void setNoiseSuppressState(bool state) { DRing::setNoiseSuppressState(state); }
|
||||
void setNoiseSuppressState(bool state)
|
||||
{
|
||||
DRing::setNoiseSuppressState(state);
|
||||
}
|
||||
|
||||
bool isAudioMeterActive(const QString& id)
|
||||
{
|
||||
|
@ -670,11 +753,20 @@ public Q_SLOTS: // METHODS
|
|||
DRing::setAudioMeterState(id.toStdString(), state);
|
||||
}
|
||||
|
||||
void setRecordPath(const QString& rec) { DRing::setRecordPath(rec.toStdString()); }
|
||||
void setRecordPath(const QString& rec)
|
||||
{
|
||||
DRing::setRecordPath(rec.toStdString());
|
||||
}
|
||||
|
||||
void setRecordPreview(const bool& rec) { DRing::setRecordPreview(rec); }
|
||||
void setRecordPreview(const bool& rec)
|
||||
{
|
||||
DRing::setRecordPreview(rec);
|
||||
}
|
||||
|
||||
void setRecordQuality(const int& quality) { DRing::setRecordQuality(quality); }
|
||||
void setRecordQuality(const int& quality)
|
||||
{
|
||||
DRing::setRecordQuality(quality);
|
||||
}
|
||||
|
||||
void setVolume(const QString& device, double value)
|
||||
{
|
||||
|
@ -795,14 +887,20 @@ public Q_SLOTS: // METHODS
|
|||
return DRing::setCodecDetails(accountId.toStdString(), codecId, convertMap(details));
|
||||
}
|
||||
|
||||
int getMessageStatus(uint64_t id) { return DRing::getMessageStatus(id); }
|
||||
int getMessageStatus(uint64_t id)
|
||||
{
|
||||
return DRing::getMessageStatus(id);
|
||||
}
|
||||
|
||||
MapStringString getNearbyPeers(const QString& accountID)
|
||||
{
|
||||
return convertMap(DRing::getNearbyPeers(accountID.toStdString()));
|
||||
}
|
||||
|
||||
void connectivityChanged() { DRing::connectivityChanged(); }
|
||||
void connectivityChanged()
|
||||
{
|
||||
DRing::connectivityChanged();
|
||||
}
|
||||
|
||||
MapStringString getContactDetails(const QString& accountID, const QString& uri)
|
||||
{
|
||||
|
@ -1121,6 +1219,9 @@ Q_SIGNALS: // SIGNALS
|
|||
void messageReceived(const QString& accountId,
|
||||
const QString& conversationId,
|
||||
const MapStringString& message);
|
||||
void conversationProfileUpdated(const QString& accountId,
|
||||
const QString& conversationId,
|
||||
const MapStringString& profile);
|
||||
void conversationRequestReceived(const QString& accountId,
|
||||
const QString& conversationId,
|
||||
const MapStringString& metadatas);
|
||||
|
|
Loading…
Add table
Reference in a new issue