4 LDFLAGS="$orig_LDFLAGS"
7 +dnl #######################################################################
8 +dnl # Check for gnome-keyring
9 +dnl #--enable-gnome-keyring=(yes|no)
10 +dnl #######################################################################
11 +AC_ARG_ENABLE(gnome-keyring,
12 + AC_HELP_STRING([--enable-gnome-keyring],
13 + [use gnome keyring for storing password [default=no]]),,
14 + enable_gnome_keyring=no)
15 +if test "x$enable_gnome_keyring" = "xyes"; then
16 + PKG_CHECK_MODULES(GAIM_KEYRING,
18 + AC_DEFINE(GAIM_ENABLE_KEYRING, [], [Set if we should use gnome-keyring]))
21 AC_MSG_CHECKING(for me pot o' gold)
23 AC_CHECK_FUNCS(gethostid lrand48)
24 --- libpurple/Makefile.am
25 +++ libpurple/Makefile.am
30 + $(GAIM_KEYRING_LIBS) \
31 $(NETWORKMANAGER_LIBS) \
38 + $(GAIM_KEYRING_CFLAGS) \
40 $(NETWORKMANAGER_CFLAGS)
42 --- libpurple/account.c
43 +++ libpurple/account.c
45 #define PURPLE_ACCOUNT_GET_PRIVATE(account) \
46 ((PurpleAccountPrivate *) (account->priv))
48 +#ifdef GAIM_ENABLE_KEYRING
49 +#include <gnome-keyring.h>
51 +static char * gaim_account_get_password_from_keyring (const char *_prpl, const char *_user);
52 +static gboolean gaim_account_set_password_in_keyring (const char *_prpl, const char *_user, const char *password);
55 /* TODO: Should use PurpleValue instead of this? What about "ui"? */
59 if (purple_account_get_remember_password(account) &&
60 ((tmp = purple_account_get_password(account)) != NULL))
62 +#ifdef GAIM_ENABLE_KEYRING
63 + gaim_account_set_password_in_keyring( purple_account_get_protocol_id(account),
64 + purple_account_get_username(account), tmp);
66 child = xmlnode_new_child(node, "password");
67 xmlnode_insert_data(child, tmp, -1);
71 if ((tmp = purple_account_get_alias(account)) != NULL)
75 ret = purple_account_new(name, _purple_oscar_convert(name, protocol_id)); /* XXX: */
77 - g_free(protocol_id);
79 - /* Read the password */
80 - child = xmlnode_get_child(node, "password");
81 - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
83 - purple_account_set_remember_password(ret, TRUE);
84 - purple_account_set_password(ret, data);
87 + gboolean got_pwd = FALSE;
88 +#ifdef GAIM_ENABLE_KEYRING
89 + data = gaim_account_get_password_from_keyring(protocol_id, name);
93 + purple_account_set_remember_password(ret, TRUE);
94 + purple_account_set_password(ret, data);
100 + /* Read the password */
101 + child = xmlnode_get_child(node, "password");
102 + if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
104 + purple_account_set_remember_password(ret, TRUE);
105 + purple_account_set_password(ret, data);
110 + g_free(protocol_id);
113 child = xmlnode_get_child(node, "alias");
114 @@ -2797,3 +2822,65 @@
115 purple_signals_disconnect_by_handle(handle);
116 purple_signals_unregister_by_instance(handle);
119 +#ifdef GAIM_ENABLE_KEYRING
121 +gaim_account_get_password_from_keyring(const char *_prpl, const char *_user)
123 + GnomeKeyringNetworkPasswordData *found_item;
124 + GnomeKeyringResult result;
130 + result = gnome_keyring_find_network_password_sync (
133 + "gaim.local", /* server */
135 + _prpl, /* protocol */
136 + NULL, /* authtype */
140 + if (result != GNOME_KEYRING_RESULT_OK)
143 + if (matches == NULL || matches->data == NULL)
146 + found_item = (GnomeKeyringNetworkPasswordData *) matches->data;
148 + password = g_strdup (found_item->password);
150 + gnome_keyring_network_password_list_free (matches);
155 +void my_GnomeKeyringOperationGetIntCallback(GnomeKeyringResult result, guint32 val, gpointer data)
161 +gaim_account_set_password_in_keyring (const char *_prpl, const char *_user, const char *_password)
163 + GnomeKeyringResult result;
166 + gpointer req = gnome_keyring_set_network_password (
167 + NULL, /* default keyring */
170 + "gaim.local", /* server */
172 + _prpl, /* protocol */
173 + NULL, /* authtype */
175 + _password, /* password */
176 + my_GnomeKeyringOperationGetIntCallback, NULL, NULL);
180 --- pidgin/Makefile.am
181 +++ pidgin/Makefile.am
184 $(STARTUP_NOTIFICATION_LIBS) \
186 + $(GAIM_KEYRING_LIBS) \
188 $(top_builddir)/libpurple/libpurple.la
191 $(GSTREAMER_CFLAGS) \
194 + $(GAIM_KEYRING_CFLAGS) \
197 $(STARTUP_NOTIFICATION_CFLAGS) \
201 #include "pidginstock.h"
202 #include "gtkwhiteboard.h"
204 +#ifdef GAIM_ENABLE_KEYRING
205 +#include <gnome-keyring.h>
212 gtk_rc_add_default_file(search_path);
215 +#ifdef GAIM_ENABLE_KEYRING
216 + GnomeKeyringResult rtn = gnome_keyring_unlock_sync(NULL, NULL);
217 + // if (rtn == GNOME_KEYRING_RESULT_DENIED)
221 gui_check = gtk_init_check(&argc, &argv);
223 char *display = gdk_get_display();