diff --git a/callwidget.cpp b/callwidget.cpp index c95e60789fd617dc26005c9fb322b65d726fe7ee..aa58ff547c444a77278a45e972ec3b254e89ef4f 100644 --- a/callwidget.cpp +++ b/callwidget.cpp @@ -213,7 +213,7 @@ CallWidget::CallWidget(QWidget* parent) : [this](const std::string& accountId, const std::string& conversation, uint64_t interactionId, const interaction::Info& interaction) { if (LRCInstance::getCurrAccId() != accountId) { - onIncomingMessage(accountId, conversation, interactionId, interaction); + onNewInteraction(accountId, conversation, interactionId, interaction); } }); @@ -304,7 +304,7 @@ CallWidget::getLeftPanelWidth() } void -CallWidget::onIncomingMessage(const std::string& accountId, const std::string& convUid, +CallWidget::onNewInteraction(const std::string& accountId, const std::string& convUid, uint64_t interactionId, const interaction::Info& interaction) { Q_UNUSED(interactionId); @@ -315,7 +315,8 @@ CallWidget::onIncomingMessage(const std::string& accountId, const std::string& c if (conversation.uid.empty()) { return; } - if (!QApplication::focusWidget() || LRCInstance::getCurrAccId() != accountId) { + if (!interaction.authorUri.empty() && + (!QApplication::focusWidget() || LRCInstance::getCurrAccId() != accountId)) { auto bestName = Utils::bestNameForConversation(conversation, *convModel); Utils::showSystemNotification(this, QString::fromStdString(bestName), @@ -1164,7 +1165,7 @@ CallWidget::connectConversationModel() [this](const std::string& convUid, uint64_t interactionId, const lrc::api::interaction::Info& interaction) { auto accountId = LRCInstance::getCurrAccId(); - onIncomingMessage(accountId, convUid, interactionId, interaction); + onNewInteraction(accountId, convUid, interactionId, interaction); } ); interactionRemovedConnection_ = QObject::connect( diff --git a/callwidget.h b/callwidget.h index fe05fa65a9af59081bc225ede22600c718c967a1..64ee7a447d5f446445e7a01b8d1de67f883a4ebb 100644 --- a/callwidget.h +++ b/callwidget.h @@ -105,7 +105,7 @@ private slots: private: void callTerminating(const std::string& callid); - void onIncomingMessage(const std::string& accountId, const std::string& convUid, + void onNewInteraction(const std::string& accountId, const std::string& convUid, uint64_t interactionId, const lrc::api::interaction::Info& interaction); void conversationsButtonClicked(); void invitationsButtonClicked(); diff --git a/utils.cpp b/utils.cpp index d9e59d8c257ddca3313a1cede62e7219f1f8b319..6e3a3deeec1ec58c17f95087177fb1f3157884fa 100644 --- a/utils.cpp +++ b/utils.cpp @@ -272,20 +272,18 @@ Utils::setStackWidget(QStackedWidget* stack, QWidget* widget) } } -void Utils::showSystemNotification(QWidget* widget, const QString & message, long delay) +void Utils::showSystemNotification(QWidget* widget, const QString& message, long delay) { GlobalSystemTray::instance().showMessage(message, "", QIcon(":images/jami.png")); QApplication::alert(widget, delay); } void Utils::showSystemNotification(QWidget* widget, - const QString & sender, - const QString & message, - long delay) + const QString & sender, + const QString & message, + long delay) { - QIcon(); - GlobalSystemTray::instance() - .showMessage(sender, message, QIcon(":images/jami.png")); + GlobalSystemTray::instance().showMessage(sender, message, QIcon(":images/jami.png")); QApplication::alert(widget, delay); }