libpurple/plugins/keyrings/kwallet.cpp

Wed, 20 Mar 2013 16:36:55 +0100

author
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
date
Wed, 20 Mar 2013 16:36:55 +0100
branch
soc.2008.masterpassword
changeset 34120
50bc553c8c52
parent 34119
8852b9a4dd2a
child 34123
21aa923e62ad
permissions
-rw-r--r--

Handle the case of disabled KWallet system

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;
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
93
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
94 KWallet::Wallet *wallet;
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
95
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
96 void reopenWallet();
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
97 void executeRequests();
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
98 };
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
99
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
100 class save_request : public request
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
101 {
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
102 public:
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
103 save_request(PurpleAccount *account, const char *password,
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
104 PurpleKeyringSaveCallback cb, void *data);
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
105 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
106 void execute(KWallet::Wallet *wallet);
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
107
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
108 private:
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
109 PurpleKeyringSaveCallback callback;
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
110 };
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
111
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
112 class read_request : public request
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 public:
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
115 read_request(PurpleAccount *account,
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
116 PurpleKeyringReadCallback cb, void *data);
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
117 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
118 void execute(KWallet::Wallet *wallet);
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
119
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
120 private:
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
121 PurpleKeyringReadCallback callback;
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
122 };
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
123
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
124 static GQuark
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
125 kwallet_plugin_error_domain(void)
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
126 {
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
127 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
128 }
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
129
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
34120
50bc553c8c52 Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34119
diff changeset
132 static gboolean
50bc553c8c52 Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34119
diff changeset
133 kwallet_is_enabled(void)
50bc553c8c52 Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34119
diff changeset
134 {
50bc553c8c52 Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34119
diff changeset
135 return KWallet::Wallet::isEnabled() ? TRUE : FALSE;
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
34080
098a43dd4835 Initialize pinstance.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34079
diff changeset
138 KWalletPlugin::engine *KWalletPlugin::engine::pinstance = NULL;
098a43dd4835 Initialize pinstance.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34079
diff changeset
139
34114
c915903f6e43 Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34110
diff changeset
140 KWalletPlugin::request::~request()
c915903f6e43 Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34110
diff changeset
141 {
c915903f6e43 Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34110
diff changeset
142 }
c915903f6e43 Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34110
diff changeset
143
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
144 void
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
145 KWalletPlugin::request::abort()
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
146 {
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
147 detailedAbort(PURPLE_KEYRING_ERROR_UNKNOWN);
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
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
150 KWalletPlugin::engine::engine()
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
151 {
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
152 connected = false;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
153 failed = false;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
154 closing = false;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
155 externallyClosed = false;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
156 wallet = NULL;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
157
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
158 reopenWallet();
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
159 }
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
160
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
161 void
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
162 KWalletPlugin::engine::reopenWallet()
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
163 {
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
164 if (closing) {
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
165 purple_debug_error("keyring-kwallet",
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
166 "wallet is closing right now\n");
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
167 failed = true;
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
168 return;
34110
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
169 }
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
170
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
171 connected = false;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
172 failed = false;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
173 externallyClosed = false;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
174
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
175 wallet = KWallet::Wallet::openWallet(KWALLET_WALLET_NAME, 0,
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
176 KWallet::Wallet::Asynchronous);
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
177 if (wallet == NULL) {
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
178 failed = true;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
179 purple_debug_error("keyring-kwallet",
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
180 "failed opening a wallet\n");
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
181 return;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
182 }
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
183
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
184 failed |= !connect(wallet, SIGNAL(walletClosed()),
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
185 SLOT(walletClosed()));
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
186 failed |= !connect(wallet, SIGNAL(walletOpened(bool)),
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
187 SLOT(walletOpened(bool)));
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
188 if (failed) {
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
189 purple_debug_error("keyring-kwallet",
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
190 "failed connecting to wallet signal\n");
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
191 }
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
192 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
193
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
194 KWalletPlugin::engine::~engine()
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
195 {
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
196 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
197
34079
fcf75ee4d190 Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34077
diff changeset
198 while (!isEmpty()) {
fcf75ee4d190 Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34077
diff changeset
199 request *req = dequeue();
34077
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
200 req->abort();
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
201 delete req;
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 delete wallet;
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
205
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
206 pinstance = NULL;
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
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
209 KWalletPlugin::engine *
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
210 KWalletPlugin::engine::instance()
34005
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 if (pinstance == NULL)
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
213 pinstance = new engine;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
214 return pinstance;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
215 }
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 void
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
218 KWalletPlugin::engine::closeInstance()
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
219 {
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
220 if (pinstance == NULL)
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
221 return;
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
222 if (pinstance->closing)
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
223 return;
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
224 delete pinstance;
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
225 }
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
226
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
227 void
34067
8643ef2b5bf4 This seems to fix compiling the signal stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34062
diff changeset
228 KWalletPlugin::engine::walletOpened(bool opened)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
229 {
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
230 connected = opened;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
231
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
232 if (!opened) {
34079
fcf75ee4d190 Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34077
diff changeset
233 while (!isEmpty()) {
fcf75ee4d190 Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34077
diff changeset
234 request *req = dequeue();
34077
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
235 req->abort();
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
236 delete req;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
237 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
238 delete this;
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
239 return;
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
240 }
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
241
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
242 if (!wallet->hasFolder(KWALLET_FOLDER_NAME)) {
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
243 if (!wallet->createFolder(KWALLET_FOLDER_NAME)) {
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
244 purple_debug_error("keyring-kwallet",
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
245 "couldn't create \"" KWALLET_FOLDER_NAME
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
246 "\" folder in wallet\n");
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
247 failed = true;
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
248 }
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
249 }
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
250 if (!failed)
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
251 wallet->setFolder(KWALLET_FOLDER_NAME);
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
252
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
253 executeRequests();
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
254 }
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
255
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
256 void
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
257 KWalletPlugin::engine::walletClosed()
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
258 {
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
259 if (!closing) {
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
260 purple_debug_info("keyring-kwallet",
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
261 "wallet was externally closed\n");
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
262 externallyClosed = true;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
263 delete wallet;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
264 wallet = NULL;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
265 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
266 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
267
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
268 void
34077
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
269 KWalletPlugin::engine::queue(request *req)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
270 {
34079
fcf75ee4d190 Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34077
diff changeset
271 enqueue(req);
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
272 executeRequests();
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
273 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
274
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
275 void
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
276 KWalletPlugin::engine::executeRequests()
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
277 {
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
278 if (externallyClosed) {
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
279 reopenWallet();
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
280 } 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
281 while (!isEmpty()) {
fcf75ee4d190 Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34077
diff changeset
282 request *req = dequeue();
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
283 if (connected)
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
284 req->execute(wallet);
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
285 else
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
286 req->abort();
34077
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
287 delete req;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
288 }
34110
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
289 } else {
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
290 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
291 }
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
292 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
293
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
294 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
295 PurpleKeyringSaveCallback cb, void *userdata)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
296 {
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
297 account = acc;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
298 data = userdata;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
299 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
300 password = QString(pw);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
301 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
302
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
303 KWalletPlugin::read_request::read_request(PurpleAccount *acc,
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
304 PurpleKeyringReadCallback cb, void *userdata)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
305 {
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
306 account = acc;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
307 data = userdata;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
308 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
309 password = QString();
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
310 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
311
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
312 void
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
313 KWalletPlugin::save_request::detailedAbort(enum PurpleKeyringError error)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
314 {
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
315 GError *gerror;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
316 if (callback == NULL)
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
317 return;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
318
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
319 gerror = g_error_new(ERR_KWALLETPLUGIN, error,
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
320 "Failed to save password");
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
321 callback(account, gerror, data);
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
322 g_error_free(gerror);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
323 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
324
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
325 void
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
326 KWalletPlugin::read_request::detailedAbort(enum PurpleKeyringError error)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
327 {
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
328 GError *gerror;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
329 if (callback == NULL)
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
330 return;
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
331
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
332 gerror = g_error_new(ERR_KWALLETPLUGIN, error,
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
333 "Failed to read password");
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
334 callback(account, NULL, gerror, data);
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
335 g_error_free(gerror);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
336 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
337
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
338 static QString
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
339 kwallet_account_key(PurpleAccount *account)
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
340 {
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
341 return QString(purple_account_get_protocol_id(account)) + ":" +
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
342 purple_account_get_username(account);
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
343 }
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
344
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
345 void
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
346 KWalletPlugin::read_request::execute(KWallet::Wallet *wallet)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
347 {
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
348 int result;
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
349
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
350 g_return_if_fail(wallet != NULL);
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
351
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
352 result = wallet->readPassword(kwallet_account_key(account), password);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
353
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
354 if (result != 0) {
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
355 purple_debug_warning("keyring-kwallet",
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
356 "failed to read password, result was %d\n", result);
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
357 abort();
34110
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
358 }
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
359 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
360 callback(account, password.toUtf8().constData(), NULL, data);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
361 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
362
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
363 void
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
364 KWalletPlugin::save_request::execute(KWallet::Wallet *wallet)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
365 {
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
366 int result;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
367
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
368 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
369
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
370 result = wallet->writePassword(kwallet_account_key(account), password);
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
371
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
372 if (result != 0) {
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
373 purple_debug_warning("keyring-kwallet",
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
374 "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
375 abort();
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
376 } else if (callback != NULL)
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
377 callback(account, NULL, data);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
378 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
379
34060
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
380 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
381 {
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
382
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
383 static void
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
384 kwallet_read(PurpleAccount *account, PurpleKeyringReadCallback cb,
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
385 gpointer data)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
386 {
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
387 KWalletPlugin::read_request *req =
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
388 new KWalletPlugin::read_request(account, cb, data);
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
389
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
390 if (KWallet::Wallet::keyDoesNotExist(KWALLET_WALLET_NAME,
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
391 KWALLET_FOLDER_NAME, kwallet_account_key(account))) {
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
392 req->detailedAbort(PURPLE_KEYRING_ERROR_NOPASSWD);
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
393 delete req;
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
394 }
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
395 else
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
396 KWalletPlugin::engine::instance()->queue(req);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
397 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
398
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
399 static void
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
400 kwallet_save(PurpleAccount *account, const char *password,
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
401 PurpleKeyringSaveCallback cb, gpointer data)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
402 {
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
403 KWalletPlugin::engine::instance()->queue(
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
404 new KWalletPlugin::save_request(account, password, cb, data));
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
405 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
406
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
407 static void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
408 kwallet_close(GError **error)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
409 {
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
410 KWalletPlugin::engine::closeInstance();
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
411 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
412
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
413 static gboolean
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
414 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
415 GError **error)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
416 {
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
417 return TRUE;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
418 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
419
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
420 static gboolean
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
421 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
422 GError **error, GDestroyNotify *destroy)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
423 {
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
424 *mode = NULL;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
425 *data = NULL;
34073
5da1137555a8 There seems to be an asterisk missing here.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34072
diff changeset
426 *destroy = NULL;
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
427
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
428 return TRUE;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
429 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
430
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
431 static gboolean
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
432 kwallet_load(PurplePlugin *plugin)
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
433 {
34119
8852b9a4dd2a Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34118
diff changeset
434 if (!qCoreApp) {
8852b9a4dd2a Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34118
diff changeset
435 int argc = 0;
8852b9a4dd2a Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34118
diff changeset
436 qCoreApp = new QCoreApplication(argc, NULL);
8852b9a4dd2a Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34118
diff changeset
437 qCoreApp->setApplicationName(KWALLET_APP_NAME);
8852b9a4dd2a Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34118
diff changeset
438 }
8852b9a4dd2a Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34118
diff changeset
439
34120
50bc553c8c52 Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34119
diff changeset
440 if (!kwallet_is_enabled()) {
50bc553c8c52 Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34119
diff changeset
441 purple_debug_info("keyring-kwallet",
50bc553c8c52 Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34119
diff changeset
442 "KWallet service is disabled\n");
50bc553c8c52 Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34119
diff changeset
443 return FALSE;
50bc553c8c52 Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34119
diff changeset
444 }
50bc553c8c52 Handle the case of disabled KWallet system
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34119
diff changeset
445
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
446 keyring_handler = purple_keyring_new();
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
447
34060
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
448 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
449 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
450 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
451 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
452 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
453 /* 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
454 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
455 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
456
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
457 purple_keyring_register(keyring_handler);
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
458
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
459 return TRUE;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
460 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
461
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
462 static gboolean
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
463 kwallet_unload(PurplePlugin *plugin)
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
464 {
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
465 if (purple_keyring_get_inuse() == keyring_handler) {
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
466 purple_debug_warning("keyring-kwallet",
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
467 "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
468 return FALSE;
34117
543818e9829a Better Kwallet integration
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34116
diff changeset
469 }
34096
3d28c3311ad0 Don't allow unloading a plugin if its keyring is active.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34095
diff changeset
470
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
471 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
472
34097
f6f36bfbe951 Free the keyring when the KWallet plugin is unloaded.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34096
diff changeset
473 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
474 keyring_handler = NULL;
f6f36bfbe951 Free the keyring when the KWallet plugin is unloaded.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34096
diff changeset
475
34119
8852b9a4dd2a Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34118
diff changeset
476 if (qCoreApp) {
8852b9a4dd2a Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34118
diff changeset
477 delete qCoreApp;
8852b9a4dd2a Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34118
diff changeset
478 qCoreApp = NULL;
8852b9a4dd2a Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34118
diff changeset
479 }
8852b9a4dd2a Better usage of QCoreApplication
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34118
diff changeset
480
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
481 return TRUE;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
482 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
483
34060
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
484 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
485 {
34118
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
486 PURPLE_PLUGIN_MAGIC, /* magic */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
487 PURPLE_MAJOR_VERSION, /* major_version */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
488 PURPLE_MINOR_VERSION, /* minor_version */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
489 PURPLE_PLUGIN_STANDARD, /* type */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
490 NULL, /* ui_requirement */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
491 PURPLE_PLUGIN_FLAG_INVISIBLE, /* flags */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
492 NULL, /* dependencies */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
493 PURPLE_PRIORITY_DEFAULT, /* priority */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
494 (char*)KWALLET_ID, /* id */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
495 (char*)KWALLET_NAME, /* name */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
496 (char*)DISPLAY_VERSION, /* version */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
497 (char*)"KWallet Keyring Plugin", /* summary */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
498 (char*)KWALLET_DESCRIPTION, /* description */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
499 (char*)KWALLET_AUTHOR, /* author */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
500 (char*)PURPLE_WEBSITE, /* homepage */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
501 kwallet_load, /* load */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
502 kwallet_unload, /* unload */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
503 NULL, /* destroy */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
504 NULL, /* ui_info */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
505 NULL, /* extra_info */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
506 NULL, /* prefs_info */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
507 NULL, /* actions */
a83c82be880d Kwallet: cosmetic changes, mostly formatting
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34117
diff changeset
508 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
509 };
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
510
34116
825c98f8c7f6 Get rid of PURPLE_PLUGIN_FLAG_AUTOLOAD
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34114
diff changeset
511 static void
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
512 init_plugin(PurplePlugin *plugin)
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
513 {
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
514 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
515
34060
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
516 PURPLE_INIT_PLUGIN(kwallet_keyring, init_plugin, plugininfo)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
517
34060
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
518 } /* extern "C" */
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
519
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
520 #include "kwallet.moc"

mercurial