Fri, 01 May 2020 12:13:35 -0500
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
1 | /** |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
2 | * @file kwallet.cpp KWallet password storage |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
3 | * @ingroup plugins |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
4 | */ |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
5 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
6 | /* purple |
|
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 | * 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
|
9 | * 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
|
10 | * source distribution. |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
11 | * |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
12 | * 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
|
13 | * 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
|
14 | * 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
|
15 | * (at your option) any later version. |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
16 | * |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
17 | * 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
|
18 | * 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
|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
20 | * GNU General Public License for more details. |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
21 | * |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
22 | * You should have received a copy of the GNU General Public License |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
23 | * along with this program ; if not, write to the Free Software |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
25 | */ |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
26 | |
|
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
|
27 | #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
|
28 | |
|
39959
e47fcffd061b
migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents:
39926
diff
changeset
|
29 | #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
|
30 | |
|
34079
fcf75ee4d190
Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34077
diff
changeset
|
31 | #include <QQueue> |
|
34085
26a50ff943ed
Add a QCoreApplication to process events, which is a bit lighter
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34084
diff
changeset
|
32 | #include <QCoreApplication> |
|
39923
f977be37ebc0
Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
37065
diff
changeset
|
33 | |
|
f977be37ebc0
Get the kwallet plugin compiling again
Gary Kramlich <grim@reaperworld.com>
parents:
37065
diff
changeset
|
34 | #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
|
35 | |
|
34060
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
36 | #define KWALLET_NAME N_("KWallet") |
|
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
37 | #define KWALLET_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
|
38 | #define KWALLET_AUTHORS { "QuLogic (qulogic[at]pidgin.im)", NULL } |
|
34093
c8197603fa20
Use better keyring IDs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34089
diff
changeset
|
39 | #define KWALLET_ID "keyring-kwallet" |
|
36502
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
40 | #define KWALLET_DOMAIN (g_quark_from_static_string(KWALLET_ID)) |
|
34014
647e174899a9
Took stuff from kwallet.cpp out of the extern "C" {}
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
34005
diff
changeset
|
41 | |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
42 | #define KWALLET_WALLET_NAME KWallet::Wallet::NetworkWallet() |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
43 | #define KWALLET_APP_NAME "Libpurple" |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
44 | #define KWALLET_FOLDER_NAME "libpurple" |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
45 | |
|
34097
f6f36bfbe951
Free the keyring when the KWallet plugin is unloaded.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34096
diff
changeset
|
46 | PurpleKeyring *keyring_handler = NULL; |
|
34119
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
47 | QCoreApplication *qCoreApp = NULL; |
|
34014
647e174899a9
Took stuff from kwallet.cpp out of the extern "C" {}
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
34005
diff
changeset
|
48 | |
|
34120
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
49 | static gboolean |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
50 | kwallet_is_enabled(void) |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
51 | { |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
52 | return KWallet::Wallet::isEnabled() ? TRUE : FALSE; |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
53 | } |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
54 | |
|
34080
098a43dd4835
Initialize pinstance.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34079
diff
changeset
|
55 | KWalletPlugin::engine *KWalletPlugin::engine::pinstance = NULL; |
|
098a43dd4835
Initialize pinstance.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34079
diff
changeset
|
56 | |
|
34114
c915903f6e43
Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34110
diff
changeset
|
57 | KWalletPlugin::request::~request() |
|
c915903f6e43
Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34110
diff
changeset
|
58 | { |
|
c915903f6e43
Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34110
diff
changeset
|
59 | } |
|
c915903f6e43
Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34110
diff
changeset
|
60 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
61 | void |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
62 | KWalletPlugin::request::abort() |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
63 | { |
|
34154
857c361d3791
Refine keyring error coded
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34152
diff
changeset
|
64 | detailedAbort(PURPLE_KEYRING_ERROR_CANCELLED); |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
65 | } |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
66 | |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
67 | KWalletPlugin::engine::engine() |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
68 | { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
69 | connected = false; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
70 | failed = false; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
71 | closing = false; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
72 | externallyClosed = false; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
73 | wallet = NULL; |
|
34123
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
74 | busy = false; |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
75 | closeAfterBusy = false; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
76 | |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
77 | reopenWallet(); |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
78 | } |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
79 | |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
80 | void |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
81 | KWalletPlugin::engine::reopenWallet() |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
82 | { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
83 | if (closing) { |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
84 | purple_debug_error("keyring-kwallet", |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
85 | "wallet is closing right now\n"); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
86 | failed = true; |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
87 | return; |
|
34110
bda1c52322fe
Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34098
diff
changeset
|
88 | } |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
89 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
90 | connected = false; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
91 | failed = false; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
92 | externallyClosed = false; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
93 | |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
94 | wallet = KWallet::Wallet::openWallet(KWALLET_WALLET_NAME, 0, |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
95 | KWallet::Wallet::Asynchronous); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
96 | if (wallet == NULL) { |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
97 | failed = true; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
98 | purple_debug_error("keyring-kwallet", |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
99 | "failed opening a wallet\n"); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
100 | return; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
101 | } |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
102 | |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
103 | failed |= !connect(wallet, SIGNAL(walletClosed()), |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
104 | SLOT(walletClosed())); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
105 | failed |= !connect(wallet, SIGNAL(walletOpened(bool)), |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
106 | SLOT(walletOpened(bool))); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
107 | if (failed) { |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
108 | purple_debug_error("keyring-kwallet", |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
109 | "failed connecting to wallet signal\n"); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
110 | } |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
111 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
112 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
113 | KWalletPlugin::engine::~engine() |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
114 | { |
|
34087
b9798bef2af2
Don't crash if we're closing while the instance is already in the midst
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34085
diff
changeset
|
115 | closing = true; |
|
34139
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
116 | |
|
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
117 | abortAll(); |
|
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
118 | |
|
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
119 | delete wallet; |
|
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
120 | |
|
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
121 | if (pinstance == this) |
|
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
122 | pinstance = NULL; |
|
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
123 | } |
|
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
124 | |
|
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
125 | void |
|
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
126 | KWalletPlugin::engine::abortAll() |
|
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
127 | { |
|
34127
51c1bce7f52f
Tidying debug messages, signals
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34126
diff
changeset
|
128 | int abortedCount = 0; |
|
34087
b9798bef2af2
Don't crash if we're closing while the instance is already in the midst
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34085
diff
changeset
|
129 | |
|
34079
fcf75ee4d190
Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34077
diff
changeset
|
130 | while (!isEmpty()) { |
|
fcf75ee4d190
Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34077
diff
changeset
|
131 | request *req = dequeue(); |
|
34077
3e4d7e7d3064
Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34076
diff
changeset
|
132 | req->abort(); |
|
3e4d7e7d3064
Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34076
diff
changeset
|
133 | delete req; |
|
34127
51c1bce7f52f
Tidying debug messages, signals
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34126
diff
changeset
|
134 | abortedCount++; |
|
51c1bce7f52f
Tidying debug messages, signals
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34126
diff
changeset
|
135 | } |
|
51c1bce7f52f
Tidying debug messages, signals
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34126
diff
changeset
|
136 | |
|
51c1bce7f52f
Tidying debug messages, signals
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34126
diff
changeset
|
137 | if (abortedCount > 0) { |
|
51c1bce7f52f
Tidying debug messages, signals
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34126
diff
changeset
|
138 | purple_debug_info("keyring-kwallet", "aborted requests: %d\n", |
|
51c1bce7f52f
Tidying debug messages, signals
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34126
diff
changeset
|
139 | abortedCount); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
140 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
141 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
142 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
143 | KWalletPlugin::engine * |
|
34139
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
144 | KWalletPlugin::engine::instance(bool create) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
145 | { |
|
34139
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
146 | if (pinstance == NULL && create) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
147 | pinstance = new engine; |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
148 | return pinstance; |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
149 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
150 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
151 | void |
|
34155
567c48f9658c
Refactor the keyring API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34154
diff
changeset
|
152 | KWalletPlugin::engine::closeInstance(void) |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
153 | { |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
154 | if (pinstance == NULL) |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
155 | return; |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
156 | if (pinstance->closing) |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
157 | return; |
|
34123
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
158 | if (pinstance->busy) { |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
159 | purple_debug_misc("keyring-kwallet", |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
160 | "current instance is busy, will be freed later\n"); |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
161 | pinstance->closeAfterBusy = true; |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
162 | } else |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
163 | delete pinstance; |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
164 | pinstance = NULL; |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
165 | } |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
166 | |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
167 | void |
|
34067
8643ef2b5bf4
This seems to fix compiling the signal stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34062
diff
changeset
|
168 | KWalletPlugin::engine::walletOpened(bool opened) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
169 | { |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
170 | connected = opened; |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
171 | |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
172 | if (!opened) { |
|
34127
51c1bce7f52f
Tidying debug messages, signals
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34126
diff
changeset
|
173 | purple_debug_warning("keyring-kwallet", |
|
51c1bce7f52f
Tidying debug messages, signals
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34126
diff
changeset
|
174 | "failed to open a wallet\n"); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
175 | delete this; |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
176 | return; |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
177 | } |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
178 | |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
179 | if (!wallet->hasFolder(KWALLET_FOLDER_NAME)) { |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
180 | if (!wallet->createFolder(KWALLET_FOLDER_NAME)) { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
181 | purple_debug_error("keyring-kwallet", |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
182 | "couldn't create \"" KWALLET_FOLDER_NAME |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
183 | "\" folder in wallet\n"); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
184 | failed = true; |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
185 | } |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
186 | } |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
187 | if (!failed) |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
188 | wallet->setFolder(KWALLET_FOLDER_NAME); |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
189 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
190 | executeRequests(); |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
191 | } |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
192 | |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
193 | void |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
194 | KWalletPlugin::engine::walletClosed() |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
195 | { |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
196 | if (!closing) { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
197 | purple_debug_info("keyring-kwallet", |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
198 | "wallet was externally closed\n"); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
199 | externallyClosed = true; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
200 | delete wallet; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
201 | wallet = NULL; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
202 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
203 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
204 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
205 | void |
|
34077
3e4d7e7d3064
Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34076
diff
changeset
|
206 | KWalletPlugin::engine::queue(request *req) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
207 | { |
|
34079
fcf75ee4d190
Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34077
diff
changeset
|
208 | enqueue(req); |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
209 | executeRequests(); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
210 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
211 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
212 | void |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
213 | KWalletPlugin::engine::executeRequests() |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
214 | { |
|
34123
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
215 | if (closing || busy) |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
216 | return; |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
217 | busy = true; |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
218 | if (externallyClosed) { |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
219 | reopenWallet(); |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
220 | } else if (connected || failed) { |
|
34079
fcf75ee4d190
Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34077
diff
changeset
|
221 | while (!isEmpty()) { |
|
fcf75ee4d190
Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34077
diff
changeset
|
222 | request *req = dequeue(); |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
223 | if (connected) |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
224 | req->execute(wallet); |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
225 | else |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
226 | req->abort(); |
|
34077
3e4d7e7d3064
Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34076
diff
changeset
|
227 | delete req; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
228 | } |
|
34145
fa72f1e5cd77
Some polishing on files modified on this branch (mostly formatting)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34139
diff
changeset
|
229 | } else if (purple_debug_is_verbose()) { |
|
34110
bda1c52322fe
Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34098
diff
changeset
|
230 | purple_debug_misc("keyring-kwallet", "not yet connected\n"); |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
231 | } |
|
34123
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
232 | busy = false; |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
233 | if (closeAfterBusy) { |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
234 | purple_debug_misc("keyring-kwallet", |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
235 | "instance freed after being busy\n"); |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
236 | delete this; |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
237 | } |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
238 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
239 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
240 | KWalletPlugin::save_request::save_request(PurpleAccount *acc, const char *pw, |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
241 | PurpleKeyringSaveCallback cb, void *userdata) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
242 | { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
243 | account = acc; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
244 | data = userdata; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
245 | callback = cb; |
|
34072
5450e39dd3c5
It appears that a QString can be treated as if it were a value type.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34071
diff
changeset
|
246 | password = QString(pw); |
|
34126
a479dca0f05b
Implement removal of KWallet passwords (instead of setting them to blank)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34125
diff
changeset
|
247 | noPassword = (pw == NULL); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
248 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
249 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
250 | KWalletPlugin::read_request::read_request(PurpleAccount *acc, |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
251 | PurpleKeyringReadCallback cb, void *userdata) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
252 | { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
253 | account = acc; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
254 | data = userdata; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
255 | callback = cb; |
|
34072
5450e39dd3c5
It appears that a QString can be treated as if it were a value type.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34071
diff
changeset
|
256 | password = QString(); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
257 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
258 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
259 | void |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
260 | KWalletPlugin::save_request::detailedAbort(enum PurpleKeyringError error) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
261 | { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
262 | GError *gerror; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
263 | if (callback == NULL) |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
264 | return; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
265 | |
|
34129
52b91b4b8314
Proper error handling when doing a password migration, fixes reverting it.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34127
diff
changeset
|
266 | gerror = g_error_new(PURPLE_KEYRING_ERROR, error, |
|
34199
73d122f25f2b
Localize strings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34174
diff
changeset
|
267 | _("Failed to save password.")); |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
268 | callback(account, gerror, data); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
269 | g_error_free(gerror); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
270 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
271 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
272 | void |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
273 | KWalletPlugin::read_request::detailedAbort(enum PurpleKeyringError error) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
274 | { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
275 | GError *gerror; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
276 | if (callback == NULL) |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
277 | return; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
278 | |
|
34129
52b91b4b8314
Proper error handling when doing a password migration, fixes reverting it.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34127
diff
changeset
|
279 | gerror = g_error_new(PURPLE_KEYRING_ERROR, error, |
|
34199
73d122f25f2b
Localize strings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34174
diff
changeset
|
280 | _("Failed to read password.")); |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
281 | callback(account, NULL, gerror, data); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
282 | g_error_free(gerror); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
283 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
284 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
285 | static QString |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
286 | kwallet_account_key(PurpleAccount *account) |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
287 | { |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
288 | return QString(purple_account_get_protocol_id(account)) + ":" + |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
289 | purple_account_get_username(account); |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
290 | } |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
291 | |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
292 | void |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
293 | KWalletPlugin::read_request::execute(KWallet::Wallet *wallet) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
294 | { |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
295 | int result; |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
296 | |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
297 | g_return_if_fail(wallet != NULL); |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
298 | |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
299 | result = wallet->readPassword(kwallet_account_key(account), password); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
300 | |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
301 | if (result != 0) { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
302 | purple_debug_warning("keyring-kwallet", |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
303 | "failed to read password, result was %d\n", result); |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
304 | abort(); |
|
34136
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
305 | return; |
|
34110
bda1c52322fe
Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34098
diff
changeset
|
306 | } |
|
34136
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
307 | |
|
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
308 | purple_debug_misc("keyring-kwallet", |
|
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
309 | "Got password for account %s (%s).\n", |
|
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
310 | purple_account_get_username(account), |
|
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
311 | purple_account_get_protocol_id(account)); |
|
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
312 | |
|
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
313 | if (callback != NULL) |
|
34072
5450e39dd3c5
It appears that a QString can be treated as if it were a value type.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34071
diff
changeset
|
314 | callback(account, password.toUtf8().constData(), NULL, data); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
315 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
316 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
317 | void |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
318 | KWalletPlugin::save_request::execute(KWallet::Wallet *wallet) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
319 | { |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
320 | int result; |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
321 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
322 | g_return_if_fail(wallet != NULL); |
|
34110
bda1c52322fe
Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34098
diff
changeset
|
323 | |
|
34126
a479dca0f05b
Implement removal of KWallet passwords (instead of setting them to blank)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34125
diff
changeset
|
324 | if (noPassword) |
|
a479dca0f05b
Implement removal of KWallet passwords (instead of setting them to blank)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34125
diff
changeset
|
325 | result = wallet->removeEntry(kwallet_account_key(account)); |
|
a479dca0f05b
Implement removal of KWallet passwords (instead of setting them to blank)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34125
diff
changeset
|
326 | else { |
|
a479dca0f05b
Implement removal of KWallet passwords (instead of setting them to blank)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34125
diff
changeset
|
327 | result = wallet->writePassword(kwallet_account_key(account), |
|
a479dca0f05b
Implement removal of KWallet passwords (instead of setting them to blank)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34125
diff
changeset
|
328 | password); |
|
a479dca0f05b
Implement removal of KWallet passwords (instead of setting them to blank)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34125
diff
changeset
|
329 | } |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
330 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
331 | if (result != 0) { |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
332 | purple_debug_warning("keyring-kwallet", |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
333 | "failed to write password, result was %d\n", result); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
334 | abort(); |
|
34136
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
335 | return; |
|
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
336 | } |
|
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
337 | |
|
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
338 | purple_debug_misc("keyring-kwallet", |
|
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
339 | "Password %s for account %s (%s).\n", |
|
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
340 | (noPassword ? "removed" : "saved"), |
|
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
341 | purple_account_get_username(account), |
|
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
342 | purple_account_get_protocol_id(account)); |
|
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
343 | |
|
e9722a935271
Re-implemented GNOME Keyring plugin
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34134
diff
changeset
|
344 | if (callback != NULL) |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
345 | callback(account, NULL, data); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
346 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
347 | |
|
34060
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
348 | extern "C" |
|
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
349 | { |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
350 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
351 | static void |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
352 | kwallet_read(PurpleAccount *account, PurpleKeyringReadCallback cb, |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
353 | gpointer data) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
354 | { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
355 | KWalletPlugin::read_request *req = |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
356 | new KWalletPlugin::read_request(account, cb, data); |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
357 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
358 | if (KWallet::Wallet::keyDoesNotExist(KWALLET_WALLET_NAME, |
|
35363
35d4640f79ac
Style: keyrings, examples
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34281
diff
changeset
|
359 | KWALLET_FOLDER_NAME, kwallet_account_key(account))) |
|
35d4640f79ac
Style: keyrings, examples
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34281
diff
changeset
|
360 | { |
|
34154
857c361d3791
Refine keyring error coded
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34152
diff
changeset
|
361 | req->detailedAbort(PURPLE_KEYRING_ERROR_NOPASSWORD); |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
362 | delete req; |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
363 | } |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
364 | else |
|
34139
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
365 | KWalletPlugin::engine::instance(true)->queue(req); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
366 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
367 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
368 | static void |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
369 | kwallet_save(PurpleAccount *account, const char *password, |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
370 | PurpleKeyringSaveCallback cb, gpointer data) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
371 | { |
|
34126
a479dca0f05b
Implement removal of KWallet passwords (instead of setting them to blank)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34125
diff
changeset
|
372 | if (password == NULL && KWallet::Wallet::keyDoesNotExist( |
|
a479dca0f05b
Implement removal of KWallet passwords (instead of setting them to blank)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34125
diff
changeset
|
373 | KWALLET_WALLET_NAME, KWALLET_FOLDER_NAME, |
|
35363
35d4640f79ac
Style: keyrings, examples
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34281
diff
changeset
|
374 | kwallet_account_key(account))) |
|
35d4640f79ac
Style: keyrings, examples
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34281
diff
changeset
|
375 | { |
|
34126
a479dca0f05b
Implement removal of KWallet passwords (instead of setting them to blank)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34125
diff
changeset
|
376 | if (cb != NULL) |
|
a479dca0f05b
Implement removal of KWallet passwords (instead of setting them to blank)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34125
diff
changeset
|
377 | cb(account, NULL, data); |
|
a479dca0f05b
Implement removal of KWallet passwords (instead of setting them to blank)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34125
diff
changeset
|
378 | } |
|
a479dca0f05b
Implement removal of KWallet passwords (instead of setting them to blank)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34125
diff
changeset
|
379 | else |
|
34139
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
380 | KWalletPlugin::engine::instance(true)->queue( |
|
34126
a479dca0f05b
Implement removal of KWallet passwords (instead of setting them to blank)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34125
diff
changeset
|
381 | new KWalletPlugin::save_request(account, password, cb, |
|
a479dca0f05b
Implement removal of KWallet passwords (instead of setting them to blank)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34125
diff
changeset
|
382 | data)); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
383 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
384 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
385 | static void |
|
34139
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
386 | kwallet_cancel(void) |
|
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
387 | { |
|
34170
94102637e7c7
Coding style and entry description for GNOME Keyring
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34155
diff
changeset
|
388 | KWalletPlugin::engine *instance = |
|
94102637e7c7
Coding style and entry description for GNOME Keyring
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34155
diff
changeset
|
389 | KWalletPlugin::engine::instance(false); |
|
34139
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
390 | if (instance) |
|
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
391 | instance->abortAll(); |
|
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
392 | } |
|
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
393 | |
|
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
|
394 | static void * |
|
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
|
395 | kwallet_get_handle(void) |
|
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
|
396 | { |
|
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
|
397 | static int handle; |
|
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
|
398 | |
|
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
|
399 | return &handle; |
|
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
|
400 | } |
|
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
|
401 | |
|
34152
524edcbc83cb
Use purple_core_get_ui_info instead of g_get_application_name
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34146
diff
changeset
|
402 | static const char *kwallet_get_ui_name(void) |
|
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
|
403 | { |
|
40312
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
39959
diff
changeset
|
404 | PurpleUiInfo *ui_info = 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
|
405 | const char *ui_name = NULL; |
|
524edcbc83cb
Use purple_core_get_ui_info instead of g_get_application_name
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34146
diff
changeset
|
406 | |
|
524edcbc83cb
Use purple_core_get_ui_info instead of g_get_application_name
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34146
diff
changeset
|
407 | ui_info = purple_core_get_ui_info(); |
|
40312
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
39959
diff
changeset
|
408 | if(PURPLE_IS_UI_INFO(ui_info)) { |
|
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
39959
diff
changeset
|
409 | ui_name = purple_ui_info_get_name(ui_info); |
|
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
39959
diff
changeset
|
410 | g_object_unref(G_OBJECT(ui_info)); |
|
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
39959
diff
changeset
|
411 | } |
|
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
39959
diff
changeset
|
412 | |
|
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
39959
diff
changeset
|
413 | if(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
|
414 | ui_name = KWALLET_APP_NAME; |
|
40312
956745ff3ee8
Replace the ui info GHashTable with a gobject.
Gary Kramlich <grim@reaperworld.com>
parents:
39959
diff
changeset
|
415 | } |
|
34152
524edcbc83cb
Use purple_core_get_ui_info instead of g_get_application_name
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34146
diff
changeset
|
416 | |
|
524edcbc83cb
Use purple_core_get_ui_info instead of g_get_application_name
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34146
diff
changeset
|
417 | 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
|
418 | } |
|
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
|
419 | |
|
36502
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
420 | static PurplePluginInfo * |
|
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
421 | plugin_query(GError **error) |
|
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
422 | { |
|
36642
b8ba53daa445
Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents:
36505
diff
changeset
|
423 | const gchar * const authors[] = KWALLET_AUTHORS; |
|
b8ba53daa445
Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents:
36505
diff
changeset
|
424 | |
|
36502
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
425 | return purple_plugin_info_new( |
|
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
426 | "id", KWALLET_ID, |
|
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
427 | "name", KWALLET_NAME, |
|
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
428 | "version", DISPLAY_VERSION, |
|
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
429 | "category", N_("Keyring"), |
|
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
430 | "summary", "KWallet Keyring Plugin", |
|
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
431 | "description", KWALLET_DESCRIPTION, |
|
36642
b8ba53daa445
Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents:
36505
diff
changeset
|
432 | "authors", authors, |
|
36502
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
433 | "website", PURPLE_WEBSITE, |
|
36505
60c161851325
Integrated purple ABI requirement into GPlugin's "abi-version" property
Ankit Vani <a@nevitus.org>
parents:
36502
diff
changeset
|
434 | "abi-version", PURPLE_ABI_VERSION, |
|
39926
af2417fdea65
Mark kwallet as internal again
Gary Kramlich <grim@reaperworld.com>
parents:
39925
diff
changeset
|
435 | "flags", PURPLE_PLUGIN_INFO_FLAGS_INTERNAL, |
|
39925
ea8f90a385c5
Remove the internal flag on the kwallet keyring so it can be used while the keyring api issue gets figured out
Gary Kramlich <grim@reaperworld.com>
parents:
39924
diff
changeset
|
436 | |
|
36502
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
437 | NULL |
|
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
438 | ); |
|
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
439 | } |
|
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
440 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
441 | static gboolean |
|
36502
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
442 | plugin_load(PurplePlugin *plugin, GError **error) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
443 | { |
|
34119
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
444 | if (!qCoreApp) { |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
445 | int argc = 0; |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
446 | qCoreApp = new QCoreApplication(argc, 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
|
447 | qCoreApp->setApplicationName(kwallet_get_ui_name()); |
|
34119
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
448 | } |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
449 | |
|
34120
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
450 | if (!kwallet_is_enabled()) { |
|
36502
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
451 | g_set_error(error, KWALLET_DOMAIN, 0, "KWallet service is disabled."); |
|
34120
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
452 | purple_debug_info("keyring-kwallet", |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
453 | "KWallet service is disabled\n"); |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
454 | return FALSE; |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
455 | } |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
456 | |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
457 | keyring_handler = purple_keyring_new(); |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
458 | |
|
34281
ad957d0a467a
Keyring (and some GTK): fix translation callbacks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34199
diff
changeset
|
459 | purple_keyring_set_name(keyring_handler, _(KWALLET_NAME)); |
|
34060
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
460 | purple_keyring_set_id(keyring_handler, KWALLET_ID); |
|
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
461 | purple_keyring_set_read_password(keyring_handler, kwallet_read); |
|
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
462 | purple_keyring_set_save_password(keyring_handler, kwallet_save); |
|
34139
37d7d0e22484
Revert existing password migration at exit, allow cancelling kwallet requests
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34136
diff
changeset
|
463 | purple_keyring_set_cancel_requests(keyring_handler, kwallet_cancel); |
|
34170
94102637e7c7
Coding style and entry description for GNOME Keyring
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34155
diff
changeset
|
464 | purple_keyring_set_close_keyring(keyring_handler, |
|
94102637e7c7
Coding style and entry description for GNOME Keyring
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34155
diff
changeset
|
465 | KWalletPlugin::engine::closeInstance); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
466 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
467 | purple_keyring_register(keyring_handler); |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
468 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
469 | return TRUE; |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
470 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
471 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
472 | static gboolean |
|
36502
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
473 | plugin_unload(PurplePlugin *plugin, GError **error) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
474 | { |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
475 | if (purple_keyring_get_inuse() == keyring_handler) { |
|
36502
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
476 | g_set_error(error, KWALLET_DOMAIN, 0, "The keyring is currently " |
|
dfce617913fe
Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents:
36459
diff
changeset
|
477 | "in use."); |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
478 | purple_debug_warning("keyring-kwallet", |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
479 | "keyring in use, cannot unload\n"); |
|
34096
3d28c3311ad0
Don't allow unloading a plugin if its keyring is active.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34095
diff
changeset
|
480 | return FALSE; |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
481 | } |
|
34096
3d28c3311ad0
Don't allow unloading a plugin if its keyring is active.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34095
diff
changeset
|
482 | |
|
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
|
483 | purple_signals_disconnect_by_handle(kwallet_get_handle()); |
|
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
|
484 | |
|
34155
567c48f9658c
Refactor the keyring API
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34154
diff
changeset
|
485 | KWalletPlugin::engine::closeInstance(); |
|
34096
3d28c3311ad0
Don't allow unloading a plugin if its keyring is active.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34095
diff
changeset
|
486 | |
|
34125
34c3dbf12e95
Fix some memleaks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34123
diff
changeset
|
487 | purple_keyring_unregister(keyring_handler); |
|
34097
f6f36bfbe951
Free the keyring when the KWallet plugin is unloaded.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34096
diff
changeset
|
488 | purple_keyring_free(keyring_handler); |
|
f6f36bfbe951
Free the keyring when the KWallet plugin is unloaded.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34096
diff
changeset
|
489 | keyring_handler = NULL; |
|
f6f36bfbe951
Free the keyring when the KWallet plugin is unloaded.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34096
diff
changeset
|
490 | |
|
34119
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
491 | if (qCoreApp) { |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
492 | delete qCoreApp; |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
493 | qCoreApp = NULL; |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
494 | } |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
495 | |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
496 | return TRUE; |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
497 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
498 | |
|
36656
3e21d5b61c2b
Fix keyring plugin names passed to PURPLE_PLUGIN_INIT
Ankit Vani <a@nevitus.org>
parents:
36642
diff
changeset
|
499 | PURPLE_PLUGIN_INIT(kwallet_keyring, plugin_query, plugin_load, plugin_unload); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
500 | |
|
34060
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
501 | } /* extern "C" */ |