libpurple/plugins/kwallet/purplekwallet.h

Tue, 13 Aug 2024 03:03:05 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 13 Aug 2024 03:03:05 -0500
changeset 42867
e16b8726d9b5
parent 42138
7b233c733ea9
permissions
-rw-r--r--

Echo out pings and pongs as well as the RPL_ISUPPORT message

Testing Done:
Connected to a local ergo server and verified that the `RPL_ISUPPORT` message and `PING`s and `PONG`s were displayed in the status window.

Reviewed at https://reviews.imfreedom.org/r/3379/

40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
1 /*
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
2 * purple
39923
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 *
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * source distribution.
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 *
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * (at your option) any later version.
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 *
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * GNU General Public License for more details.
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 *
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
18 * You should have received a copy of the GNU General Public License along with
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
19 * this library; if not, see <https://www.gnu.org/licenses/>.
39923
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 */
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
21
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
22 #include <glib.h>
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
23
40358
e6fe6fc1f516 move all protocols, purple plugins, and purple tests to use purple.h instead of including files individually
Gary Kramlich <grim@reaperworld.com>
parents: 39924
diff changeset
24 #include <purple.h>
39923
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 #include <kwallet.h>
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #include <QQueue>
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
29 #define PURPLE_KWALLET_TYPE_PROVIDER (purple_kwallet_provider_get_type())
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
30 G_DECLARE_FINAL_TYPE(PurpleKWalletProvider, purple_kwallet_provider,
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
31 PURPLE_KWALLET, PROVIDER, PurpleCredentialProvider)
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
32
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
33 namespace PurpleKWalletPlugin {
39923
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
35 class Request {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
36 public:
42138
7b233c733ea9 pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents: 41171
diff changeset
37 Request(const QString &key, GTask *task);
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
38 virtual ~Request(void);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
39 virtual void execute(KWallet::Wallet *wallet) = 0;
42138
7b233c733ea9 pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents: 41171
diff changeset
40 virtual void cancel(const QString &reason) = 0;
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
41 protected:
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
42 QString key;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
43 GTask *task;
39923
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 };
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
46 class ReadRequest : public Request {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
47 public:
42138
7b233c733ea9 pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents: 41171
diff changeset
48 ReadRequest(const QString &key, GTask *task);
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
49 void execute(KWallet::Wallet *wallet);
42138
7b233c733ea9 pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents: 41171
diff changeset
50 void cancel(const QString &reason);
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
51 };
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
52
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
53 class WriteRequest : public Request {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
54 public:
42138
7b233c733ea9 pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents: 41171
diff changeset
55 WriteRequest(const QString &key, GTask *task, const QString &password);
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
56 void execute(KWallet::Wallet *wallet);
42138
7b233c733ea9 pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents: 41171
diff changeset
57 void cancel(const QString &reason);
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
58 private:
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
59 QString password;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
60 };
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
61
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
62 class ClearRequest : public Request {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
63 public:
42138
7b233c733ea9 pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents: 41171
diff changeset
64 ClearRequest(const QString &key, GTask *task);
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
65 void execute(KWallet::Wallet *wallet);
42138
7b233c733ea9 pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents: 41171
diff changeset
66 void cancel(const QString &reason);
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
67 };
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
68
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
69 class Engine : public QObject {
39923
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 Q_OBJECT
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
72 public:
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
73 Engine(void);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
74 ~Engine(void);
39923
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
76 void open(void);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
77 void close(void);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
78 void enqueue(Request *request);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
79 private slots:
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
80 void opened(bool opened);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
81 void closed(void);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
82 private:
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
83 void processQueue(void);
39923
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
85 bool connected;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
86 bool externallyClosed;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
87 bool failed;
39923
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
89 KWallet::Wallet *wallet;
39923
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
91 QQueue<Request *> queue;
39923
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 };
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93
f977be37ebc0 Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 }

mercurial