Fri, 20 Oct 2023 00:48:38 -0500
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Due to changes in r/2338 running Pidgin in broadway resulted in following error:
```
plugins-Message: 00:30:55.180: Auto-loading plugin /home/grim/p/pidgin/build/libpurple/plugins/kwallet/purplekwallet.so
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
Aborted (core dumped)
```
So this patch reverts back to QCoreApplication. To deal with the runtime warning r/2338 was trying to solve, we now install a message handler that puts the Qt warnings and other messages into Pidgin's debug window.
Testing Done:
* ran Pidgin3 using broadway as GDK_BACKEND
* checked that the kwallet warning ("Cannot use KWindowSystem without a QGuiApplication") appeared in the debug window when switching credential manager to kwallet
Reviewed at https://reviews.imfreedom.org/r/2648/
|
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 |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
3 | * |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too numerous |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
6 | * source distribution. |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
7 | * |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
11 | * (at your option) any later version. |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
12 | * |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
16 | * GNU General Public License for more details. |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
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/>. |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
20 | */ |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
21 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
22 | #include <glib.h> |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40312
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40312
diff
changeset
|
24 | |
|
39959
e47fcffd061b
migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents:
39926
diff
changeset
|
25 | #include <purple.h> |
|
34014
647e174899a9
Took stuff from kwallet.cpp out of the extern "C" {}
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
34005
diff
changeset
|
26 | |
|
42373
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
27 | #include <QCoreApplication> |
|
39923
f977be37ebc0
Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
37065
diff
changeset
|
28 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
29 | #include <kwallet.h> |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
30 | |
|
39923
f977be37ebc0
Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
37065
diff
changeset
|
31 | #include "purplekwallet.h" |
|
34014
647e174899a9
Took stuff from kwallet.cpp out of the extern "C" {}
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
34005
diff
changeset
|
32 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
33 | /****************************************************************************** |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
34 | * Globals |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
35 | *****************************************************************************/ |
|
42373
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
36 | static QCoreApplication *coreApp = NULL; |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
37 | static PurpleCredentialProvider *instance = NULL; |
|
42146
f63bd4f70ce9
fix issues with Qt application object in kwallet plugin
Markus Fischer <ivanhoe@fiscari.de>
parents:
42138
diff
changeset
|
38 | static char *argv[] = { |
|
f63bd4f70ce9
fix issues with Qt application object in kwallet plugin
Markus Fischer <ivanhoe@fiscari.de>
parents:
42138
diff
changeset
|
39 | (char*)"purplekwallet", |
|
f63bd4f70ce9
fix issues with Qt application object in kwallet plugin
Markus Fischer <ivanhoe@fiscari.de>
parents:
42138
diff
changeset
|
40 | }; |
|
f63bd4f70ce9
fix issues with Qt application object in kwallet plugin
Markus Fischer <ivanhoe@fiscari.de>
parents:
42138
diff
changeset
|
41 | static int argc = G_N_ELEMENTS(argv); |
|
34139
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
42 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
43 | #define PURPLE_KWALLET_DOMAIN (g_quark_from_static_string("purple-kwallet")) |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
44 | #define PURPLE_KWALLET_WALLET_NAME (KWallet::Wallet::NetworkWallet()) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
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 | struct _PurpleKWalletProvider { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
47 | PurpleCredentialProvider parent; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
48 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
49 | PurpleKWalletPlugin::Engine *engine; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
50 | }; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
51 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
52 | G_DEFINE_DYNAMIC_TYPE(PurpleKWalletProvider, purple_kwallet_provider, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
53 | PURPLE_TYPE_CREDENTIAL_PROVIDER) |
|
34136
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
54 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
55 | /****************************************************************************** |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
56 | * Helpers |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
57 | *****************************************************************************/ |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
58 | static QString |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
59 | purple_kwallet_get_ui_name(void) { |
|
41867
5375c1d58c50
Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents:
41396
diff
changeset
|
60 | PurpleUi *ui = NULL; |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
61 | QString ui_name = NULL; |
|
34152
524edcbc83cb
Use purple_core_get_ui_info instead of g_get_application_name
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34146
diff
changeset
|
62 | |
|
41867
5375c1d58c50
Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents:
41396
diff
changeset
|
63 | ui = purple_core_get_ui(); |
|
5375c1d58c50
Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents:
41396
diff
changeset
|
64 | if(PURPLE_IS_UI(ui)) { |
|
5375c1d58c50
Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents:
41396
diff
changeset
|
65 | ui_name = purple_ui_get_name(ui); |
|
40312
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
39959
diff
changeset
|
66 | } |
|
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
39959
diff
changeset
|
67 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
68 | if(ui_name.isEmpty()) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
69 | ui_name = "libpurple"; |
|
40312
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
39959
diff
changeset
|
70 | } |
|
34152
524edcbc83cb
Use purple_core_get_ui_info instead of g_get_application_name
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34146
diff
changeset
|
71 | |
|
524edcbc83cb
Use purple_core_get_ui_info instead of g_get_application_name
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34146
diff
changeset
|
72 | return ui_name; |
|
34146
99bad5c80d1e
More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34145
diff
changeset
|
73 | } |
|
99bad5c80d1e
More password wiping, better password management withing account.c, using actual UI name with KWallet
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34145
diff
changeset
|
74 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
75 | static QString |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
76 | purple_kwallet_provider_account_key(PurpleAccount *account) { |
|
41974
9ad66abc9356
Update the libpurple plugins for the account deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
41867
diff
changeset
|
77 | PurpleContactInfo *info = PURPLE_CONTACT_INFO(account); |
|
9ad66abc9356
Update the libpurple plugins for the account deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
41867
diff
changeset
|
78 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
79 | return QString(purple_account_get_protocol_id(account)) + ":" + |
|
41974
9ad66abc9356
Update the libpurple plugins for the account deprecations
Gary Kramlich <grim@reaperworld.com>
parents:
41867
diff
changeset
|
80 | purple_contact_info_get_username(info); |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
81 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
82 | |
|
42373
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
83 | static void |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
84 | kwallet_message_handler(QtMsgType type, const QMessageLogContext &, |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
85 | const QString &msg) |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
86 | { |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
87 | GLogLevelFlags log_level; |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
88 | |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
89 | switch (type) { |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
90 | case QtDebugMsg: |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
91 | log_level = G_LOG_LEVEL_DEBUG; |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
92 | break; |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
93 | case QtInfoMsg: |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
94 | log_level = G_LOG_LEVEL_INFO; |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
95 | break; |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
96 | case QtWarningMsg: |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
97 | log_level = G_LOG_LEVEL_WARNING; |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
98 | break; |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
99 | case QtCriticalMsg: |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
100 | log_level = G_LOG_LEVEL_CRITICAL; |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
101 | break; |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
102 | case QtFatalMsg: |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
103 | // don't create a fatal aka G_LOG_LEVEL_ERROR message, because |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
104 | // this is only a plugin |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
105 | log_level = G_LOG_LEVEL_CRITICAL; |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
106 | break; |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
107 | } |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
108 | |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
109 | g_log(G_LOG_DOMAIN, log_level, "%s", msg.toUtf8().constData()); |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
110 | } |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
111 | /****************************************************************************** |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
112 | * Request Implementation |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
113 | *****************************************************************************/ |
|
42138
7b233c733ea9
pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents:
42076
diff
changeset
|
114 | PurpleKWalletPlugin::Request::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
|
115 | this->key = key; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
116 | this->task = G_TASK(g_object_ref(G_OBJECT(task))); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
117 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
118 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
119 | PurpleKWalletPlugin::Request::~Request(void) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
120 | g_clear_object(&this->task); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
121 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
122 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
123 | /****************************************************************************** |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
124 | * ReadRequest Implementation |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
125 | *****************************************************************************/ |
|
42138
7b233c733ea9
pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents:
42076
diff
changeset
|
126 | PurpleKWalletPlugin::ReadRequest::ReadRequest(const QString &key, GTask *task) : PurpleKWalletPlugin::Request(key, task) { |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
127 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
128 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
129 | void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
130 | PurpleKWalletPlugin::ReadRequest::execute(KWallet::Wallet *wallet) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
131 | QString password; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
132 | int result = 0; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
133 | bool missing; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
134 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
135 | missing = KWallet::Wallet::keyDoesNotExist(PURPLE_KWALLET_WALLET_NAME, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
136 | purple_kwallet_get_ui_name(), |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
137 | key); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
138 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
139 | if(missing) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
140 | g_task_return_new_error(this->task, PURPLE_KWALLET_DOMAIN, 0, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
141 | "no password stored"); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
142 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
143 | g_clear_object(&this->task); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
144 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
145 | return; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
146 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
147 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
148 | result = wallet->readPassword(this->key, password); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
149 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
150 | if(result != 0) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
151 | g_task_return_new_error(this->task, PURPLE_KWALLET_DOMAIN, result, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
152 | _("failed to read password, kwallet responded " |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
153 | "with error code %d"), result); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
154 | } else { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
155 | gchar *c_password = g_strdup(password.toUtf8().constData()); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
156 | g_task_return_pointer(this->task, c_password, g_free); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
157 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
158 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
159 | g_clear_object(&this->task); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
160 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
161 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
162 | void |
|
42138
7b233c733ea9
pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents:
42076
diff
changeset
|
163 | PurpleKWalletPlugin::ReadRequest::cancel(const QString &reason) { |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
164 | g_task_return_new_error(this->task, PURPLE_KWALLET_DOMAIN, 0, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
165 | _("failed to read password: %s"), |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
166 | reason.toUtf8().constData()); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
167 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
168 | g_clear_object(&this->task); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
169 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
170 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
171 | /****************************************************************************** |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
172 | * WriteRequest Implementation |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
173 | *****************************************************************************/ |
|
42138
7b233c733ea9
pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents:
42076
diff
changeset
|
174 | PurpleKWalletPlugin::WriteRequest::WriteRequest(const QString &key, GTask *task, const QString &password) : PurpleKWalletPlugin::Request(key, task) { |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
175 | this->password = password; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
176 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
177 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
178 | void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
179 | PurpleKWalletPlugin::WriteRequest::execute(KWallet::Wallet *wallet) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
180 | int result; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
181 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
182 | result = wallet->writePassword(this->key, this->password); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
183 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
184 | if(result != 0) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
185 | g_task_return_new_error(this->task, PURPLE_KWALLET_DOMAIN, result, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
186 | _("failed to write password, kwallet " |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
187 | "responded with error code %d"), result); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
188 | } else { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
189 | g_task_return_boolean(this->task, TRUE); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
190 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
191 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
192 | g_clear_object(&this->task); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
193 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
194 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
195 | void |
|
42138
7b233c733ea9
pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents:
42076
diff
changeset
|
196 | PurpleKWalletPlugin::WriteRequest::cancel(const QString &reason) { |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
197 | g_task_return_new_error(this->task, PURPLE_KWALLET_DOMAIN, 0, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
198 | _("failed to write password: %s"), |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
199 | reason.toUtf8().constData()); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
200 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
201 | g_clear_object(&this->task); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
202 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
203 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
204 | /****************************************************************************** |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
205 | * ClearRequest Implementation |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
206 | *****************************************************************************/ |
|
42138
7b233c733ea9
pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents:
42076
diff
changeset
|
207 | PurpleKWalletPlugin::ClearRequest::ClearRequest(const QString &key, GTask *task) : PurpleKWalletPlugin::Request(key, task) { |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
208 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
209 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
210 | void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
211 | PurpleKWalletPlugin::ClearRequest::execute(KWallet::Wallet *wallet) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
212 | int result; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
213 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
214 | result = wallet->removeEntry(this->key); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
215 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
216 | if(result != 0) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
217 | g_task_return_new_error(this->task, PURPLE_KWALLET_DOMAIN, result, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
218 | _("failed to clear password, kwallet " |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
219 | "responded with error code %d"), result); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
220 | } else { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
221 | g_task_return_boolean(this->task, TRUE); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
222 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
223 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
224 | g_clear_object(&this->task); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
225 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
226 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
227 | void |
|
42138
7b233c733ea9
pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents:
42076
diff
changeset
|
228 | PurpleKWalletPlugin::ClearRequest::cancel(const QString &reason) { |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
229 | g_task_return_new_error(this->task, PURPLE_KWALLET_DOMAIN, 0, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
230 | _("failed to clear password: %s"), |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
231 | reason.toUtf8().constData()); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
232 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
233 | g_clear_object(&this->task); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
234 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
235 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
236 | /****************************************************************************** |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
237 | * Engine Implementation |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
238 | *****************************************************************************/ |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
239 | PurpleKWalletPlugin::Engine::Engine(void) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
240 | this->queue = QQueue<PurpleKWalletPlugin::Request *>(); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
241 | |
|
40825
a6a5e36ddfe5
Fix a crash on shutdown in kwallet if the wallet was never opened.
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
242 | this->wallet = NULL; |
|
a6a5e36ddfe5
Fix a crash on shutdown in kwallet if the wallet was never opened.
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
243 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
244 | this->connected = false; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
245 | this->failed = false; |
|
40825
a6a5e36ddfe5
Fix a crash on shutdown in kwallet if the wallet was never opened.
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
246 | this->externallyClosed = false; |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
247 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
248 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
249 | PurpleKWalletPlugin::Engine::~Engine(void) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
250 | this->close(); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
251 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
252 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
253 | void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
254 | PurpleKWalletPlugin::Engine::open(void) { |
|
42373
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
255 | g_info("attempting to open wallet"); |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
256 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
257 | if(this->connected) { |
|
42373
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
258 | g_info("wallet already opened"); |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
259 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
260 | return; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
261 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
262 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
263 | // Reset our externallyClosed and failed states. |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
264 | this->externallyClosed = false; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
265 | this->failed = false; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
266 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
267 | // No need to check this pointer as an async open always returns non-null. |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
268 | this->wallet = KWallet::Wallet::openWallet(PURPLE_KWALLET_WALLET_NAME, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
269 | 0, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
270 | KWallet::Wallet::Asynchronous); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
271 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
272 | this->failed |= !QObject::connect(this->wallet, SIGNAL(walletOpened(bool)), |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
273 | SLOT(opened(bool))); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
274 | this->failed |= !QObject::connect(this->wallet, SIGNAL(walletClosed(void)), |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
275 | SLOT(closed())); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
276 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
277 | if(this->failed) { |
|
42373
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
278 | g_critical("Failed to connect KWallet signals"); |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
279 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
280 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
281 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
282 | void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
283 | PurpleKWalletPlugin::Engine::close(void) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
284 | while(!this->queue.isEmpty()) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
285 | PurpleKWalletPlugin::Request *request = this->queue.dequeue(); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
286 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
287 | request->cancel("wallet is closing"); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
288 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
289 | delete request; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
290 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
291 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
292 | if(this->wallet != NULL) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
293 | delete this->wallet; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
294 | this->wallet = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
295 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
296 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
297 | this->connected = false; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
298 | this->failed = false; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
299 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
300 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
301 | void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
302 | PurpleKWalletPlugin::Engine::enqueue(PurpleKWalletPlugin::Request *request) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
303 | this->queue.enqueue(request); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
304 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
305 | processQueue(); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
306 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
307 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
308 | void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
309 | PurpleKWalletPlugin::Engine::opened(bool opened) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
310 | QString folder_name; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
311 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
312 | if(!opened) { |
|
42373
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
313 | g_critical("failed to open wallet"); |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
314 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
315 | delete this->wallet; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
316 | this->wallet = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
317 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
318 | this->connected = false; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
319 | this->failed = true; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
320 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
321 | return; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
322 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
323 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
324 | // Handle the case where the wallet opened signal connected, but the wallet |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
325 | // closed signal failed to connect. |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
326 | if(this->failed) { |
|
42373
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
327 | g_critical("wallet opened, but failed to connect the wallet closed signal"); |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
328 | return; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
329 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
330 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
331 | this->connected = true; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
332 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
333 | // setup our folder |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
334 | folder_name = purple_kwallet_get_ui_name(); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
335 | if(!this->wallet->hasFolder(folder_name)) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
336 | if(!this->wallet->createFolder(folder_name)) { |
|
42373
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
337 | g_critical("failed to create folder %s in wallet.", |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
338 | folder_name.toUtf8().constData()); |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
339 | this->failed = true; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
340 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
341 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
342 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
343 | if(!this->failed && !this->wallet->setFolder(folder_name)) { |
|
42373
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
344 | g_critical("failed to set folder to %s", |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
345 | folder_name.toUtf8().constData()); |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
346 | this->failed = true; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
347 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
348 | |
|
42373
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
349 | g_info("successfully opened the wallet"); |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
350 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
351 | processQueue(); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
352 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
353 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
354 | void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
355 | PurpleKWalletPlugin::Engine::closed(void) { |
|
42373
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
356 | g_info("the wallet was closed externally"); |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
357 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
358 | this->externallyClosed = true; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
359 | this->close(); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
360 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
361 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
362 | void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
363 | PurpleKWalletPlugin::Engine::processQueue() { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
364 | if(this->externallyClosed && this->queue.isEmpty() == false) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
365 | this->open(); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
366 | } else if(this->connected || this->failed) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
367 | while(!this->queue.isEmpty()) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
368 | PurpleKWalletPlugin::Request *request = this->queue.dequeue(); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
369 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
370 | if(this->failed) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
371 | request->cancel(_("failed to open kwallet")); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
372 | } else { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
373 | request->execute(this->wallet); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
374 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
375 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
376 | delete request; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
377 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
378 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
379 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
380 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
381 | /****************************************************************************** |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
382 | * PurpleCredentialProvider Implementation |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
383 | *****************************************************************************/ |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
384 | static void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
385 | purple_kwallet_provider_activate(PurpleCredentialProvider *provider) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
386 | PurpleKWalletProvider *kwallet_provider = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
387 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
388 | kwallet_provider = PURPLE_KWALLET_PROVIDER(provider); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
389 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
390 | kwallet_provider->engine->open(); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
391 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
392 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
393 | static void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
394 | purple_kwallet_provider_deactivate(PurpleCredentialProvider *provider) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
395 | PurpleKWalletProvider *kwallet_provider = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
396 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
397 | kwallet_provider = PURPLE_KWALLET_PROVIDER(provider); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
398 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
399 | kwallet_provider->engine->close(); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
400 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
401 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
402 | static void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
403 | purple_kwallet_read_password_async(PurpleCredentialProvider *provider, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
404 | PurpleAccount *account, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
405 | GCancellable *cancellable, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
406 | GAsyncReadyCallback callback, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
407 | gpointer data) |
|
36502
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
408 | { |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
409 | PurpleKWalletProvider *kwallet_provider = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
410 | PurpleKWalletPlugin::ReadRequest *request = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
411 | GTask *task = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
412 | QString key; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
413 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
414 | key = purple_kwallet_provider_account_key(account); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
415 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
416 | task = g_task_new(G_OBJECT(provider), cancellable, callback, data); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
417 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
418 | request = new PurpleKWalletPlugin::ReadRequest(key, task); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
419 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
420 | kwallet_provider = PURPLE_KWALLET_PROVIDER(provider); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
421 | kwallet_provider->engine->enqueue(request); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
422 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
423 | g_clear_object(&task); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
424 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
425 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
426 | static gchar * |
|
42076
76417a1fa9b2
Mark unused parameters as such for all of the purple plugins
Gary Kramlich <grim@reaperworld.com>
parents:
41974
diff
changeset
|
427 | purple_kwallet_read_password_finish(G_GNUC_UNUSED PurpleCredentialProvider *provider, |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
428 | GAsyncResult *result, GError **error) |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
429 | { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
430 | return (gchar *)g_task_propagate_pointer(G_TASK(result), error); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
431 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
432 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
433 | static void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
434 | purple_kwallet_write_password_async(PurpleCredentialProvider *provider, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
435 | PurpleAccount *account, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
436 | const gchar *password, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
437 | GCancellable *cancellable, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
438 | GAsyncReadyCallback callback, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
439 | gpointer data) |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
440 | { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
441 | PurpleKWalletProvider *kwallet_provider = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
442 | PurpleKWalletPlugin::WriteRequest *request = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
443 | GTask *task = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
444 | QString key; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
445 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
446 | task = g_task_new(G_OBJECT(provider), cancellable, callback, data); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
447 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
448 | key = purple_kwallet_provider_account_key(account); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
449 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
450 | request = new PurpleKWalletPlugin::WriteRequest(key, task, password); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
451 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
452 | kwallet_provider = PURPLE_KWALLET_PROVIDER(provider); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
453 | kwallet_provider->engine->enqueue(request); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
454 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
455 | g_clear_object(&task); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
456 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
457 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
458 | static gboolean |
|
42076
76417a1fa9b2
Mark unused parameters as such for all of the purple plugins
Gary Kramlich <grim@reaperworld.com>
parents:
41974
diff
changeset
|
459 | purple_kwallet_write_password_finish(G_GNUC_UNUSED PurpleCredentialProvider *provider, |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
460 | GAsyncResult *result, GError **error) |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
461 | { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
462 | return g_task_propagate_boolean(G_TASK(result), error); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
463 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
464 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
465 | static void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
466 | purple_kwallet_clear_password_async(PurpleCredentialProvider *provider, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
467 | PurpleAccount *account, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
468 | GCancellable *cancellable, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
469 | GAsyncReadyCallback callback, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
470 | gpointer data) |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
471 | { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
472 | PurpleKWalletProvider *kwallet_provider = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
473 | PurpleKWalletPlugin::ClearRequest *request = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
474 | GTask *task = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
475 | QString key; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
476 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
477 | task = g_task_new(G_OBJECT(provider), cancellable, callback, data); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
478 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
479 | key = purple_kwallet_provider_account_key(account); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
480 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
481 | request = new PurpleKWalletPlugin::ClearRequest(key, task); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
482 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
483 | kwallet_provider = PURPLE_KWALLET_PROVIDER(provider); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
484 | kwallet_provider->engine->enqueue(request); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
485 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
486 | g_clear_object(&task); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
487 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
488 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
489 | static gboolean |
|
42076
76417a1fa9b2
Mark unused parameters as such for all of the purple plugins
Gary Kramlich <grim@reaperworld.com>
parents:
41974
diff
changeset
|
490 | purple_kwallet_clear_password_finish(G_GNUC_UNUSED PurpleCredentialProvider *provider, |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
491 | GAsyncResult *result, GError **error) |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
492 | { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
493 | return g_task_propagate_boolean(G_TASK(result), error); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
494 | } |
|
36642
b8ba53daa445
Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents:
36505
diff
changeset
|
495 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
496 | /****************************************************************************** |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
497 | * GObject Implementation |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
498 | *****************************************************************************/ |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
499 | static void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
500 | purple_kwallet_provider_dispose(GObject *obj) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
501 | PurpleKWalletProvider *provider = PURPLE_KWALLET_PROVIDER(obj); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
502 | |
|
40825
a6a5e36ddfe5
Fix a crash on shutdown in kwallet if the wallet was never opened.
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
503 | if(provider->engine != NULL) { |
|
a6a5e36ddfe5
Fix a crash on shutdown in kwallet if the wallet was never opened.
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
504 | provider->engine->close(); |
|
a6a5e36ddfe5
Fix a crash on shutdown in kwallet if the wallet was never opened.
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
505 | } |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
506 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
507 | G_OBJECT_CLASS(purple_kwallet_provider_parent_class)->dispose(obj); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
508 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
509 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
510 | static void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
511 | purple_kwallet_provider_finalize(GObject *obj) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
512 | PurpleKWalletProvider *provider = PURPLE_KWALLET_PROVIDER(obj); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
513 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
514 | if(provider->engine != NULL) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
515 | delete provider->engine; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
516 | provider->engine = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
517 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
518 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
519 | G_OBJECT_CLASS(purple_kwallet_provider_parent_class)->finalize(obj); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
520 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
521 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
522 | static void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
523 | purple_kwallet_provider_init(PurpleKWalletProvider *provider) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
524 | provider->engine = new PurpleKWalletPlugin::Engine(); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
525 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
526 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
527 | static void |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
528 | purple_kwallet_provider_class_init(PurpleKWalletProviderClass *klass) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
529 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
530 | PurpleCredentialProviderClass *provider_class = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
531 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
532 | provider_class = PURPLE_CREDENTIAL_PROVIDER_CLASS(klass); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
533 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
534 | obj_class->dispose = purple_kwallet_provider_dispose; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
535 | obj_class->finalize = purple_kwallet_provider_finalize; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
536 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
537 | provider_class->activate = purple_kwallet_provider_activate; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
538 | provider_class->deactivate = purple_kwallet_provider_deactivate; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
539 | provider_class->read_password_async = purple_kwallet_read_password_async; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
540 | provider_class->read_password_finish = purple_kwallet_read_password_finish; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
541 | provider_class->write_password_async = purple_kwallet_write_password_async; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
542 | provider_class->write_password_finish = |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
543 | purple_kwallet_write_password_finish; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
544 | provider_class->clear_password_async = purple_kwallet_clear_password_async; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
545 | provider_class->clear_password_finish = |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
546 | purple_kwallet_clear_password_finish; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
547 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
548 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
549 | static void |
|
42076
76417a1fa9b2
Mark unused parameters as such for all of the purple plugins
Gary Kramlich <grim@reaperworld.com>
parents:
41974
diff
changeset
|
550 | purple_kwallet_provider_class_finalize(G_GNUC_UNUSED PurpleKWalletProviderClass *klass) { |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
551 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
552 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
553 | /****************************************************************************** |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
554 | * API |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
555 | *****************************************************************************/ |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
556 | static PurpleCredentialProvider * |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
557 | purple_kwallet_provider_new(void) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
558 | return PURPLE_CREDENTIAL_PROVIDER(g_object_new( |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
559 | PURPLE_KWALLET_TYPE_PROVIDER, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
560 | "id", "kwallet", |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
561 | "name", _("KWallet"), |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
562 | "description", _("A credentials management application for the KDE " |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
563 | "Software Compilation desktop environment"), |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
564 | NULL |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
565 | )); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
566 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
567 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
568 | /****************************************************************************** |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
569 | * Plugin Exports |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
570 | *****************************************************************************/ |
|
40882
77df4bdbc750
Port the plugins that were manually specific GPlugin exports to the new GPlugin declare macro
Gary Kramlich <grim@reaperworld.com>
parents:
40825
diff
changeset
|
571 | static GPluginPluginInfo * |
|
77df4bdbc750
Port the plugins that were manually specific GPlugin exports to the new GPlugin declare macro
Gary Kramlich <grim@reaperworld.com>
parents:
40825
diff
changeset
|
572 | kwallet_query(G_GNUC_UNUSED GError **error) { |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
573 | const gchar * const authors[] = { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
574 | "Pidgin Developers <devel@pidgin.im>", |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
575 | NULL |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
576 | }; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
577 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
578 | return GPLUGIN_PLUGIN_INFO(purple_plugin_info_new( |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
579 | "id", "keyring-kwallet", |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
580 | "name", N_("KWallet"), |
|
36502
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
581 | "version", DISPLAY_VERSION, |
|
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
582 | "category", N_("Keyring"), |
|
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
583 | "summary", "KWallet Keyring Plugin", |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
584 | "description", N_("This plugin will store passwords in KWallet."), |
|
36642
b8ba53daa445
Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents:
36505
diff
changeset
|
585 | "authors", authors, |
|
36502
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
586 | "website", PURPLE_WEBSITE, |
|
36505
60c161851325
Integrated purple ABI requirement into GPlugin's "abi-version" property
Ankit Vani <a@nevitus.org>
parents:
36502
diff
changeset
|
587 | "abi-version", PURPLE_ABI_VERSION, |
|
41171
679186b6eb95
Move the kwallet plugin to the plugins directory and make it autoload
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
588 | "flags", PURPLE_PLUGIN_INFO_FLAGS_INTERNAL | |
|
679186b6eb95
Move the kwallet plugin to the plugins directory and make it autoload
Gary Kramlich <grim@reaperworld.com>
parents:
41078
diff
changeset
|
589 | PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD, |
|
36502
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
590 | NULL |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
591 | )); |
|
36502
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
592 | } |
|
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
593 | |
|
40882
77df4bdbc750
Port the plugins that were manually specific GPlugin exports to the new GPlugin declare macro
Gary Kramlich <grim@reaperworld.com>
parents:
40825
diff
changeset
|
594 | static gboolean |
|
77df4bdbc750
Port the plugins that were manually specific GPlugin exports to the new GPlugin declare macro
Gary Kramlich <grim@reaperworld.com>
parents:
40825
diff
changeset
|
595 | kwallet_load(GPluginPlugin *plugin, GError **error) { |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
596 | PurpleCredentialManager *manager = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
597 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
598 | purple_kwallet_provider_register_type(G_TYPE_MODULE(plugin)); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
599 | |
|
42373
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
600 | if(coreApp == NULL) { |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
601 | qInstallMessageHandler(kwallet_message_handler); |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
602 | coreApp = new QCoreApplication(argc, argv); |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
603 | coreApp->setApplicationName(purple_kwallet_get_ui_name()); |
|
34119
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
604 | } |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
605 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
606 | if(!KWallet::Wallet::isEnabled()) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
607 | g_set_error(error, PURPLE_KWALLET_DOMAIN, 0, |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
608 | "KWallet service is disabled."); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
609 | |
|
34120
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
610 | return FALSE; |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
611 | } |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
612 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
613 | manager = purple_credential_manager_get_default(); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
614 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
615 | instance = purple_kwallet_provider_new(); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
616 | |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40882
diff
changeset
|
617 | return purple_credential_manager_register(manager, instance, error); |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
618 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
619 | |
|
40882
77df4bdbc750
Port the plugins that were manually specific GPlugin exports to the new GPlugin declare macro
Gary Kramlich <grim@reaperworld.com>
parents:
40825
diff
changeset
|
620 | static gboolean |
|
41078
84e48180ef67
Update to gplugin 0.35.0
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
621 | kwallet_unload(G_GNUC_UNUSED GPluginPlugin *plugin, |
|
84e48180ef67
Update to gplugin 0.35.0
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
622 | G_GNUC_UNUSED gboolean shutdown, |
|
84e48180ef67
Update to gplugin 0.35.0
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
623 | GError **error) |
|
84e48180ef67
Update to gplugin 0.35.0
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
624 | { |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
625 | PurpleCredentialManager *manager = NULL; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
626 | gboolean ret = FALSE; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
627 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
628 | manager = purple_credential_manager_get_default(); |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40882
diff
changeset
|
629 | ret = purple_credential_manager_unregister(manager, instance, error); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
630 | |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
631 | if(!ret) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
632 | return ret; |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
633 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
634 | |
|
42373
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
635 | if(coreApp != NULL) { |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
636 | delete coreApp; |
|
7f7617773171
fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents:
42146
diff
changeset
|
637 | coreApp = NULL; |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
638 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
639 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
640 | g_clear_object(&instance); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
641 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
642 | return TRUE; |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
643 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
644 | |
|
40882
77df4bdbc750
Port the plugins that were manually specific GPlugin exports to the new GPlugin declare macro
Gary Kramlich <grim@reaperworld.com>
parents:
40825
diff
changeset
|
645 | G_BEGIN_DECLS |
|
77df4bdbc750
Port the plugins that were manually specific GPlugin exports to the new GPlugin declare macro
Gary Kramlich <grim@reaperworld.com>
parents:
40825
diff
changeset
|
646 | GPLUGIN_NATIVE_PLUGIN_DECLARE(kwallet) |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40439
diff
changeset
|
647 | G_END_DECLS |