prevent notification loops
This commit is contained in:
parent
f724133f31
commit
7713c61fdb
|
@ -54,6 +54,19 @@ public:
|
|||
|
||||
bool isBroadcasted() const;
|
||||
|
||||
/**
|
||||
* Sets the source SnorePlugin.
|
||||
* @see source()
|
||||
*/
|
||||
void setSource(const SnorePlugin *soure);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the source SnorePlugin.
|
||||
* This is used to prevent notification loops between the frontend and the backend.
|
||||
*/
|
||||
const SnorePlugin* source() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(NotificationData)
|
||||
|
||||
|
@ -74,6 +87,7 @@ private:
|
|||
QScopedPointer<QTimer> m_timeoutTimer;
|
||||
QSet<const QObject *> m_activeIn;
|
||||
bool m_isBroadcasted = false;
|
||||
SnorePlugin *m_source = nullptr;
|
||||
|
||||
static uint notificationCount;
|
||||
static uint m_idCount;
|
||||
|
|
|
@ -52,6 +52,10 @@ bool FreedesktopBackend::canUpdateNotification() const
|
|||
|
||||
void FreedesktopBackend::slotNotify(Notification noti)
|
||||
{
|
||||
if(noti.data()->source()->name() == name()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList actions;
|
||||
foreach (int k, noti.actions().keys()) {
|
||||
actions << QString::number(k) << noti.actions()[k].name();
|
||||
|
|
|
@ -1 +1 @@
|
|||
{ "type" : "frontend", "name" : "Pushover Frontend" }
|
||||
{ "type" : "frontend", "name" : "Pushover" }
|
|
@ -28,6 +28,10 @@ using namespace Snore;
|
|||
|
||||
void Pushover::slotNotify(Notification notification)
|
||||
{
|
||||
if(notification.data()->source()->name() == name()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString key = settingsValue(QLatin1String("UserKey")).toString();
|
||||
if (key.isEmpty()) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue