File indexing completed on 2025-02-16 04:23:12

0001 /*
0002     SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
0003     SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 #ifndef KUNIFIEDPUSH_GOTIFYPUSHPROVIDER_H
0007 #define KUNIFIEDPUSH_GOTIFYPUSHPROVIDER_H
0008 
0009 #include "abstractpushprovider.h"
0010 
0011 #include <QUrl>
0012 
0013 class QWebSocket;
0014 
0015 namespace KUnifiedPush {
0016 
0017 /** Push provider protocol implementation for Gotify. */
0018 class GotifyPushProvider : public AbstractPushProvider
0019 {
0020     Q_OBJECT
0021 public:
0022     explicit GotifyPushProvider(QObject *parent = nullptr);
0023 
0024     bool loadSettings(const QSettings &settings) override;
0025     void connectToProvider() override;
0026     void disconnectFromProvider() override;
0027     void registerClient(const Client &client) override;
0028     void unregisterClient(const Client &client) override;
0029 
0030     static constexpr const char Id[] = "Gotify";
0031 private:
0032     void wsMessageReceived(const QString &msg);
0033 
0034     QString m_clientToken;
0035     QUrl m_url;
0036     QWebSocket *m_socket = nullptr;
0037 };
0038 
0039 }
0040 
0041 #endif // KUNIFIEDPUSH_GOTIFYPUSHPROVIDER_H