summaryrefslogtreecommitdiff
path: root/daemon/notificationmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/notificationmanager.cpp')
-rw-r--r--daemon/notificationmanager.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/daemon/notificationmanager.cpp b/daemon/notificationmanager.cpp
index 0c56bc2..22f6967 100644
--- a/daemon/notificationmanager.cpp
+++ b/daemon/notificationmanager.cpp
@@ -114,7 +114,7 @@ uint NotificationManager::Notify(const QString &app_name, uint replaces_id, cons
Q_UNUSED(expire_timeout);
// new place to check notification owner in Sailfish 1.1.6
- QString owner = hints.value("x-nemo-owner", "Unknown").toString();
+ QString owner = hints.value("x-nemo-owner", "").toString();
qCDebug(l) << Q_FUNC_INFO << "Got notification via dbus from" << this->getCleanAppName(app_name) << " Owner: " << owner;
qCDebug(l) << hints;
@@ -124,22 +124,34 @@ uint NotificationManager::Notify(const QString &app_name, uint replaces_id, cons
Q_ASSERT(calledFromDBus());
setDelayedReply(true);
+ // Look up the notification category and its parameters
QString category = hints.value("category", "").toString();
QStringHash categoryParams = this->getCategoryParams(category);
+ // Ignore transient and hidden notifications (notif hints override category hints)
+ // Hack this to accept transient -preview and -summary notifications, as we don't know how to decode the actual notifs yet
+ if (hints.value("transient", categoryParams.value("transient", "false")).toString() == "true") {
+ qCDebug(l) << "Ignoring transient notification from " << owner;
+ return 0;
+ }
+ else if (hints.value("x-nemo-hidden", "false").toString() == "true" ) {
+ qCDebug(l) << "Ignoring hidden notification from " << owner;
+ return 0;
+ }
+
if (category == "x-nemo.email") {
if (!settings->property("notificationsEmails").toBool()) {
qCDebug(l) << "Ignoring email notification because of setting!";
return 0;
}
- emit this->emailNotify(summary, body, app_name);
+ emit this->emailNotify(app_name, body, summary);
}
else if (category == "x-nemo.call.missed") {
if (!settings->property("notificationsMissedCall").toBool()) {
qCDebug(l) << "Ignoring MissedCall notification because of setting!";
return 0;
}
- emit this->smsNotify(hints.value("x-nemo-preview-summary", summary).toString(),
+ emit this->missedCallNotify(hints.value("x-nemo-preview-summary", summary).toString(),
hints.value("x-nemo-preview-body", body).toString()
);
}
@@ -152,7 +164,8 @@ uint NotificationManager::Notify(const QString &app_name, uint replaces_id, cons
hints.value("x-nemo-preview-body", body).toString()
);
}
- else if (app_name.toLower().contains("whatsapp") || app_name.toLower().contains("whatsup")) {
+ else if (hints.value("x-nemo-origin-package").toString() == "com.whatsapp"
+ || owner.toLower().contains("whatsup")) {
if (!settings->property("notificationsWhatsapp").toBool()) {
qCDebug(l) << "Ignoring whatsapp notification because of setting!";
return 0;
@@ -171,12 +184,13 @@ uint NotificationManager::Notify(const QString &app_name, uint replaces_id, cons
hints.value("x-nemo-preview-body", body).toString()
);
}
- else if (app_name.toLower().contains("hangouts") || app_name.toLower().contains("hangish")) {
+ else if (hints.value("x-nemo-origin-package").toString() == "com.google.android.apps.babel"
+ || owner == "harbour-hangish") {
if (!settings->property("notificationsHangouts").toBool()) {
qCDebug(l) << "Ignoring telegram notification because of setting!";
return 0;
}
- emit this->hangoutNotify(hints.value("x-nemo-preview-summary", summary).toString(),
+ emit this->hangoutsNotify(hints.value("x-nemo-preview-summary", summary).toString(),
hints.value("x-nemo-preview-body", body).toString()
);
}
@@ -191,14 +205,6 @@ uint NotificationManager::Notify(const QString &app_name, uint replaces_id, cons
);
} else {
- // Ignore transient notifications (notif hints override category hints)
- // Hack this to accept transient -preview and -summary notifications, as we don't know how to decode the actual notifs yet
- if (!category.endsWith("preview") && !category.endsWith("summary") &&
- hints.value("transient", categoryParams.value("transient", "false")).toString() == "true") {
- qCDebug(l) << "Ignoring transient notification from " << owner;
- return 0;
- }
-
// Prioritize x-nemo-preview* over dbus direct summary and body
QString subject = hints.value("x-nemo-preview-summary", summary).toString();
QString data = hints.value("x-nemo-preview-body", body).toString();