libpurple/plugins/kwallet/purplekwallet.cpp

Thu, 27 Jun 2024 00:48:00 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 27 Jun 2024 00:48:00 -0500
changeset 42805
3e77e81168a5
parent 42592
6b65c0e4ba15
child 43027
581af7cd0603
permissions
-rw-r--r--

Update libpurple to use get id and username directly on PurpleAccount

This is part of making PurpleAccount have a PurpleContactInfo instead of being
one.

Testing Done:
Ran the turtles and opened Pidgin 3 with some accounts without issue.

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

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
42572
f053e7fdd25d Make sure all of the final types in the purple plugins are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 42373
diff changeset
52 G_DEFINE_DYNAMIC_TYPE_EXTENDED(PurpleKWalletProvider, purple_kwallet_provider,
f053e7fdd25d Make sure all of the final types in the purple plugins are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 42373
diff changeset
53 PURPLE_TYPE_CREDENTIAL_PROVIDER,
f053e7fdd25d Make sure all of the final types in the purple plugins are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 42373
diff changeset
54 G_TYPE_FLAG_FINAL, {})
34136
e9722a935271 Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34134
diff changeset
55
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
56 /******************************************************************************
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
57 * Helpers
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
58 *****************************************************************************/
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
59 static QString
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
60 purple_kwallet_get_ui_name(void) {
41867
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41396
diff changeset
61 PurpleUi *ui = NULL;
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
62 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
63
41867
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41396
diff changeset
64 ui = purple_core_get_ui();
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41396
diff changeset
65 if(PURPLE_IS_UI(ui)) {
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41396
diff changeset
66 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
67 }
956745ff3ee8 Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents: 39959
diff changeset
68
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
69 if(ui_name.isEmpty()) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
70 ui_name = "libpurple";
40312
956745ff3ee8 Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents: 39959
diff changeset
71 }
34152
524edcbc83cb Use purple_core_get_ui_info instead of g_get_application_name
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34146
diff changeset
72
524edcbc83cb Use purple_core_get_ui_info instead of g_get_application_name
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34146
diff changeset
73 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
74 }
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
75
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
76 static QString
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
77 purple_kwallet_provider_account_key(PurpleAccount *account) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
78 return QString(purple_account_get_protocol_id(account)) + ":" +
42805
3e77e81168a5 Update libpurple to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42592
diff changeset
79 purple_account_get_username(account);
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
80 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
81
42373
7f7617773171 fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents: 42146
diff changeset
82 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
83 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
84 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
85 {
7f7617773171 fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents: 42146
diff changeset
86 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
87
7f7617773171 fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents: 42146
diff changeset
88 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
89 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
90 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
91 break;
7f7617773171 fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents: 42146
diff changeset
92 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
93 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
94 break;
7f7617773171 fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents: 42146
diff changeset
95 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
96 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
97 break;
7f7617773171 fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents: 42146
diff changeset
98 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
99 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
100 break;
7f7617773171 fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents: 42146
diff changeset
101 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
102 // 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
103 // 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
104 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
105 break;
7f7617773171 fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents: 42146
diff changeset
106 }
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 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
109 }
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
110 /******************************************************************************
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
111 * Request Implementation
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
112 *****************************************************************************/
42138
7b233c733ea9 pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents: 42076
diff changeset
113 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
114 this->key = key;
42592
6b65c0e4ba15 Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents: 42591
diff changeset
115 this->task = g_object_ref(task);
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
116 }
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 PurpleKWalletPlugin::Request::~Request(void) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
119 g_clear_object(&this->task);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
120 }
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 * ReadRequest Implementation
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
124 *****************************************************************************/
42138
7b233c733ea9 pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents: 42076
diff changeset
125 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
126 }
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 void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
129 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
130 QString password;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
131 int result = 0;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
132 bool missing;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
133
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
134 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
135 purple_kwallet_get_ui_name(),
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
136 key);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
137
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
138 if(missing) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
139 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
140 "no password stored");
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
141
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
142 g_clear_object(&this->task);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
143
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
144 return;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
145 }
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 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
148
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
149 if(result != 0) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
150 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
151 _("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
152 "with error code %d"), result);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
153 } else {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
154 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
155 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
156 }
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 g_clear_object(&this->task);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
159 }
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 void
42138
7b233c733ea9 pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents: 42076
diff changeset
162 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
163 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
164 _("failed to read password: %s"),
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
165 reason.toUtf8().constData());
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
166
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
167 g_clear_object(&this->task);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
168 }
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 * WriteRequest Implementation
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
172 *****************************************************************************/
42138
7b233c733ea9 pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents: 42076
diff changeset
173 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
174 this->password = password;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
175 }
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 void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
178 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
179 int result;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
180
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
181 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
182
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
183 if(result != 0) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
184 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
185 _("failed to write password, kwallet "
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
186 "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
187 } else {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
188 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
189 }
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 g_clear_object(&this->task);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
192 }
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 void
42138
7b233c733ea9 pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents: 42076
diff changeset
195 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
196 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
197 _("failed to write password: %s"),
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
198 reason.toUtf8().constData());
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
199
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
200 g_clear_object(&this->task);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
201 }
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 * ClearRequest Implementation
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
205 *****************************************************************************/
42138
7b233c733ea9 pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents: 42076
diff changeset
206 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
207 }
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 void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
210 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
211 int result;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
212
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
213 result = wallet->removeEntry(this->key);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
214
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
215 if(result != 0) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
216 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
217 _("failed to clear password, kwallet "
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
218 "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
219 } else {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
220 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
221 }
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 g_clear_object(&this->task);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
224 }
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 void
42138
7b233c733ea9 pass QString arguments by const reference to avoid unnecessary copying
Markus Fischer <ivanhoe@fiscari.de>
parents: 42076
diff changeset
227 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
228 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
229 _("failed to clear password: %s"),
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
230 reason.toUtf8().constData());
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
231
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
232 g_clear_object(&this->task);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
233 }
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 * Engine Implementation
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
237 *****************************************************************************/
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
238 PurpleKWalletPlugin::Engine::Engine(void) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
239 this->queue = QQueue<PurpleKWalletPlugin::Request *>();
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
240
40825
a6a5e36ddfe5 Fix a crash on shutdown in kwallet if the wallet was never opened.
Gary Kramlich <grim@reaperworld.com>
parents: 40823
diff changeset
241 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
242
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
243 this->connected = false;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
244 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
245 this->externallyClosed = false;
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
246 }
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 PurpleKWalletPlugin::Engine::~Engine(void) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
249 this->close();
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
250 }
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 void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
253 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
254 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
255
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
256 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
257 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
258
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
259 return;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
260 }
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 // 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
263 this->externallyClosed = false;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
264 this->failed = false;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
265
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
266 // 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
267 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
268 0,
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
269 KWallet::Wallet::Asynchronous);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
270
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
271 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
272 SLOT(opened(bool)));
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
273 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
274 SLOT(closed()));
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
275
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
276 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
277 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
278 }
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 void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
282 PurpleKWalletPlugin::Engine::close(void) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
283 while(!this->queue.isEmpty()) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
284 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
285
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
286 request->cancel("wallet is closing");
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
287
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
288 delete request;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
289 }
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 if(this->wallet != NULL) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
292 delete this->wallet;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
293 this->wallet = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
294 }
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 this->connected = false;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
297 this->failed = false;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
298 }
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 void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
301 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
302 this->queue.enqueue(request);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
303
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
304 processQueue();
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
305 }
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 void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
308 PurpleKWalletPlugin::Engine::opened(bool opened) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
309 QString folder_name;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
310
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
311 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
312 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
313
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
314 delete this->wallet;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
315 this->wallet = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
316
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
317 this->connected = false;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
318 this->failed = true;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
319
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
320 return;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
321 }
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 // 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
324 // closed signal failed to connect.
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
325 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
326 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
327 return;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
328 }
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 this->connected = true;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
331
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
332 // setup our folder
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
333 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
334 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
335 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
336 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
337 folder_name.toUtf8().constData());
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
338 this->failed = true;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
339 }
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 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
343 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
344 folder_name.toUtf8().constData());
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
345 this->failed = true;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
346 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
347
42373
7f7617773171 fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents: 42146
diff changeset
348 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
349
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
350 processQueue();
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
351 }
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 void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
354 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
355 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
356
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
357 this->externallyClosed = true;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
358 this->close();
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
359 }
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 void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
362 PurpleKWalletPlugin::Engine::processQueue() {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
363 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
364 this->open();
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
365 } 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
366 while(!this->queue.isEmpty()) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
367 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
368
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
369 if(this->failed) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
370 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
371 } else {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
372 request->execute(this->wallet);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
373 }
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 delete request;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
376 }
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 * PurpleCredentialProvider Implementation
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
382 *****************************************************************************/
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
383 static void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
384 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
385 PurpleKWalletProvider *kwallet_provider = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
386
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
387 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
388
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
389 kwallet_provider->engine->open();
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
390 }
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 static void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
393 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
394 PurpleKWalletProvider *kwallet_provider = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
395
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
396 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
397
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
398 kwallet_provider->engine->close();
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
399 }
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 static void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
402 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
403 PurpleAccount *account,
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
404 GCancellable *cancellable,
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
405 GAsyncReadyCallback callback,
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
406 gpointer data)
36502
dfce617913fe Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
407 {
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
408 PurpleKWalletProvider *kwallet_provider = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
409 PurpleKWalletPlugin::ReadRequest *request = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
410 GTask *task = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
411 QString key;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
412
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
413 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
414
42592
6b65c0e4ba15 Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents: 42591
diff changeset
415 task = g_task_new(provider, cancellable, callback, data);
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
416
42591
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
417 /* We manually set the task name otherwise the (gpointer) cast ends up in
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
418 * the name.
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
419 */
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
420 g_task_set_static_name(task, "purple_kwallet_read_password_async");
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
421 g_task_set_source_tag(task, (gpointer)purple_kwallet_read_password_async);
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
422
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
423 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
424
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
425 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
426 kwallet_provider->engine->enqueue(request);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
427
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
428 g_clear_object(&task);
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
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
431 static gchar *
42076
76417a1fa9b2 Mark unused parameters as such for all of the purple plugins
Gary Kramlich <grim@reaperworld.com>
parents: 41974
diff changeset
432 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
433 GAsyncResult *result, GError **error)
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
434 {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
435 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
436 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
437
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
438 static void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
439 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
440 PurpleAccount *account,
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
441 const gchar *password,
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
442 GCancellable *cancellable,
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
443 GAsyncReadyCallback callback,
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
444 gpointer data)
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 PurpleKWalletProvider *kwallet_provider = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
447 PurpleKWalletPlugin::WriteRequest *request = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
448 GTask *task = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
449 QString key;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
450
42592
6b65c0e4ba15 Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents: 42591
diff changeset
451 task = g_task_new(provider, cancellable, callback, data);
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
452
42591
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
453 /* We manually set the task name otherwise the (gpointer) cast ends up in
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
454 * the name.
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
455 */
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
456 g_task_set_static_name(task, "purple_kwallet_write_password_async");
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
457 g_task_set_source_tag(task, (gpointer)purple_kwallet_write_password_async);
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
458
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
459 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
460
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
461 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
462
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
463 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
464 kwallet_provider->engine->enqueue(request);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
465
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
466 g_clear_object(&task);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
467 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
468
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
469 static gboolean
42076
76417a1fa9b2 Mark unused parameters as such for all of the purple plugins
Gary Kramlich <grim@reaperworld.com>
parents: 41974
diff changeset
470 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
471 GAsyncResult *result, GError **error)
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
472 {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
473 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
474 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
475
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
476 static void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
477 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
478 PurpleAccount *account,
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
479 GCancellable *cancellable,
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
480 GAsyncReadyCallback callback,
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
481 gpointer data)
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 PurpleKWalletProvider *kwallet_provider = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
484 PurpleKWalletPlugin::ClearRequest *request = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
485 GTask *task = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
486 QString key;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
487
42592
6b65c0e4ba15 Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents: 42591
diff changeset
488 task = g_task_new(provider, cancellable, callback, data);
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
489
42591
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
490 /* We manually set the task name otherwise the (gpointer) cast ends up in
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
491 * the name.
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
492 */
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
493 g_task_set_static_name(task, "purple_kwallet_clear_password_async");
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
494 g_task_set_source_tag(task, (gpointer)purple_kwallet_clear_password_async);
aa3f777462d8 Use g_task_set_source_tag on all of our async methods
Gary Kramlich <grim@reaperworld.com>
parents: 42572
diff changeset
495
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
496 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
497
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
498 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
499
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
500 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
501 kwallet_provider->engine->enqueue(request);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
502
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
503 g_clear_object(&task);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
504 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
505
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
506 static gboolean
42076
76417a1fa9b2 Mark unused parameters as such for all of the purple plugins
Gary Kramlich <grim@reaperworld.com>
parents: 41974
diff changeset
507 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
508 GAsyncResult *result, GError **error)
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 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
511 }
36642
b8ba53daa445 Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents: 36505
diff changeset
512
40823
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 * GObject Implementation
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
515 *****************************************************************************/
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
516 static void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
517 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
518 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
519
40825
a6a5e36ddfe5 Fix a crash on shutdown in kwallet if the wallet was never opened.
Gary Kramlich <grim@reaperworld.com>
parents: 40823
diff changeset
520 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
521 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
522 }
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
523
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
524 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
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_finalize(GObject *obj) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
529 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
530
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
531 if(provider->engine != NULL) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
532 delete provider->engine;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
533 provider->engine = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
534 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
535
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
536 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
537 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
538
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
539 static void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
540 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
541 provider->engine = new PurpleKWalletPlugin::Engine();
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
542 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
543
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
544 static void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
545 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
546 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
547 PurpleCredentialProviderClass *provider_class = NULL;
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 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
550
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
551 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
552 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
553
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
554 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
555 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
556 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
557 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
558 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
559 provider_class->write_password_finish =
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
560 purple_kwallet_write_password_finish;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
561 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
562 provider_class->clear_password_finish =
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
563 purple_kwallet_clear_password_finish;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
564 }
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 static void
42076
76417a1fa9b2 Mark unused parameters as such for all of the purple plugins
Gary Kramlich <grim@reaperworld.com>
parents: 41974
diff changeset
567 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
568 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
569
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
570 /******************************************************************************
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
571 * API
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
572 *****************************************************************************/
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
573 static PurpleCredentialProvider *
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
574 purple_kwallet_provider_new(void) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
575 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
576 PURPLE_KWALLET_TYPE_PROVIDER,
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
577 "id", "kwallet",
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
578 "name", _("KWallet"),
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
579 "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
580 "Software Compilation desktop environment"),
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
581 NULL
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
582 ));
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
583 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
584
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
585 /******************************************************************************
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
586 * Plugin Exports
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
587 *****************************************************************************/
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
588 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
589 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
590 const gchar * const authors[] = {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
591 "Pidgin Developers <devel@pidgin.im>",
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
592 NULL
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
593 };
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
594
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
595 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
596 "id", "keyring-kwallet",
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
597 "name", N_("KWallet"),
36502
dfce617913fe Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
598 "version", DISPLAY_VERSION,
dfce617913fe Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
599 "category", N_("Keyring"),
dfce617913fe Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
600 "summary", "KWallet Keyring Plugin",
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
601 "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
602 "authors", authors,
36502
dfce617913fe Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
603 "website", PURPLE_WEBSITE,
36505
60c161851325 Integrated purple ABI requirement into GPlugin's "abi-version" property
Ankit Vani <a@nevitus.org>
parents: 36502
diff changeset
604 "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
605 "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
606 PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD,
36502
dfce617913fe Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
607 NULL
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
608 ));
36502
dfce617913fe Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
609 }
dfce617913fe Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
610
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
611 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
612 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
613 PurpleCredentialManager *manager = NULL;
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 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
616
42373
7f7617773171 fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents: 42146
diff changeset
617 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
618 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
619 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
620 coreApp->setApplicationName(purple_kwallet_get_ui_name());
34119
8852b9a4dd2a Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34118
diff changeset
621 }
8852b9a4dd2a Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34118
diff changeset
622
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
623 if(!KWallet::Wallet::isEnabled()) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
624 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
625 "KWallet service is disabled.");
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
626
34120
50bc553c8c52 Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34119
diff changeset
627 return FALSE;
50bc553c8c52 Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34119
diff changeset
628 }
50bc553c8c52 Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34119
diff changeset
629
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
630 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
631
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
632 instance = purple_kwallet_provider_new();
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
633
40987
671f2442e50e Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents: 40882
diff changeset
634 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
635 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
636
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
637 static gboolean
41078
84e48180ef67 Update to gplugin 0.35.0
Gary Kramlich <grim@reaperworld.com>
parents: 40987
diff changeset
638 kwallet_unload(G_GNUC_UNUSED GPluginPlugin *plugin,
84e48180ef67 Update to gplugin 0.35.0
Gary Kramlich <grim@reaperworld.com>
parents: 40987
diff changeset
639 G_GNUC_UNUSED gboolean shutdown,
84e48180ef67 Update to gplugin 0.35.0
Gary Kramlich <grim@reaperworld.com>
parents: 40987
diff changeset
640 GError **error)
84e48180ef67 Update to gplugin 0.35.0
Gary Kramlich <grim@reaperworld.com>
parents: 40987
diff changeset
641 {
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
642 PurpleCredentialManager *manager = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
643 gboolean ret = FALSE;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
644
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
645 manager = purple_credential_manager_get_default();
40987
671f2442e50e Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents: 40882
diff changeset
646 ret = purple_credential_manager_unregister(manager, instance, error);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
647
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
648 if(!ret) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
649 return ret;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
650 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
651
42373
7f7617773171 fix problem that Pidgin3 couldn't be run using broadway GDK_BACKEND anymore
Markus Fischer <ivanhoe@fiscari.de>
parents: 42146
diff changeset
652 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
653 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
654 coreApp = NULL;
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
655 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
656
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
657 g_clear_object(&instance);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
658
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
659 return TRUE;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
660 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
661
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
662 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
663 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
664 G_END_DECLS

mercurial