KUnifiedPush

notifier.h
1/*
2 SPDX-FileCopyrightText: 2025 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#ifndef KUNIFIEDPUSH_NOTIFIER_NOTIFIER_H
7#define KUNIFIEDPUSH_NOTIFIER_NOTIFIER_H
8
9#include "../shared/urgency_p.h"
10
11#include <QObject>
12#include <QUrl>
13
15class QNetworkReply;
16
17namespace KUnifiedPush {
18
19/** Push notification submission job.
20 * This is only used for testing/tooling.
21 */
22class Notifier : public QObject
23{
25public:
26 explicit Notifier(QObject *parent = nullptr);
27 ~Notifier();
28
29 inline void setEndpoint(const QUrl &url) { m_endpoint = url; }
30 inline void setTtl(std::chrono::seconds ttl) { m_ttl = ttl; }
31 inline void setUserAgentPublicKey(const QByteArray &uaPublicKey) { m_userAgentPublicKey = uaPublicKey; }
32 inline void setAuthSecret(const QByteArray &authSecret) { m_authSecret = authSecret; }
33 inline void setContact(const QString &contact) { m_contact = contact; }
34 inline void setVapidPublicKey(const QByteArray &vapidPublicKey) { m_vapidPublicKey = vapidPublicKey; }
35 inline void setVapidPrivateKey(const QByteArray &vapidPrivateKey) { m_vapidPrivateKey = vapidPrivateKey; }
36 inline void setUrgency(Urgency urgency) { m_urgency = urgency; }
37
38 /** Submit push message with content @p msg. */
39 void submit(const QByteArray &msg, QNetworkAccessManager *nam);
40
42 void finished(QNetworkReply *reply);
43
44private:
45 QUrl m_endpoint;
46 std::chrono::seconds m_ttl = std::chrono::hours(1);
47 Urgency m_urgency = DefaultUrgency;
48
49 // content encryption
50 QByteArray m_userAgentPublicKey;
51 QByteArray m_authSecret;
52
53 // VAPID
54 QString m_contact;
55 QByteArray m_vapidPublicKey;
56 QByteArray m_vapidPrivateKey;
57};
58
59}
60
61#endif
void submit(const QByteArray &msg, QNetworkAccessManager *nam)
Submit push message with content msg.
Definition notifier.cpp:24
Client-side integration with UnifiedPush.
Definition connector.h:14
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 25 2025 12:05:39 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.