diff --git a/src/api/newcallmodel.h b/src/api/newcallmodel.h index dbf8b5499f6400e1ec84dec9819d5aa5a396d6e9..af80deec6240153f06cc4b817b108ce97b2c7304 100644 --- a/src/api/newcallmodel.h +++ b/src/api/newcallmodel.h @@ -251,6 +251,15 @@ Q_SIGNALS: */ void callAddedToConference(const std::string& callId, const std::string& confId) const; + /** + * Emitted when a voice mail notice arrives + * @param accountId + * @param newCount + * @param oldCount + * @param urgentCount + */ + void voiceMailNotify(const std::string& accountId, int newCount, int oldCount, int urgentCount) const; + private: std::unique_ptr<NewCallModelPimpl> pimpl_; }; diff --git a/src/callbackshandler.cpp b/src/callbackshandler.cpp index fbda0d06669db5487848981f7db125aacd1ed9d0..e043aa90c6bee9f81ca47ec11fcb2dff3a8453b6 100644 --- a/src/callbackshandler.cpp +++ b/src/callbackshandler.cpp @@ -145,6 +145,12 @@ CallbacksHandler::CallbacksHandler(const Lrc& parent) &CallbacksHandler::slotIncomingMessage, Qt::QueuedConnection); + connect(&CallManager::instance(), + &CallManagerInterface::voiceMailNotify, + this, + &CallbacksHandler::slotVoiceMailNotify, + Qt::QueuedConnection); + connect(&ConfigurationManager::instance(), &ConfigurationManagerInterface::dataTransferEvent, this, @@ -264,6 +270,12 @@ CallbacksHandler::slotNearbyPeerSubscription(const QString& accountId, emit newPeerSubscription(accountId.toStdString(), contactUri.toStdString(), state, displayname.toStdString()); } +void +CallbacksHandler::slotVoiceMailNotify(const QString& accountId, int newCount, int oldCount, int urgentCount) +{ + emit voiceMailNotify(accountId.toStdString(), newCount, oldCount, urgentCount); +} + void CallbacksHandler::slotContactAdded(const QString& accountId, const QString& contactUri, diff --git a/src/callbackshandler.h b/src/callbackshandler.h index 4f38a3062b6b075a92ca29e3bfb7821f68e5307e..ab1e69bd1263080f7e24825ede5a95172f77b5ec 100644 --- a/src/callbackshandler.h +++ b/src/callbackshandler.h @@ -268,6 +268,15 @@ Q_SIGNALS: */ void audioMeter(const std::string& id, float level); + /** + * Emitted when an audio level is received + * @param accountId + * @param newCount + * @param oldCount + * @param urgentCount + */ + void voiceMailNotify(const std::string& accountId, int newCount, int oldCount, int urgentCount); + private Q_SLOTS: /** * Emit newAccountMessage @@ -488,6 +497,18 @@ private Q_SLOTS: int state, const QString& displayname); + /** + * Emit voiceMailNotify + * @param accountId + * @param new VM + * @param old VM + * @param new Urgent VM + */ + void slotVoiceMailNotify(const QString& accountId, + int newCount, + int oldCount, + int urgentCount); + private: const api::Lrc& parent; }; diff --git a/src/newcallmodel.cpp b/src/newcallmodel.cpp index 4d8e74d108b40daeb93fb45e30299697ea3a70dd..b75425ae1b3b739bf1e1cb42c1c8f3579d7c7059 100644 --- a/src/newcallmodel.cpp +++ b/src/newcallmodel.cpp @@ -166,6 +166,14 @@ public Q_SLOTS: * @param callId */ void slotConferenceCreated(const std::string& callId); + /** + * Listen from CallbacksHandler when a voice mail notice is incoming + * @param accountId + * @param newCount + * @param oldCount + * @param urgentCount + */ + void slotVoiceMailNotify(const std::string& accountId, int newCount, int oldCount, int urgentCount); }; NewCallModel::NewCallModel(const account::Info& owner, const CallbacksHandler& callbacksHandler) @@ -423,6 +431,7 @@ NewCallModelPimpl::NewCallModelPimpl(const NewCallModel& linked, const Callbacks connect(&callbacksHandler, &CallbacksHandler::callStateChanged, this, &NewCallModelPimpl::slotCallStateChanged); connect(&callbacksHandler, &CallbacksHandler::incomingVCardChunk, this, &NewCallModelPimpl::slotincomingVCardChunk); connect(&callbacksHandler, &CallbacksHandler::conferenceCreated, this , &NewCallModelPimpl::slotConferenceCreated); + connect(&callbacksHandler, &CallbacksHandler::voiceMailNotify, this, &NewCallModelPimpl::slotVoiceMailNotify); #ifndef ENABLE_LIBWRAP // Only necessary with dbus since the daemon runs separately @@ -630,6 +639,12 @@ NewCallModelPimpl::slotincomingVCardChunk(const std::string& callId, } } +void +NewCallModelPimpl::slotVoiceMailNotify(const std::string & accountId, int newCount, int oldCount, int urgentCount) +{ + emit linked.voiceMailNotify(accountId, newCount, oldCount, urgentCount); +} + bool NewCallModel::hasCall(const std::string& callId) const { diff --git a/src/qtwrapper/callmanager_wrap.h b/src/qtwrapper/callmanager_wrap.h index 89abadafaf5837ce1437137c7357686463e9ca05..65ea7259c4fad8714eca242d23f63770c3390c6d 100644 --- a/src/qtwrapper/callmanager_wrap.h +++ b/src/qtwrapper/callmanager_wrap.h @@ -69,9 +69,9 @@ public: Q_EMIT recordPlaybackStopped(QString(filepath.c_str())); }), exportable_callback<CallSignal::VoiceMailNotify>( - [this] (const std::string &accountID, int count) { - LOG_DRING_SIGNAL2("voiceMailNotify",QString(accountID.c_str()), count); - Q_EMIT voiceMailNotify(QString(accountID.c_str()), count); + [this] (const std::string &accountId, int newCount, int oldCount, int urgentCount) { + LOG_DRING_SIGNAL4("voiceMailNotify",QString(accountId.c_str()), newCount, oldCount, urgentCount); + Q_EMIT voiceMailNotify(QString(accountId.c_str()), newCount, oldCount, urgentCount); }), exportable_callback<CallSignal::IncomingMessage>( [this] (const std::string &callID, const std::string &from, const std::map<std::string,std::string> &message) { @@ -373,7 +373,7 @@ Q_SIGNALS: // SIGNALS void transferFailed(); void transferSucceeded(); void recordPlaybackStopped(const QString &filepath); - void voiceMailNotify(const QString &accountID, int count); + void voiceMailNotify(const QString &accountId, int newCount, int oldCount, int urgentCount); void incomingMessage(const QString &callID, const QString &from, const MapStringString &message); void incomingCall(const QString &accountID, const QString &callID, const QString &from); void recordPlaybackFilepath(const QString &callID, const QString &filepath); diff --git a/test/mocks/callmanager_mock.h b/test/mocks/callmanager_mock.h index b28e35cdea3f3afbaa3c5ef0ea2581f0bb5570b6..071d9808b69cece8d647b15dcb237b1dc8837354 100644 --- a/test/mocks/callmanager_mock.h +++ b/test/mocks/callmanager_mock.h @@ -302,7 +302,7 @@ Q_SIGNALS: // SIGNALS void transferFailed(); void transferSucceeded(); void recordPlaybackStopped(const QString &filepath); - void voiceMailNotify(const QString &accountID, int count); + void voiceMailNotify(const QString &accountId, int newCount, int oldCount, int urgentCount); void incomingMessage(const QString &callID, const QString &from, const MapStringString &message); void incomingCall(const QString &accountID, const QString &callID, const QString &from); void recordPlaybackFilepath(const QString &callID, const QString &filepath);