KUnifiedPush

autopushprovider.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_AUTOPUSHPROVIDER_H
7#define KUNIFIEDPUSH_AUTOPUSHPROVIDER_H
8
9#include "abstractpushprovider.h"
10#include "client.h"
11
12#include <QUrl>
13#include <QTimer>
14
15class QWebSocket;
16
17namespace KUnifiedPush {
18
19/** Push provider protocol implementation for Mozilla Autopush.
20 * @see https://github.com/mozilla-services/autopush-rs
21 */
22class AutopushProvider : public AbstractPushProvider
23{
25public:
26 explicit AutopushProvider(QObject *parent = nullptr);
27
28 bool loadSettings(const QSettings &settings) override;
29 void connectToProvider(Urgency urgency) override;
30 void disconnectFromProvider() override;
31 void registerClient(const Client &client) override;
32 void unregisterClient(const Client &client) override;
33 void acknowledgeMessage(const Client &client, const QString &messageIdentifier) override;
34
35 static constexpr inline auto Id = QLatin1StringView("Autopush");
36
37protected:
38 void doChangeUrgency(Urgency urgency) override;
39
40private:
41 void sendMessage(const QJsonObject &msg);
42 void wsMessageReceived(const QString &msg);
43 void storeState();
44
45 QString m_uaid;
46 QUrl m_url;
47 QWebSocket *m_socket = nullptr;
48 Client m_currentClient;
49 QString m_currentMessageId;
50 QTimer m_pingTimer;
51};
52
53}
54
55#endif // KUNIFIEDPUSH_AUTOPUSHPROVIDER_H
Urgency urgency() const
The urgency level currently used by this provider.
void registerClient(const Client &client) override
Register a new client with the provider.
void unregisterClient(const Client &client) override
Unregister a client from the provider.
void doChangeUrgency(Urgency urgency) override
Re-implement if urgency leve changes are done as a separate command.
bool loadSettings(const QSettings &settings) override
Load connection settings.
void acknowledgeMessage(const Client &client, const QString &messageIdentifier) override
Acknowledge a message.
void connectToProvider(Urgency urgency) override
Attempt to establish a connection to the push provider.
void disconnectFromProvider() override
Disconnect and existing connection to the push provider.
Information about a registered client.
Definition client.h:20
Client-side integration with UnifiedPush.
Definition connector.h:14
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
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.