Commit 8dd6d762 authored by Moritz Brunner's avatar Moritz Brunner Committed by Sébastien Blin

ringnotify: make notification id for chat unique

Gitlab: #1025
Change-Id: I6e643cd8a4dc3276a07f51385713232419eafab1
Reviewed-by: Sébastien Blin's avatarSébastien Blin <sebastien.blin@savoirfairelinux.com>
parent c0d7d32f
...@@ -402,8 +402,8 @@ private: ...@@ -402,8 +402,8 @@ private:
void slotNewTrustRequest(const std::string& id, const std::string& contactUri); void slotNewTrustRequest(const std::string& id, const std::string& contactUri);
void slotCloseTrustRequest(const std::string& id, const std::string& contactUri); void slotCloseTrustRequest(const std::string& id, const std::string& contactUri);
void slotNewInteraction(const std::string& accountId, const std::string& conversation, void slotNewInteraction(const std::string& accountId, const std::string& conversation,
uint64_t, const lrc::api::interaction::Info& interaction); uint64_t interactionId, const lrc::api::interaction::Info& interaction);
void slotCloseInteraction(const std::string& accountId, const std::string& conversation, uint64_t); void slotCloseInteraction(const std::string& accountId, const std::string& conversation, uint64_t interactionId);
void slotProfileUpdated(const std::string& id); void slotProfileUpdated(const std::string& id);
}; };
...@@ -850,10 +850,11 @@ action_notification(gchar* title, RingMainWindow* self, Action action) ...@@ -850,10 +850,11 @@ action_notification(gchar* title, RingMainWindow* self, Action action)
if (firstMarker == std::string::npos) return; if (firstMarker == std::string::npos) return;
auto secondMarker = titleStr.find(":", firstMarker + 1); auto secondMarker = titleStr.find(":", firstMarker + 1);
if (secondMarker == std::string::npos) return; if (secondMarker == std::string::npos) return;
auto thirdMarker = titleStr.find(":", secondMarker + 1);
auto id = titleStr.substr(0, firstMarker); auto id = titleStr.substr(0, firstMarker);
auto type = titleStr.substr(firstMarker + 1, secondMarker - firstMarker - 1); auto type = titleStr.substr(firstMarker + 1, secondMarker - firstMarker - 1);
auto information = titleStr.substr(secondMarker + 1); auto information = titleStr.substr(secondMarker + 1, thirdMarker - secondMarker - 1);
if (action == Action::SELECT) { if (action == Action::SELECT) {
// Select conversation // Select conversation
...@@ -2375,7 +2376,7 @@ CppImpl::slotCloseTrustRequest(const std::string& id, const std::string& contact ...@@ -2375,7 +2376,7 @@ CppImpl::slotCloseTrustRequest(const std::string& id, const std::string& contact
void void
CppImpl::slotNewInteraction(const std::string& accountId, const std::string& conversation, CppImpl::slotNewInteraction(const std::string& accountId, const std::string& conversation,
uint64_t, const lrc::api::interaction::Info& interaction) uint64_t interactionId, const lrc::api::interaction::Info& interaction)
{ {
if (chatViewConversation_ && chatViewConversation_->uid == conversation) { if (chatViewConversation_ && chatViewConversation_->uid == conversation) {
auto *old_view = gtk_bin_get_child(GTK_BIN(widgets->frame_call)); auto *old_view = gtk_bin_get_child(GTK_BIN(widgets->frame_call));
...@@ -2388,7 +2389,7 @@ CppImpl::slotNewInteraction(const std::string& accountId, const std::string& con ...@@ -2388,7 +2389,7 @@ CppImpl::slotNewInteraction(const std::string& accountId, const std::string& con
} }
try { try {
auto& accountInfo = lrc_->getAccountModel().getAccountInfo(accountId); auto& accountInfo = lrc_->getAccountModel().getAccountInfo(accountId);
auto notifId = accountInfo.id + ":interaction:" + conversation; auto notifId = accountInfo.id + ":interaction:" + conversation + ":" + std::to_string(interactionId);
auto& contactModel = accountInfo.contactModel; auto& contactModel = accountInfo.contactModel;
auto& conversationModel = accountInfo.conversationModel; auto& conversationModel = accountInfo.conversationModel;
for (const auto& conv : conversationModel->allFilteredConversations()) for (const auto& conv : conversationModel->allFilteredConversations())
...@@ -2425,7 +2426,7 @@ CppImpl::slotNewInteraction(const std::string& accountId, const std::string& con ...@@ -2425,7 +2426,7 @@ CppImpl::slotNewInteraction(const std::string& accountId, const std::string& con
} }
void void
CppImpl::slotCloseInteraction(const std::string& accountId, const std::string& conversation, uint64_t) CppImpl::slotCloseInteraction(const std::string& accountId, const std::string& conversation, uint64_t interactionId)
{ {
if (!gtk_window_is_active(GTK_WINDOW(self)) if (!gtk_window_is_active(GTK_WINDOW(self))
|| (chatViewConversation_ && chatViewConversation_->uid != conversation)) { || (chatViewConversation_ && chatViewConversation_->uid != conversation)) {
...@@ -2433,7 +2434,7 @@ CppImpl::slotCloseInteraction(const std::string& accountId, const std::string& c ...@@ -2433,7 +2434,7 @@ CppImpl::slotCloseInteraction(const std::string& accountId, const std::string& c
} }
try { try {
auto& accountInfo = lrc_->getAccountModel().getAccountInfo(accountId); auto& accountInfo = lrc_->getAccountModel().getAccountInfo(accountId);
auto notifId = accountInfo.id + ":interaction:" + conversation; auto notifId = accountInfo.id + ":interaction:" + conversation + ":" + std::to_string(interactionId);
ring_hide_notification(RING_NOTIFIER(widgets->notifier), notifId); ring_hide_notification(RING_NOTIFIER(widgets->notifier), notifId);
} catch (...) { } catch (...) {
g_warning("Can't get account %s", accountId.c_str()); g_warning("Can't get account %s", accountId.c_str());
......
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