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:
void slotNewTrustRequest(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,
uint64_t, const lrc::api::interaction::Info& interaction);
void slotCloseInteraction(const std::string& accountId, const std::string& conversation, uint64_t);
uint64_t interactionId, const lrc::api::interaction::Info& interaction);
void slotCloseInteraction(const std::string& accountId, const std::string& conversation, uint64_t interactionId);
void slotProfileUpdated(const std::string& id);
};
......@@ -850,10 +850,11 @@ action_notification(gchar* title, RingMainWindow* self, Action action)
if (firstMarker == std::string::npos) return;
auto secondMarker = titleStr.find(":", firstMarker + 1);
if (secondMarker == std::string::npos) return;
auto thirdMarker = titleStr.find(":", secondMarker + 1);
auto id = titleStr.substr(0, firstMarker);
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) {
// Select conversation
......@@ -2375,7 +2376,7 @@ CppImpl::slotCloseTrustRequest(const std::string& id, const std::string& contact
void
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) {
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
}
try {
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& conversationModel = accountInfo.conversationModel;
for (const auto& conv : conversationModel->allFilteredConversations())
......@@ -2425,7 +2426,7 @@ CppImpl::slotNewInteraction(const std::string& accountId, const std::string& con
}
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))
|| (chatViewConversation_ && chatViewConversation_->uid != conversation)) {
......@@ -2433,7 +2434,7 @@ CppImpl::slotCloseInteraction(const std::string& accountId, const std::string& c
}
try {
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);
} catch (...) {
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