libpurple/plugins/keyrings/kwallet.cpp

Mon, 18 Mar 2013 19:38:19 +0100

author
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
date
Mon, 18 Mar 2013 19:38:19 +0100
branch
soc.2008.masterpassword
changeset 34114
c915903f6e43
parent 34110
bda1c52322fe
child 34116
825c98f8c7f6
permissions
-rw-r--r--

Get rid of warnings

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
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
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
34097
f6f36bfbe951 Free the keyring when the KWallet plugin is unloaded.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34096
diff changeset
46 PurpleKeyring *keyring_handler = NULL;
34014
647e174899a9 Took stuff from kwallet.cpp out of the extern "C" {}
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 34005
diff changeset
47
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
48 #define ERR_KWALLETPLUGIN kwallet_plugin_error_domain()
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
49
34060
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
50 namespace KWalletPlugin {
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
51
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
52 class request
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
53 {
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
54 public:
34114
c915903f6e43 Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34110
diff changeset
55 virtual ~request();
34077
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
56 virtual void abort() = 0;
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
57 virtual void execute(KWallet::Wallet *wallet) = 0;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
58
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
59 protected:
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
60 gpointer data;
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
61 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
62 QString password;
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
63 };
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
64
34079
fcf75ee4d190 Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34077
diff changeset
65 class engine : private QObject, private QQueue<request*>
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
66 {
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
67 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
68
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
69 public:
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
70 engine();
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
71 ~engine();
34077
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
72 void queue(request *req);
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
73 static engine *Instance();
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
74 bool closing;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
75
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
76 private slots:
34067
8643ef2b5bf4 This seems to fix compiling the signal stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34062
diff changeset
77 void walletOpened(bool opened);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
78
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
79 private:
34085
26a50ff943ed Add a QCoreApplication to process events, which is a bit lighter
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34084
diff changeset
80 QCoreApplication *app;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
81 bool connected;
34110
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
82 bool failed;
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
83 KWallet::Wallet *wallet;
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
84 static engine *pinstance;
34089
3ac90007a6bf Evidently, processing results just in ExecuteRequests is not enough,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34087
diff changeset
85 gint idle_handle;
3ac90007a6bf Evidently, processing results just in ExecuteRequests is not enough,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34087
diff changeset
86 static bool idle_cb(engine *me);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
87
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
88 void ExecuteRequests();
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
89 };
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
90
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
91 class save_request : public request
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
92 {
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
93 public:
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
94 save_request(PurpleAccount *account, const char *password, PurpleKeyringSaveCallback cb, void *data);
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
95 void abort();
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
96 void execute(KWallet::Wallet *wallet);
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
97
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
98 private:
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
99 PurpleKeyringSaveCallback callback;
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
100 };
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 class read_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:
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
105 read_request(PurpleAccount *account, PurpleKeyringReadCallback cb, void *data);
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
106 void abort();
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
107 void execute(KWallet::Wallet *wallet);
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
108
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
109 private:
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
110 PurpleKeyringReadCallback callback;
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
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
113 static GQuark
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
114 kwallet_plugin_error_domain(void)
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 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
117 }
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
118
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
34080
098a43dd4835 Initialize pinstance.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34079
diff changeset
121 KWalletPlugin::engine *KWalletPlugin::engine::pinstance = NULL;
098a43dd4835 Initialize pinstance.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34079
diff changeset
122
34114
c915903f6e43 Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34110
diff changeset
123 KWalletPlugin::request::~request()
c915903f6e43 Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34110
diff changeset
124 {
c915903f6e43 Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34110
diff changeset
125 }
c915903f6e43 Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34110
diff changeset
126
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
127 KWalletPlugin::engine::engine()
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
128 {
34085
26a50ff943ed Add a QCoreApplication to process events, which is a bit lighter
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34084
diff changeset
129 int argc = 0;
26a50ff943ed Add a QCoreApplication to process events, which is a bit lighter
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34084
diff changeset
130 app = new QCoreApplication(argc, NULL);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
131
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
132 connected = FALSE;
34110
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
133 failed = FALSE;
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
134 wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(), 0, KWallet::Wallet::Asynchronous);
34110
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
135 if (wallet == NULL || !connect(wallet, SIGNAL(walletOpened(bool)), SLOT(walletOpened(bool)))) {
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
136 failed = TRUE;
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
137 purple_debug_error("keyring-kwallet", "failed connecting to wallet %p\n", wallet);
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
138 }
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
139 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
140
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
141 KWalletPlugin::engine::~engine()
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
142 {
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
143 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
144
34089
3ac90007a6bf Evidently, processing results just in ExecuteRequests is not enough,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34087
diff changeset
145 if (idle_handle)
3ac90007a6bf Evidently, processing results just in ExecuteRequests is not enough,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34087
diff changeset
146 g_source_remove(idle_handle);
3ac90007a6bf Evidently, processing results just in ExecuteRequests is not enough,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34087
diff changeset
147
34079
fcf75ee4d190 Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34077
diff changeset
148 while (!isEmpty()) {
fcf75ee4d190 Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34077
diff changeset
149 request *req = dequeue();
34077
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
150 req->abort();
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
151 delete req;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
152 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
153
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
154 KWallet::Wallet::closeWallet(KWallet::Wallet::NetworkWallet(), TRUE);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
155 delete wallet;
34085
26a50ff943ed Add a QCoreApplication to process events, which is a bit lighter
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34084
diff changeset
156 delete app;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
157 pinstance = NULL;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
158 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
159
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
160 KWalletPlugin::engine *
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
161 KWalletPlugin::engine::Instance()
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
162 {
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
163 if (pinstance == NULL)
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
164 pinstance = new engine;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
165 return pinstance;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
166 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
167
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
168 void
34067
8643ef2b5bf4 This seems to fix compiling the signal stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34062
diff changeset
169 KWalletPlugin::engine::walletOpened(bool opened)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
170 {
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
171 connected = opened;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
172
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
173 if (opened) {
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
174 ExecuteRequests();
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
175 } else {
34079
fcf75ee4d190 Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34077
diff changeset
176 while (!isEmpty()) {
fcf75ee4d190 Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34077
diff changeset
177 request *req = dequeue();
34077
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
178 req->abort();
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
179 delete req;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
180 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
181 delete this;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
182 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
183 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
184
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
185 void
34077
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
186 KWalletPlugin::engine::queue(request *req)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
187 {
34079
fcf75ee4d190 Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34077
diff changeset
188 enqueue(req);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
189 ExecuteRequests();
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
190 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
191
34089
3ac90007a6bf Evidently, processing results just in ExecuteRequests is not enough,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34087
diff changeset
192 bool
3ac90007a6bf Evidently, processing results just in ExecuteRequests is not enough,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34087
diff changeset
193 KWalletPlugin::engine::idle_cb(KWalletPlugin::engine *me)
3ac90007a6bf Evidently, processing results just in ExecuteRequests is not enough,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34087
diff changeset
194 {
3ac90007a6bf Evidently, processing results just in ExecuteRequests is not enough,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34087
diff changeset
195 me->app->processEvents();
3ac90007a6bf Evidently, processing results just in ExecuteRequests is not enough,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34087
diff changeset
196 return true;
3ac90007a6bf Evidently, processing results just in ExecuteRequests is not enough,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34087
diff changeset
197 }
3ac90007a6bf Evidently, processing results just in ExecuteRequests is not enough,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34087
diff changeset
198
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
199 void
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
200 KWalletPlugin::engine::ExecuteRequests()
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
201 {
34089
3ac90007a6bf Evidently, processing results just in ExecuteRequests is not enough,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34087
diff changeset
202 if (idle_handle == 0)
3ac90007a6bf Evidently, processing results just in ExecuteRequests is not enough,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34087
diff changeset
203 idle_handle = g_idle_add((GSourceFunc)idle_cb, this);
3ac90007a6bf Evidently, processing results just in ExecuteRequests is not enough,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34087
diff changeset
204
34110
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
205 if (connected || failed) {
34079
fcf75ee4d190 Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34077
diff changeset
206 while (!isEmpty()) {
fcf75ee4d190 Use a QQueue instead of a STL list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34077
diff changeset
207 request *req = dequeue();
34110
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
208 req->execute(connected ? wallet : NULL);
34077
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
209 delete req;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
210 }
34110
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
211 } else {
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
212 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
213 }
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
214 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
215
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
216 KWalletPlugin::save_request::save_request(PurpleAccount *acc, const char *pw, PurpleKeyringSaveCallback cb, void *userdata)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
217 {
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
218 account = acc;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
219 data = userdata;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
220 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
221 password = QString(pw);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
222 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
223
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
224 KWalletPlugin::read_request::read_request(PurpleAccount *acc, PurpleKeyringReadCallback cb, void *userdata)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
225 {
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
226 account = acc;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
227 data = userdata;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
228 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
229 password = QString();
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
230 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
231
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
232 void
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
233 KWalletPlugin::save_request::abort()
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
234 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
235 GError *error;
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
236 if (callback != NULL) {
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
237 error = g_error_new(ERR_KWALLETPLUGIN,
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
238 PURPLE_KEYRING_ERROR_UNKNOWN,
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
239 "Failed to save password");
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
240 callback(account, error, data);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
241 g_error_free(error);
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
242 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
243 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
244
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
245 void
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
246 KWalletPlugin::read_request::abort()
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
247 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
248 GError *error;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
249 if (callback != NULL) {
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
250 error = g_error_new(ERR_KWALLETPLUGIN,
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
251 PURPLE_KEYRING_ERROR_UNKNOWN,
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
252 "Failed to read password");
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
253 callback(account, NULL, error, data);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
254 g_error_free(error);
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
255 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
256 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
257
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
258 void
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
259 KWalletPlugin::read_request::execute(KWallet::Wallet *wallet)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
260 {
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
261 int result;
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
262 QString key;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
263
34110
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
264 if (wallet == NULL) {
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
265 GError *error;
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
266 error = g_error_new(ERR_KWALLETPLUGIN,
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
267 PURPLE_KEYRING_ERROR_UNKNOWN,
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
268 "No wallet opened");
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
269 callback(account, NULL, error, data);
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
270 g_error_free(error);
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
271 return;
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
272 }
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
273
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
274 key = QString("purple-") + purple_account_get_username(account) + " " + purple_account_get_protocol_id(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
275 result = wallet->readPassword(key, password);
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
276
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
277 if (result != 0)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
278 abort();
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
279 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
280 callback(account, password.toUtf8().constData(), NULL, data);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
281 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
282
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
283 void
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
284 KWalletPlugin::save_request::execute(KWallet::Wallet *wallet)
34005
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 int result;
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
287 QString key;
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 if (wallet == NULL) {
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
290 GError *error;
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
291 error = g_error_new(ERR_KWALLETPLUGIN,
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
292 PURPLE_KEYRING_ERROR_UNKNOWN,
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
293 "No wallet opened");
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
294 callback(account, error, data);
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
295 g_error_free(error);
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
296 return;
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
297 }
bda1c52322fe Keyring: more verbosity, handle kwallet connection errors
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34098
diff changeset
298
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
299 key = QString("purple-") + purple_account_get_username(account) + " " + purple_account_get_protocol_id(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
300 result = wallet->writePassword(key, password);
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
301
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
302 if (result != 0)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
303 abort();
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
304 else if (callback != NULL)
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
305 callback(account, NULL, data);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
306 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
307
34060
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
308 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
309 {
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
310
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
311 static void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
312 kwallet_read(PurpleAccount *account,
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
313 PurpleKeyringReadCallback cb,
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
314 gpointer data)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
315 {
34077
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
316 KWalletPlugin::read_request *req;
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
317 req = new KWalletPlugin::read_request(account, cb, data);
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
318 KWalletPlugin::engine::Instance()->queue(req);
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
319 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
320
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
321 static void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
322 kwallet_save(PurpleAccount *account,
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
323 const char *password,
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
324 PurpleKeyringSaveCallback cb,
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
325 gpointer data)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
326 {
34077
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
327 KWalletPlugin::save_request *req;
3e4d7e7d3064 Make KWalletPlugin::request class abstract. Unfortunately, this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34076
diff changeset
328 req = new KWalletPlugin::save_request(account, password, cb, data);
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
329 KWalletPlugin::engine::Instance()->queue(req);
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
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
332 static void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
333 kwallet_close(GError **error)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
334 {
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
335 if (!KWalletPlugin::engine::Instance()->closing)
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
336 delete KWalletPlugin::engine::Instance();
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
337 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
338
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
339 static gboolean
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
340 kwallet_import(PurpleAccount *account,
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
341 const char *mode,
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
342 const char *data,
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
343 GError **error)
34005
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 return TRUE;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
346 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
347
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
348 static gboolean
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
349 kwallet_export(PurpleAccount *account,
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
350 const char **mode,
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
351 char **data,
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
352 GError **error,
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
353 GDestroyNotify *destroy)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
354 {
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
355 *mode = NULL;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
356 *data = NULL;
34073
5da1137555a8 There seems to be an asterisk missing here.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34072
diff changeset
357 *destroy = NULL;
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
358
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
359 return TRUE;
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
360 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
361
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
362 static gboolean
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
363 kwallet_load(PurplePlugin *plugin)
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
364 {
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
365 keyring_handler = purple_keyring_new();
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
366
34060
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
367 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
368 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
369 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
370 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
371 purple_keyring_set_close_keyring(keyring_handler, kwallet_close);
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
372 /* purple_keyring_set_change_master(keyring_handler, kwallet_change_master);*/
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
373 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
374 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
375
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
376 purple_keyring_register(keyring_handler);
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
377
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
378 return TRUE;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
379 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
380
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
381 static gboolean
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
382 kwallet_unload(PurplePlugin *plugin)
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
383 {
34096
3d28c3311ad0 Don't allow unloading a plugin if its keyring is active.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34095
diff changeset
384 if (purple_keyring_get_inuse() == keyring_handler)
3d28c3311ad0 Don't allow unloading a plugin if its keyring is active.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34095
diff changeset
385 return FALSE;
3d28c3311ad0 Don't allow unloading a plugin if its keyring is active.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34095
diff changeset
386
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
387 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
388
34097
f6f36bfbe951 Free the keyring when the KWallet plugin is unloaded.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34096
diff changeset
389 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
390 keyring_handler = NULL;
f6f36bfbe951 Free the keyring when the KWallet plugin is unloaded.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34096
diff changeset
391
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
392 return TRUE;
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
393 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
394
34060
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
395 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
396 {
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
397 PURPLE_PLUGIN_MAGIC, /* magic */
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
398 PURPLE_MAJOR_VERSION, /* major_version */
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
399 PURPLE_MINOR_VERSION, /* minor_version */
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
400 PURPLE_PLUGIN_STANDARD, /* type */
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
401 NULL, /* ui_requirement */
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
402 PURPLE_PLUGIN_FLAG_INVISIBLE|PURPLE_PLUGIN_FLAG_AUTOLOAD, /* flags */
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
403 NULL, /* dependencies */
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
404 PURPLE_PRIORITY_DEFAULT, /* priority */
34114
c915903f6e43 Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34110
diff changeset
405 (char*)KWALLET_ID, /* id */
c915903f6e43 Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34110
diff changeset
406 (char*)KWALLET_NAME, /* name */
c915903f6e43 Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34110
diff changeset
407 (char*)DISPLAY_VERSION, /* version */
c915903f6e43 Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34110
diff changeset
408 (char*)"KWallet Keyring Plugin", /* summary */
c915903f6e43 Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34110
diff changeset
409 (char*)KWALLET_DESCRIPTION, /* description */
c915903f6e43 Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34110
diff changeset
410 (char*)KWALLET_AUTHOR, /* author */
c915903f6e43 Get rid of warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34110
diff changeset
411 (char*)PURPLE_WEBSITE, /* homepage */
34060
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
412 kwallet_load, /* load */
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
413 kwallet_unload, /* unload */
34081
b7fd12507799 These destroy functions appear to do the same thing as the unload
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34080
diff changeset
414 NULL, /* destroy */
34060
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
415 NULL, /* ui_info */
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
416 NULL, /* extra_info */
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
417 NULL, /* prefs_info */
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
418 NULL, /* actions */
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
419 NULL, /* padding... */
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
420 NULL,
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
421 NULL,
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
422 NULL,
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
423 };
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
424
34062
7879224489fd Hey, I think this almost compiles now!
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34061
diff changeset
425 void init_plugin(PurplePlugin *plugin);
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
426 void
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
427 init_plugin(PurplePlugin *plugin)
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
428 {
34060
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
429 purple_debug_info("keyring-kwallet", "init plugin called.\n");
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
430 }
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
431
34060
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
432 PURPLE_INIT_PLUGIN(kwallet_keyring, init_plugin, plugininfo)
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
433
34060
1ff15466f569 This should hopefully namespace things correctly. I'll admit that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34035
diff changeset
434 } /* extern "C" */
34005
592e6e8213a9 Cleanup in gnomekeyring.c
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
435
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
436 #include "kwallet.moc"
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
437

mercurial