Thu, 21 Mar 2013 21:50:25 +0100
Fix some memleaks
|
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 | * |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
5 | * @todo |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
6 | * cleanup error handling and reporting |
|
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 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
9 | /* purple |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
10 | * |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
11 | * 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
|
12 | * 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
|
13 | * source distribution. |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
14 | * |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
15 | * 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
|
16 | * 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
|
17 | * 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
|
18 | * (at your option) any later version. |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
19 | * |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
20 | * 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
|
21 | * 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
|
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
23 | * GNU General Public License for more details. |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
24 | * |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
25 | * 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
|
26 | * 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
|
27 | * 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
|
28 | */ |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
29 | |
|
34076
64e389ae5cc3
Clean up headers and stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34073
diff
changeset
|
30 | #include "internal.h" |
|
64e389ae5cc3
Clean up headers and stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34073
diff
changeset
|
31 | #include "account.h" |
|
64e389ae5cc3
Clean up headers and stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34073
diff
changeset
|
32 | #include "debug.h" |
|
64e389ae5cc3
Clean up headers and stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34073
diff
changeset
|
33 | #include "keyring.h" |
|
64e389ae5cc3
Clean up headers and stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34073
diff
changeset
|
34 | #include "plugin.h" |
|
64e389ae5cc3
Clean up headers and stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34073
diff
changeset
|
35 | #include "version.h" |
|
34014
647e174899a9
Took stuff from kwallet.cpp out of the extern "C" {}
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
34005
diff
changeset
|
36 | |
|
34079
fcf75ee4d190
Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34077
diff
changeset
|
37 | #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
|
38 | #include <QCoreApplication> |
|
34060
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
39 | #include <kwallet.h> |
|
34014
647e174899a9
Took stuff from kwallet.cpp out of the extern "C" {}
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
34005
diff
changeset
|
40 | |
|
34060
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
41 | #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
|
42 | #define KWALLET_DESCRIPTION N_("This plugin will store passwords in KWallet.") |
|
34094
551d0e8ae7fb
I'm pretty sure I wrote most of this plugin, since it didn't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34093
diff
changeset
|
43 | #define KWALLET_AUTHOR "QuLogic (qulogic[at]pidgin.im)" |
|
34093
c8197603fa20
Use better keyring IDs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34089
diff
changeset
|
44 | #define KWALLET_ID "keyring-kwallet" |
|
34014
647e174899a9
Took stuff from kwallet.cpp out of the extern "C" {}
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
34005
diff
changeset
|
45 | |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
46 | #define KWALLET_WALLET_NAME KWallet::Wallet::NetworkWallet() |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
47 | #define KWALLET_APP_NAME "Libpurple" |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
48 | #define KWALLET_FOLDER_NAME "libpurple" |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
49 | |
|
34097
f6f36bfbe951
Free the keyring when the KWallet plugin is unloaded.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34096
diff
changeset
|
50 | PurpleKeyring *keyring_handler = NULL; |
|
34119
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
51 | 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
|
52 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
53 | #define ERR_KWALLETPLUGIN kwallet_plugin_error_domain() |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
54 | |
|
34060
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
55 | namespace KWalletPlugin { |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
56 | |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
57 | class request |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
58 | { |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
59 | public: |
|
34114
c915903f6e43
Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34110
diff
changeset
|
60 | virtual ~request(); |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
61 | virtual void detailedAbort(enum PurpleKeyringError error) = 0; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
62 | void abort(); |
|
34077
3e4d7e7d3064
Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34076
diff
changeset
|
63 | virtual void execute(KWallet::Wallet *wallet) = 0; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
64 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
65 | protected: |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
66 | gpointer data; |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
67 | PurpleAccount *account; |
|
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
|
68 | QString password; |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
69 | }; |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
70 | |
|
34079
fcf75ee4d190
Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34077
diff
changeset
|
71 | class engine : private QObject, private QQueue<request*> |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
72 | { |
|
34084
e94dd262b20a
Fix signal handling. On this side, it's a slot, not a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34081
diff
changeset
|
73 | Q_OBJECT |
|
e94dd262b20a
Fix signal handling. On this side, it's a slot, not a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34081
diff
changeset
|
74 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
75 | public: |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
76 | engine(); |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
77 | ~engine(); |
|
34077
3e4d7e7d3064
Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34076
diff
changeset
|
78 | void queue(request *req); |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
79 | static engine *instance(); |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
80 | static void closeInstance(); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
81 | |
|
34084
e94dd262b20a
Fix signal handling. On this side, it's a slot, not a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34081
diff
changeset
|
82 | private slots: |
|
34067
8643ef2b5bf4
This seems to fix compiling the signal stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34062
diff
changeset
|
83 | void walletOpened(bool opened); |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
84 | void walletClosed(); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
85 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
86 | private: |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
87 | static engine *pinstance; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
88 | |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
89 | bool connected; |
|
34110
bda1c52322fe
Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34098
diff
changeset
|
90 | bool failed; |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
91 | bool closing; |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
92 | bool externallyClosed; |
|
34123
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
93 | bool busy; |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
94 | bool closeAfterBusy; |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
95 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
96 | KWallet::Wallet *wallet; |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
97 | |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
98 | void reopenWallet(); |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
99 | void executeRequests(); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
100 | }; |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
101 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
102 | class save_request : public request |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
103 | { |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
104 | public: |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
105 | save_request(PurpleAccount *account, const char *password, |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
106 | PurpleKeyringSaveCallback cb, void *data); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
107 | void detailedAbort(enum PurpleKeyringError error); |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
108 | void execute(KWallet::Wallet *wallet); |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
109 | |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
110 | private: |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
111 | PurpleKeyringSaveCallback callback; |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
112 | }; |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
113 | |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
114 | class read_request : public request |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
115 | { |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
116 | public: |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
117 | read_request(PurpleAccount *account, |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
118 | PurpleKeyringReadCallback cb, void *data); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
119 | void detailedAbort(enum PurpleKeyringError error); |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
120 | void execute(KWallet::Wallet *wallet); |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
121 | |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
122 | private: |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
123 | PurpleKeyringReadCallback callback; |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
124 | }; |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
125 | |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
126 | static GQuark |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
127 | kwallet_plugin_error_domain(void) |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
128 | { |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
129 | return g_quark_from_static_string("KWallet keyring"); |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
130 | } |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
131 | |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
132 | } |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
133 | |
|
34120
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
134 | static gboolean |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
135 | kwallet_is_enabled(void) |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
136 | { |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
137 | return KWallet::Wallet::isEnabled() ? TRUE : FALSE; |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
138 | } |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
139 | |
|
34080
098a43dd4835
Initialize pinstance.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34079
diff
changeset
|
140 | KWalletPlugin::engine *KWalletPlugin::engine::pinstance = NULL; |
|
098a43dd4835
Initialize pinstance.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34079
diff
changeset
|
141 | |
|
34114
c915903f6e43
Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34110
diff
changeset
|
142 | KWalletPlugin::request::~request() |
|
c915903f6e43
Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34110
diff
changeset
|
143 | { |
|
c915903f6e43
Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34110
diff
changeset
|
144 | } |
|
c915903f6e43
Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34110
diff
changeset
|
145 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
146 | void |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
147 | KWalletPlugin::request::abort() |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
148 | { |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
149 | detailedAbort(PURPLE_KEYRING_ERROR_UNKNOWN); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
150 | } |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
151 | |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
152 | KWalletPlugin::engine::engine() |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
153 | { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
154 | connected = false; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
155 | failed = false; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
156 | closing = false; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
157 | externallyClosed = false; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
158 | wallet = NULL; |
|
34123
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
159 | busy = false; |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
160 | closeAfterBusy = false; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
161 | |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
162 | reopenWallet(); |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
163 | } |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
164 | |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
165 | void |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
166 | KWalletPlugin::engine::reopenWallet() |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
167 | { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
168 | if (closing) { |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
169 | purple_debug_error("keyring-kwallet", |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
170 | "wallet is closing right now\n"); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
171 | failed = true; |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
172 | return; |
|
34110
bda1c52322fe
Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34098
diff
changeset
|
173 | } |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
174 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
175 | connected = false; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
176 | failed = false; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
177 | externallyClosed = false; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
178 | |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
179 | wallet = KWallet::Wallet::openWallet(KWALLET_WALLET_NAME, 0, |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
180 | KWallet::Wallet::Asynchronous); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
181 | if (wallet == NULL) { |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
182 | failed = true; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
183 | purple_debug_error("keyring-kwallet", |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
184 | "failed opening a wallet\n"); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
185 | return; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
186 | } |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
187 | |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
188 | failed |= !connect(wallet, SIGNAL(walletClosed()), |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
189 | SLOT(walletClosed())); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
190 | failed |= !connect(wallet, SIGNAL(walletOpened(bool)), |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
191 | SLOT(walletOpened(bool))); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
192 | if (failed) { |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
193 | purple_debug_error("keyring-kwallet", |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
194 | "failed connecting to wallet signal\n"); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
195 | } |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
196 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
197 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
198 | KWalletPlugin::engine::~engine() |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
199 | { |
|
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
|
200 | closing = true; |
|
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
|
201 | |
|
34079
fcf75ee4d190
Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34077
diff
changeset
|
202 | while (!isEmpty()) { |
|
fcf75ee4d190
Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34077
diff
changeset
|
203 | request *req = dequeue(); |
|
34077
3e4d7e7d3064
Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34076
diff
changeset
|
204 | req->abort(); |
|
3e4d7e7d3064
Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34076
diff
changeset
|
205 | delete req; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
206 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
207 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
208 | delete wallet; |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
209 | |
|
34123
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
210 | if (pinstance == this) |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
211 | pinstance = NULL; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
212 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
213 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
214 | KWalletPlugin::engine * |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
215 | KWalletPlugin::engine::instance() |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
216 | { |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
217 | if (pinstance == NULL) |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
218 | pinstance = new engine; |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
219 | return pinstance; |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
220 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
221 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
222 | void |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
223 | KWalletPlugin::engine::closeInstance() |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
224 | { |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
225 | if (pinstance == NULL) |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
226 | return; |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
227 | if (pinstance->closing) |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
228 | return; |
|
34123
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
229 | if (pinstance->busy) { |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
230 | purple_debug_misc("keyring-kwallet", |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
231 | "current instance is busy, will be freed later\n"); |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
232 | pinstance->closeAfterBusy = true; |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
233 | } else |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
234 | delete pinstance; |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
235 | pinstance = NULL; |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
236 | } |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
237 | |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
238 | void |
|
34067
8643ef2b5bf4
This seems to fix compiling the signal stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34062
diff
changeset
|
239 | KWalletPlugin::engine::walletOpened(bool opened) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
240 | { |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
241 | connected = opened; |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
242 | |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
243 | if (!opened) { |
|
34079
fcf75ee4d190
Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34077
diff
changeset
|
244 | while (!isEmpty()) { |
|
fcf75ee4d190
Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34077
diff
changeset
|
245 | request *req = dequeue(); |
|
34077
3e4d7e7d3064
Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34076
diff
changeset
|
246 | req->abort(); |
|
3e4d7e7d3064
Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34076
diff
changeset
|
247 | delete req; |
|
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 | delete this; |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
250 | return; |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
251 | } |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
252 | |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
253 | if (!wallet->hasFolder(KWALLET_FOLDER_NAME)) { |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
254 | if (!wallet->createFolder(KWALLET_FOLDER_NAME)) { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
255 | purple_debug_error("keyring-kwallet", |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
256 | "couldn't create \"" KWALLET_FOLDER_NAME |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
257 | "\" folder in wallet\n"); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
258 | failed = true; |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
259 | } |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
260 | } |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
261 | if (!failed) |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
262 | wallet->setFolder(KWALLET_FOLDER_NAME); |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
263 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
264 | executeRequests(); |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
265 | } |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
266 | |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
267 | void |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
268 | KWalletPlugin::engine::walletClosed() |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
269 | { |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
270 | if (!closing) { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
271 | purple_debug_info("keyring-kwallet", |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
272 | "wallet was externally closed\n"); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
273 | externallyClosed = true; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
274 | delete wallet; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
275 | wallet = NULL; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
276 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
277 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
278 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
279 | void |
|
34077
3e4d7e7d3064
Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34076
diff
changeset
|
280 | KWalletPlugin::engine::queue(request *req) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
281 | { |
|
34079
fcf75ee4d190
Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34077
diff
changeset
|
282 | enqueue(req); |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
283 | executeRequests(); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
284 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
285 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
286 | void |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
287 | KWalletPlugin::engine::executeRequests() |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
288 | { |
|
34123
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
289 | if (closing || busy) |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
290 | return; |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
291 | busy = true; |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
292 | if (externallyClosed) { |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
293 | reopenWallet(); |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
294 | } 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
|
295 | while (!isEmpty()) { |
|
fcf75ee4d190
Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34077
diff
changeset
|
296 | request *req = dequeue(); |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
297 | if (connected) |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
298 | req->execute(wallet); |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
299 | else |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
300 | req->abort(); |
|
34077
3e4d7e7d3064
Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34076
diff
changeset
|
301 | delete req; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
302 | } |
|
34110
bda1c52322fe
Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34098
diff
changeset
|
303 | } else { |
|
bda1c52322fe
Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34098
diff
changeset
|
304 | 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
|
305 | } |
|
34123
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
306 | busy = false; |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
307 | if (closeAfterBusy) { |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
308 | purple_debug_misc("keyring-kwallet", |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
309 | "instance freed after being busy\n"); |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
310 | delete this; |
|
21aa923e62ad
Fix use-after-free
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34120
diff
changeset
|
311 | } |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
312 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
313 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
314 | 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
|
315 | PurpleKeyringSaveCallback cb, void *userdata) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
316 | { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
317 | account = acc; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
318 | data = userdata; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
319 | 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
|
320 | password = QString(pw); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
321 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
322 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
323 | KWalletPlugin::read_request::read_request(PurpleAccount *acc, |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
324 | PurpleKeyringReadCallback cb, void *userdata) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
325 | { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
326 | account = acc; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
327 | data = userdata; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
328 | 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
|
329 | password = QString(); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
330 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
331 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
332 | void |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
333 | KWalletPlugin::save_request::detailedAbort(enum PurpleKeyringError error) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
334 | { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
335 | GError *gerror; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
336 | if (callback == NULL) |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
337 | return; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
338 | |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
339 | gerror = g_error_new(ERR_KWALLETPLUGIN, error, |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
340 | "Failed to save password"); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
341 | callback(account, gerror, data); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
342 | g_error_free(gerror); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
343 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
344 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
345 | void |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
346 | KWalletPlugin::read_request::detailedAbort(enum PurpleKeyringError error) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
347 | { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
348 | GError *gerror; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
349 | if (callback == NULL) |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
350 | return; |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
351 | |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
352 | gerror = g_error_new(ERR_KWALLETPLUGIN, error, |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
353 | "Failed to read password"); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
354 | callback(account, NULL, gerror, data); |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
355 | g_error_free(gerror); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
356 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
357 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
358 | static QString |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
359 | kwallet_account_key(PurpleAccount *account) |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
360 | { |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
361 | return QString(purple_account_get_protocol_id(account)) + ":" + |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
362 | purple_account_get_username(account); |
|
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 | |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
365 | void |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
366 | KWalletPlugin::read_request::execute(KWallet::Wallet *wallet) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
367 | { |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
368 | int result; |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
369 | |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
370 | g_return_if_fail(wallet != NULL); |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
371 | |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
372 | result = wallet->readPassword(kwallet_account_key(account), password); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
373 | |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
374 | if (result != 0) { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
375 | purple_debug_warning("keyring-kwallet", |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
376 | "failed to read password, result was %d\n", result); |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
377 | abort(); |
|
34110
bda1c52322fe
Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34098
diff
changeset
|
378 | } |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
379 | else 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
|
380 | callback(account, password.toUtf8().constData(), NULL, data); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
381 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
382 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
383 | void |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
384 | KWalletPlugin::save_request::execute(KWallet::Wallet *wallet) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
385 | { |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
386 | int result; |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
387 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
388 | 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
|
389 | |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
390 | result = wallet->writePassword(kwallet_account_key(account), password); |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
391 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
392 | if (result != 0) { |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
393 | purple_debug_warning("keyring-kwallet", |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
394 | "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
|
395 | abort(); |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
396 | } else if (callback != NULL) |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
397 | callback(account, NULL, data); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
398 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
399 | |
|
34060
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
400 | 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
|
401 | { |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
402 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
403 | static void |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
404 | kwallet_read(PurpleAccount *account, PurpleKeyringReadCallback cb, |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
405 | gpointer data) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
406 | { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
407 | KWalletPlugin::read_request *req = |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
408 | new KWalletPlugin::read_request(account, cb, data); |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
409 | |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
410 | if (KWallet::Wallet::keyDoesNotExist(KWALLET_WALLET_NAME, |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
411 | KWALLET_FOLDER_NAME, kwallet_account_key(account))) { |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
412 | req->detailedAbort(PURPLE_KEYRING_ERROR_NOPASSWD); |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
413 | delete req; |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
414 | } |
|
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
415 | else |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
416 | KWalletPlugin::engine::instance()->queue(req); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
417 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
418 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
419 | static void |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
420 | kwallet_save(PurpleAccount *account, const char *password, |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
421 | PurpleKeyringSaveCallback cb, gpointer data) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
422 | { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
423 | KWalletPlugin::engine::instance()->queue( |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
424 | new KWalletPlugin::save_request(account, password, cb, data)); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
425 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
426 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
427 | static void |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
428 | kwallet_close(GError **error) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
429 | { |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
430 | KWalletPlugin::engine::closeInstance(); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
431 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
432 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
433 | static gboolean |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
434 | kwallet_import(PurpleAccount *account, const char *mode, const char *data, |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
435 | GError **error) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
436 | { |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
437 | return TRUE; |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
438 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
439 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
440 | static gboolean |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
441 | kwallet_export(PurpleAccount *account, const char **mode, char **data, |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
442 | GError **error, GDestroyNotify *destroy) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
443 | { |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
444 | *mode = NULL; |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
445 | *data = NULL; |
|
34073
5da1137555a8
There seems to be an asterisk missing here.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34072
diff
changeset
|
446 | *destroy = NULL; |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
447 | |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
448 | return TRUE; |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
449 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
450 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
451 | static gboolean |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
452 | kwallet_load(PurplePlugin *plugin) |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
453 | { |
|
34119
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
454 | if (!qCoreApp) { |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
455 | int argc = 0; |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
456 | qCoreApp = new QCoreApplication(argc, NULL); |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
457 | qCoreApp->setApplicationName(KWALLET_APP_NAME); |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
458 | } |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
459 | |
|
34120
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
460 | if (!kwallet_is_enabled()) { |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
461 | purple_debug_info("keyring-kwallet", |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
462 | "KWallet service is disabled\n"); |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
463 | return FALSE; |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
464 | } |
|
50bc553c8c52
Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34119
diff
changeset
|
465 | |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
466 | keyring_handler = purple_keyring_new(); |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
467 | |
|
34060
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
468 | purple_keyring_set_name(keyring_handler, KWALLET_NAME); |
|
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
469 | 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
|
470 | 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
|
471 | purple_keyring_set_save_password(keyring_handler, kwallet_save); |
|
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
472 | purple_keyring_set_close_keyring(keyring_handler, kwallet_close); |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
473 | /* purple_keyring_set_change_master */ |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
474 | purple_keyring_set_import_password(keyring_handler, kwallet_import); |
|
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
475 | purple_keyring_set_export_password(keyring_handler, kwallet_export); |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
476 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
477 | purple_keyring_register(keyring_handler); |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
478 | |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
479 | return TRUE; |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
480 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
481 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
482 | static gboolean |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
483 | kwallet_unload(PurplePlugin *plugin) |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
484 | { |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
485 | if (purple_keyring_get_inuse() == keyring_handler) { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
486 | purple_debug_warning("keyring-kwallet", |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
487 | "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
|
488 | return FALSE; |
|
34117
543818e9829a
Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34116
diff
changeset
|
489 | } |
|
34096
3d28c3311ad0
Don't allow unloading a plugin if its keyring is active.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34095
diff
changeset
|
490 | |
|
34062
7879224489fd
Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34061
diff
changeset
|
491 | kwallet_close(NULL); |
|
34096
3d28c3311ad0
Don't allow unloading a plugin if its keyring is active.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34095
diff
changeset
|
492 | |
|
34125
34c3dbf12e95
Fix some memleaks
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34123
diff
changeset
|
493 | 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
|
494 | 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
|
495 | keyring_handler = NULL; |
|
f6f36bfbe951
Free the keyring when the KWallet plugin is unloaded.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34096
diff
changeset
|
496 | |
|
34119
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
497 | if (qCoreApp) { |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
498 | delete qCoreApp; |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
499 | qCoreApp = NULL; |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
500 | } |
|
8852b9a4dd2a
Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34118
diff
changeset
|
501 | |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
502 | return TRUE; |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
503 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
504 | |
|
34060
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
505 | PurplePluginInfo plugininfo = |
|
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
506 | { |
|
34118
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
507 | PURPLE_PLUGIN_MAGIC, /* magic */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
508 | PURPLE_MAJOR_VERSION, /* major_version */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
509 | PURPLE_MINOR_VERSION, /* minor_version */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
510 | PURPLE_PLUGIN_STANDARD, /* type */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
511 | NULL, /* ui_requirement */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
512 | PURPLE_PLUGIN_FLAG_INVISIBLE, /* flags */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
513 | NULL, /* dependencies */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
514 | PURPLE_PRIORITY_DEFAULT, /* priority */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
515 | (char*)KWALLET_ID, /* id */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
516 | (char*)KWALLET_NAME, /* name */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
517 | (char*)DISPLAY_VERSION, /* version */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
518 | (char*)"KWallet Keyring Plugin", /* summary */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
519 | (char*)KWALLET_DESCRIPTION, /* description */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
520 | (char*)KWALLET_AUTHOR, /* author */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
521 | (char*)PURPLE_WEBSITE, /* homepage */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
522 | kwallet_load, /* load */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
523 | kwallet_unload, /* unload */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
524 | NULL, /* destroy */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
525 | NULL, /* ui_info */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
526 | NULL, /* extra_info */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
527 | NULL, /* prefs_info */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
528 | NULL, /* actions */ |
|
a83c82be880d
Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34117
diff
changeset
|
529 | NULL, NULL, NULL, NULL /* padding */ |
|
34060
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
530 | }; |
|
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
531 | |
|
34116
825c98f8c7f6
Get rid of PURPLE_PLUGIN_FLAG_AUTOLOAD
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34114
diff
changeset
|
532 | static void |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
533 | init_plugin(PurplePlugin *plugin) |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
534 | { |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
535 | } |
|
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
536 | |
|
34060
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
537 | PURPLE_INIT_PLUGIN(kwallet_keyring, init_plugin, plugininfo) |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
538 | |
|
34060
1ff15466f569
This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34035
diff
changeset
|
539 | } /* extern "C" */ |
|
34005
592e6e8213a9
Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
540 | |
|
34084
e94dd262b20a
Fix signal handling. On this side, it's a slot, not a signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34081
diff
changeset
|
541 | #include "kwallet.moc" |