Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 307169
Collapse All | Expand All

(-)pidgin-2.6.3/configure.ac (+14 lines)
Lines 1799-1804 if test "x$enable_nss" != "xno"; then Link Here
1799
		[AC_HELP_STRING([--with-nss-libs=PREFIX], [specify location of Mozilla nss3 libs.])],
1799
		[AC_HELP_STRING([--with-nss-libs=PREFIX], [specify location of Mozilla nss3 libs.])],
1800
		[with_nss_libs="$withval"])
1800
		[with_nss_libs="$withval"])
1801
1801
1802
dnl #######################################################################
1803
dnl # Check for gnome-keyring
1804
dnl #--enable-gnome-keyring=(yes|no)
1805
dnl #######################################################################
1806
AC_ARG_ENABLE(gnome-keyring,
1807
              AC_HELP_STRING([--enable-gnome-keyring],
1808
                             [use gnome keyring for storing password [default=no]]),,
1809
              enable_gnome_keyring=no)
1810
if test "x$enable_gnome_keyring" = "xyes"; then
1811
    PKG_CHECK_MODULES(PURPLE_KEYRING,
1812
                      gnome-keyring-1,
1813
                      AC_DEFINE(PURPLE_ENABLE_KEYRING, [], [Set if we should use gnome-keyring]))
1814
fi
1815
1802
1816
1803
	if test -n "$with_nspr_includes" || test -n "$with_nspr_libs" || \
1817
	if test -n "$with_nspr_includes" || test -n "$with_nspr_libs" || \
1804
	   test -n "$with_nss_includes"  || test -n "$with_nss_libs"  ||
1818
	   test -n "$with_nss_includes"  || test -n "$with_nss_libs"  ||
(-)pidgin-2.6.3/libpurple/Makefile.am (+2 lines)
Lines 291-296 libpurple_la_LIBADD = \ Link Here
291
	$(GLIB_LIBS) \
291
	$(GLIB_LIBS) \
292
	$(LIBXML_LIBS) \
292
	$(LIBXML_LIBS) \
293
	$(NETWORKMANAGER_LIBS) \
293
	$(NETWORKMANAGER_LIBS) \
294
	$(PURPLE_KEYRING_LIBS) \
294
	$(INTLLIBS) \
295
	$(INTLLIBS) \
295
	$(FARSIGHT_LIBS) \
296
	$(FARSIGHT_LIBS) \
296
	$(GSTREAMER_LIBS) \
297
	$(GSTREAMER_LIBS) \
Lines 306-311 AM_CPPFLAGS = \ Link Here
306
	$(GLIB_CFLAGS) \
307
	$(GLIB_CFLAGS) \
307
	$(DEBUG_CFLAGS) \
308
	$(DEBUG_CFLAGS) \
308
	$(DBUS_CFLAGS) \
309
	$(DBUS_CFLAGS) \
310
	$(PURPLE_KEYRING_CFLAGS) \
309
	$(LIBXML_CFLAGS) \
311
	$(LIBXML_CFLAGS) \
310
	$(FARSIGHT_CFLAGS) \
312
	$(FARSIGHT_CFLAGS) \
311
	$(GSTREAMER_CFLAGS) \
313
	$(GSTREAMER_CFLAGS) \
(-)pidgin-2.6.3/libpurple/account.c (-6 / +88 lines)
Lines 49-54 typedef struct Link Here
49
#define PURPLE_ACCOUNT_GET_PRIVATE(account) \
49
#define PURPLE_ACCOUNT_GET_PRIVATE(account) \
50
	((PurpleAccountPrivate *) (account->priv))
50
	((PurpleAccountPrivate *) (account->priv))
51
51
52
#ifdef PURPLE_ENABLE_KEYRING
53
#include <gnome-keyring.h>
54
55
static char * purple_account_get_password_from_keyring (const char *_prpl, const char *_user);
56
static gboolean purple_account_set_password_in_keyring (const char *_prpl, const char *_user, const char *password);
57
#endif
58
52
/* TODO: Should use PurpleValue instead of this?  What about "ui"? */
59
/* TODO: Should use PurpleValue instead of this?  What about "ui"? */
53
typedef struct
60
typedef struct
54
{
61
{
Lines 378-385 account_to_xmlnode(PurpleAccount *accoun Link Here
378
	if (purple_account_get_remember_password(account) &&
385
	if (purple_account_get_remember_password(account) &&
379
		((tmp = purple_account_get_password(account)) != NULL))
386
		((tmp = purple_account_get_password(account)) != NULL))
380
	{
387
	{
388
#ifdef PURPLE_ENABLE_KEYRING
389
                purple_account_set_password_in_keyring( purple_account_get_protocol_id(account),
390
                                          purple_account_get_username(account), tmp);
391
#else
381
		child = xmlnode_new_child(node, "password");
392
		child = xmlnode_new_child(node, "password");
382
		xmlnode_insert_data(child, tmp, -1);
393
		xmlnode_insert_data(child, tmp, -1);
394
#endif
383
	}
395
	}
384
396
385
	if ((tmp = purple_account_get_alias(account)) != NULL)
397
	if ((tmp = purple_account_get_alias(account)) != NULL)
Lines 828-844 parse_account(xmlnode *node) Link Here
828
	}
840
	}
829
841
830
	ret = purple_account_new(name, _purple_oscar_convert(name, protocol_id)); /* XXX: */
842
	ret = purple_account_new(name, _purple_oscar_convert(name, protocol_id)); /* XXX: */
831
	g_free(name);
843
        gboolean got_pwd = FALSE;
832
	g_free(protocol_id);
844
#ifdef PURPLE_ENABLE_KEYRING
833
845
        data = purple_account_get_password_from_keyring(protocol_id, name);
834
	/* Read the password */
846
        if (data)
835
	child = xmlnode_get_child(node, "password");
836
	if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
837
	{
847
	{
848
                got_pwd = TRUE;
838
		purple_account_set_remember_password(ret, TRUE);
849
		purple_account_set_remember_password(ret, TRUE);
839
		purple_account_set_password(ret, data);
850
		purple_account_set_password(ret, data);
840
		g_free(data);
851
		g_free(data);
841
	}
852
	}
853
#endif
854
        if (!got_pwd)
855
        {
856
                /* Read the password */
857
                child = xmlnode_get_child(node, "password");
858
                if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
859
                {
860
                        purple_account_set_remember_password(ret, TRUE);
861
                        purple_account_set_password(ret, data);
862
                        g_free(data);
863
                }
864
        }
865
	g_free(name);
866
	g_free(protocol_id);
842
867
843
	/* Read the alias */
868
	/* Read the alias */
844
	child = xmlnode_get_child(node, "alias");
869
	child = xmlnode_get_child(node, "alias");
Lines 2873-2875 purple_accounts_uninit(void) Link Here
2873
	purple_signals_disconnect_by_handle(handle);
2898
	purple_signals_disconnect_by_handle(handle);
2874
	purple_signals_unregister_by_instance(handle);
2899
	purple_signals_unregister_by_instance(handle);
2875
}
2900
}
2901
2902
#ifdef PURPLE_ENABLE_KEYRING
2903
static char *
2904
purple_account_get_password_from_keyring(const char *_prpl, const char *_user)
2905
{
2906
  GnomeKeyringNetworkPasswordData *found_item;
2907
  GnomeKeyringResult               result;
2908
  GList                           *matches;
2909
  char                            *password;
2910
2911
  matches = NULL;
2912
2913
  result = gnome_keyring_find_network_password_sync (
2914
               _user,          /* user     */
2915
               NULL,           /* domain   */
2916
               "gaim.local",   /* server   */
2917
               NULL,           /* object   */
2918
               _prpl,          /* protocol */
2919
               NULL,           /* authtype */
2920
               1863,           /* port     */
2921
               &matches);
2922
2923
  if (result != GNOME_KEYRING_RESULT_OK)
2924
    return NULL;
2925
2926
  g_assert (matches != NULL && matches->data != NULL);
2927
2928
  found_item = (GnomeKeyringNetworkPasswordData *) matches->data;
2929
2930
  password = g_strdup (found_item->password);
2931
2932
  gnome_keyring_network_password_list_free (matches);
2933
2934
  return password;
2935
}
2936
2937
static gboolean
2938
purple_account_set_password_in_keyring (const char *_prpl, const char *_user, const char *_password)
2939
{
2940
  GnomeKeyringResult result;
2941
  guint32            item_id;
2942
2943
  result = gnome_keyring_set_network_password_sync (
2944
                NULL,           /* default keyring */
2945
                _user,          /* user            */
2946
                NULL,           /* domain          */
2947
                "gaim.local",   /* server          */
2948
                NULL,           /* object          */
2949
                _prpl,          /* protocol        */
2950
                NULL,           /* authtype        */
2951
                1863,           /* port            */
2952
                _password,       /* password        */
2953
                &item_id);
2954
2955
  return result == GNOME_KEYRING_RESULT_OK;
2956
}
2957
#endif

Return to bug 307169