2008-07-11 23:22:52 +02:00
|
|
|
Index: pidgin-2.4.2/configure.ac
|
|
|
|
===================================================================
|
|
|
|
--- pidgin-2.4.2.orig/configure.ac
|
|
|
|
+++ pidgin-2.4.2/configure.ac
|
|
|
|
@@ -1678,6 +1678,20 @@ if test "x$enable_nss" != "xno"; then
|
2007-08-03 02:10:42 +02:00
|
|
|
[AC_HELP_STRING([--with-nss-libs=PREFIX], [specify location of Mozilla nss3 libs.])],
|
|
|
|
[with_nss_libs="$withval"])
|
2007-05-21 04:39:49 +02:00
|
|
|
|
|
|
|
+dnl #######################################################################
|
|
|
|
+dnl # Check for gnome-keyring
|
|
|
|
+dnl #--enable-gnome-keyring=(yes|no)
|
|
|
|
+dnl #######################################################################
|
|
|
|
+AC_ARG_ENABLE(gnome-keyring,
|
|
|
|
+ AC_HELP_STRING([--enable-gnome-keyring],
|
|
|
|
+ [use gnome keyring for storing password [default=no]]),,
|
|
|
|
+ enable_gnome_keyring=no)
|
|
|
|
+if test "x$enable_gnome_keyring" = "xyes"; then
|
|
|
|
+ PKG_CHECK_MODULES(PURPLE_KEYRING,
|
|
|
|
+ gnome-keyring-1,
|
|
|
|
+ AC_DEFINE(VINO_ENABLE_KEYRING, [], [Set if we should use gnome-keyring]))
|
|
|
|
+fi
|
|
|
|
+
|
|
|
|
|
2007-08-03 02:10:42 +02:00
|
|
|
if test -n "$with_nspr_includes" || test -n "$with_nspr_libs" || \
|
|
|
|
test -n "$with_nss_includes" || test -n "$with_nss_libs" ||
|
2008-07-11 23:22:52 +02:00
|
|
|
Index: pidgin-2.4.2/libpurple/Makefile.am
|
|
|
|
===================================================================
|
|
|
|
--- pidgin-2.4.2.orig/libpurple/Makefile.am
|
|
|
|
+++ pidgin-2.4.2/libpurple/Makefile.am
|
|
|
|
@@ -245,6 +245,7 @@ libpurple_la_LIBADD = \
|
2007-08-03 02:10:42 +02:00
|
|
|
$(GLIB_LIBS) \
|
2007-05-21 04:39:49 +02:00
|
|
|
$(LIBXML_LIBS) \
|
2008-07-11 23:22:52 +02:00
|
|
|
$(NETWORKMANAGER_LIBS) \
|
2007-05-21 04:39:49 +02:00
|
|
|
+ $(PURPLE_KEYRING_LIBS) \
|
|
|
|
$(INTLLIBS) \
|
|
|
|
-lm
|
|
|
|
|
2008-07-11 23:22:52 +02:00
|
|
|
@@ -257,5 +258,6 @@ AM_CPPFLAGS = \
|
2007-05-21 04:39:49 +02:00
|
|
|
$(GLIB_CFLAGS) \
|
|
|
|
$(DEBUG_CFLAGS) \
|
|
|
|
$(DBUS_CFLAGS) \
|
|
|
|
+ $(PURPLE_KEYRING_CFLAGS) \
|
|
|
|
$(LIBXML_CFLAGS) \
|
2008-07-11 23:22:52 +02:00
|
|
|
$(NETWORKMANAGER_CFLAGS)
|
|
|
|
Index: pidgin-2.4.2/libpurple/account.c
|
|
|
|
===================================================================
|
|
|
|
--- pidgin-2.4.2.orig/libpurple/account.c
|
|
|
|
+++ pidgin-2.4.2/libpurple/account.c
|
|
|
|
@@ -49,6 +49,13 @@ typedef struct
|
|
|
|
#define PURPLE_ACCOUNT_GET_PRIVATE(account) \
|
|
|
|
((PurpleAccountPrivate *) (account->priv))
|
2007-05-21 04:39:49 +02:00
|
|
|
|
|
|
|
+#ifdef PURPLE_ENABLE_KEYRING
|
|
|
|
+#include <gnome-keyring.h>
|
|
|
|
+
|
|
|
|
+static char * purple_account_get_password_from_keyring (const char *_prpl, const char *_user);
|
|
|
|
+static gboolean purple_account_set_password_in_keyring (const char *_prpl, const char *_user, const char *password);
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
/* TODO: Should use PurpleValue instead of this? What about "ui"? */
|
|
|
|
typedef struct
|
|
|
|
{
|
2008-07-11 23:22:52 +02:00
|
|
|
@@ -374,8 +381,13 @@ account_to_xmlnode(PurpleAccount *accoun
|
2007-05-21 04:39:49 +02:00
|
|
|
if (purple_account_get_remember_password(account) &&
|
|
|
|
((tmp = purple_account_get_password(account)) != NULL))
|
|
|
|
{
|
|
|
|
+#ifdef PURPLE_ENABLE_KEYRING
|
|
|
|
+ purple_account_set_password_in_keyring( purple_account_get_protocol_id(account),
|
|
|
|
+ purple_account_get_username(account), tmp);
|
|
|
|
+#else
|
|
|
|
child = xmlnode_new_child(node, "password");
|
|
|
|
xmlnode_insert_data(child, tmp, -1);
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((tmp = purple_account_get_alias(account)) != NULL)
|
2008-07-11 23:22:52 +02:00
|
|
|
@@ -790,17 +802,30 @@ parse_account(xmlnode *node)
|
2007-05-21 04:39:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ret = purple_account_new(name, _purple_oscar_convert(name, protocol_id)); /* XXX: */
|
|
|
|
- g_free(name);
|
|
|
|
- g_free(protocol_id);
|
|
|
|
-
|
|
|
|
- /* Read the password */
|
|
|
|
- child = xmlnode_get_child(node, "password");
|
|
|
|
- if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
|
|
|
|
+ gboolean got_pwd = FALSE;
|
|
|
|
+#ifdef PURPLE_ENABLE_KEYRING
|
|
|
|
+ data = purple_account_get_password_from_keyring(protocol_id, name);
|
|
|
|
+ if (data)
|
|
|
|
{
|
|
|
|
+ got_pwd = TRUE;
|
|
|
|
purple_account_set_remember_password(ret, TRUE);
|
|
|
|
purple_account_set_password(ret, data);
|
|
|
|
g_free(data);
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
+ if (!got_pwd)
|
|
|
|
+ {
|
|
|
|
+ /* Read the password */
|
|
|
|
+ child = xmlnode_get_child(node, "password");
|
|
|
|
+ if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
|
|
|
|
+ {
|
|
|
|
+ purple_account_set_remember_password(ret, TRUE);
|
|
|
|
+ purple_account_set_password(ret, data);
|
|
|
|
+ g_free(data);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ g_free(name);
|
|
|
|
+ g_free(protocol_id);
|
|
|
|
|
|
|
|
/* Read the alias */
|
|
|
|
child = xmlnode_get_child(node, "alias");
|
2008-07-11 23:22:52 +02:00
|
|
|
@@ -2778,3 +2803,60 @@ purple_accounts_uninit(void)
|
|
|
|
purple_signals_disconnect_by_handle(handle);
|
|
|
|
purple_signals_unregister_by_instance(handle);
|
2007-05-21 04:39:49 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+#ifdef PURPLE_ENABLE_KEYRING
|
|
|
|
+static char *
|
|
|
|
+purple_account_get_password_from_keyring(const char *_prpl, const char *_user)
|
|
|
|
+{
|
|
|
|
+ GnomeKeyringNetworkPasswordData *found_item;
|
|
|
|
+ GnomeKeyringResult result;
|
|
|
|
+ GList *matches;
|
|
|
|
+ char *password;
|
|
|
|
+
|
|
|
|
+ matches = NULL;
|
|
|
|
+
|
|
|
|
+ result = gnome_keyring_find_network_password_sync (
|
|
|
|
+ _user, /* user */
|
|
|
|
+ NULL, /* domain */
|
|
|
|
+ "gaim.local", /* server */
|
|
|
|
+ NULL, /* object */
|
|
|
|
+ _prpl, /* protocol */
|
|
|
|
+ NULL, /* authtype */
|
|
|
|
+ 1863, /* port */
|
|
|
|
+ &matches);
|
|
|
|
+
|
|
|
|
+ if (result != GNOME_KEYRING_RESULT_OK)
|
|
|
|
+ return NULL;
|
|
|
|
+
|
|
|
|
+ g_assert (matches != NULL && matches->data != NULL);
|
|
|
|
+
|
|
|
|
+ found_item = (GnomeKeyringNetworkPasswordData *) matches->data;
|
|
|
|
+
|
|
|
|
+ password = g_strdup (found_item->password);
|
|
|
|
+
|
|
|
|
+ gnome_keyring_network_password_list_free (matches);
|
|
|
|
+
|
|
|
|
+ return password;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static gboolean
|
|
|
|
+purple_account_set_password_in_keyring (const char *_prpl, const char *_user, const char *_password)
|
|
|
|
+{
|
|
|
|
+ GnomeKeyringResult result;
|
|
|
|
+ guint32 item_id;
|
|
|
|
+
|
|
|
|
+ result = gnome_keyring_set_network_password_sync (
|
|
|
|
+ NULL, /* default keyring */
|
|
|
|
+ _user, /* user */
|
|
|
|
+ NULL, /* domain */
|
|
|
|
+ "gaim.local", /* server */
|
|
|
|
+ NULL, /* object */
|
|
|
|
+ _prpl, /* protocol */
|
|
|
|
+ NULL, /* authtype */
|
|
|
|
+ 1863, /* port */
|
|
|
|
+ _password, /* password */
|
|
|
|
+ &item_id);
|
|
|
|
+
|
|
|
|
+ return result == GNOME_KEYRING_RESULT_OK;
|
|
|
|
+}
|
|
|
|
+#endif
|