From 5cd2b26d0f9b762b3e56637113f28b2c71d55784 Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Tue, 16 Jul 2013 12:54:20 +0200 Subject: [PATCH] compare summary & body when looking for duplicates this way similar notifications with different progres hint are seen as duplicates. fix #114 --- notification.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/notification.c b/notification.c index cfe086e..cbf5894 100644 --- a/notification.c +++ b/notification.c @@ -319,8 +319,14 @@ int notification_init(notification * n, int id) iter = iter->next) { notification *orig = iter->data; if (strcmp(orig->appname, n->appname) == 0 - && strcmp(orig->msg, n->msg) == 0) { + && strcmp(orig->summary, n->summary) == 0 + && strcmp(orig->body, n->body) == 0) { orig->dup_count++; + /* notifications that differ only in progress hints should be expected equal, + * but we want the latest message, with the latest hint value + */ + free(orig->msg); + orig->msg = strdup(n->msg); notification_free(n); wake_up(); return orig->id; @@ -331,7 +337,13 @@ int notification_init(notification * n, int id) iter = iter->next) { notification *orig = iter->data; if (strcmp(orig->appname, n->appname) == 0 - && strcmp(orig->msg, n->msg) == 0) { + && strcmp(orig->summary, n->summary) == 0 + && strcmp(orig->body, n->body) == 0) { + /* notifications that differ only in progress hints should be expected equal, + * but we want the latest message, with the latest hint value + */ + free(orig->msg); + orig->msg = strdup(n->msg); orig->dup_count++; orig->start = time(NULL); notification_free(n);