? libgossip/.deps
? libgossip/.libs
? libgossip/gossip-account-manager.lo
? libgossip/gossip-account.lo
? libgossip/gossip-chatroom-manager.lo
? libgossip/gossip-chatroom-provider.lo
? libgossip/gossip-chatroom.lo
? libgossip/gossip-contact.lo
? libgossip/gossip-debug.lo
? libgossip/gossip-event-manager.lo
? libgossip/gossip-event.lo
? libgossip/gossip-ft-provider.lo
? libgossip/gossip-ft.lo
? libgossip/gossip-message.lo
? libgossip/gossip-presence.lo
? libgossip/gossip-protocol.lo
? libgossip/gossip-session.lo
? libgossip/gossip-time.lo
? libgossip/gossip-utils.lo
? libgossip/gossip-vcard.lo
? libgossip/gossip-version-info.lo
? libgossip/libgossip-marshal-main.lo
? libgossip/libgossip.la
? po/.intltool-merge-cache
? protocols/jabber/.deps
? protocols/jabber/.libs
? protocols/jabber/gossip-jabber-chatrooms.lo
? protocols/jabber/gossip-jabber-ft-utils.lo
? protocols/jabber/gossip-jabber-ft.lo
? protocols/jabber/gossip-jabber-services.lo
? protocols/jabber/gossip-jabber-utils.lo
? protocols/jabber/gossip-jabber-vcard.lo
? protocols/jabber/gossip-jabber.lo
? protocols/jabber/gossip-jid.lo
? protocols/jabber/gossip-transport-accounts.lo
? protocols/jabber/gossip-transport-discover.lo
? protocols/jabber/gossip-transport-protocol.lo
? protocols/jabber/gossip-transport-register.lo
? protocols/jabber/libgossip-jabber.la
Index: configure.ac
===================================================================
RCS file: /cvs/gnome/gossip/configure.ac,v
retrieving revision 1.44
diff -p -u -r1.44 configure.ac
--- configure.ac	3 Jun 2006 07:45:57 -0000	1.44
+++ configure.ac	3 Jun 2006 12:19:39 -0000
@@ -133,6 +133,34 @@ fi
 
 AM_CONDITIONAL(HAVE_LIBNOTIFY, test x$have_libnotify = xyes)
 
+dnl -----------------------------------------------------------
+dnl gnome-keyring
+dnl -----------------------------------------------------------
+
+AC_ARG_ENABLE(gnome_keyring,
+	AS_HELP_STRING([--enable-gnome-keyring=@<:@no/yes/auto@:>@],
+	               [compile with Gnome Keyring support]), ,
+				   enable_gnome_keyring=auto)
+
+if test "x$enable_gnome_keyring" != "xno"; then
+	gnome_keyring_pkgconfig_tmp="gnome-keyring-1"
+	PKG_CHECK_MODULES(GNOME_KEYRING, $gnome_keyring_pkgconfig_tmp, have_gnome_keyring=yes, have_gnome_keyring=no)
+	if test x$have_gnome_keyring = xyes; then
+		AC_DEFINE(HAVE_GNOME_KEYRING, 1, [gnome keyring support])
+		gnome_keyring_pkgconfig=$gnome_keyring_pkgconfig_tmp
+	fi
+else
+	have_gnome_keyring=no
+	gnome_keyring_pkgconfig=
+fi
+
+if text "x$enable_gnome_keyring" = "xyes"; then
+	if test "x$have_gnome_keyring" != "xyes"; then
+		AC_MSG_ERROR([Couldn't find gnome-keyring.])
+	fi
+fi
+
+AM_CONDITIONAL(HAVE_GNOME_KEYRING, test x$have_gnome_keyring = xyes)
 
 dnl -----------------------------------------------------------
 dnl ISO codes, used for aspell support
@@ -152,7 +180,6 @@ fi
 
 AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["$iso_codes_prefix"],[ISO codes prefix])
 
-
 dnl -----------------------------------------------------------
 dnl Pkg-Config dependency checks
 dnl -----------------------------------------------------------
@@ -162,6 +189,7 @@ PKG_CHECK_MODULES(LIBGOSSIP, [
 	gobject-2.0
 	gnome-vfs-2.0 >= $LIBGNOMEVFS_REQUIRED
 	gconf-2.0 >= $GCONF_REQUIRED
+	$gnome_keyring_pkgconfig
 ])
 
 PKG_CHECK_MODULES(GOSSIP,
@@ -299,4 +327,5 @@ echo "D-BUS        : $have_dbus"
 echo "Galago       : $have_galago"
 echo "ASpell       : $have_aspell"
 echo "Notify       : $have_libnotify"
+echo "gnome-keyring: $have_gnome_keyring"
 echo
Index: libgossip/Makefile.am
===================================================================
RCS file: /cvs/gnome/gossip/libgossip/Makefile.am,v
retrieving revision 1.15
diff -p -u -r1.15 Makefile.am
--- libgossip/Makefile.am	18 Mar 2006 06:57:10 -0000	1.15
+++ libgossip/Makefile.am	3 Jun 2006 12:19:39 -0000
@@ -4,7 +4,8 @@ AM_CPPFLAGS =                           
 	-DPROTOCOL_DIR=\""$(libdir)/gossip/protocols"\" \
 	-DDTDDIR=\"$(datadir)/gossip\"			\
 	-I$(top_srcdir)/protocols/jabber                \
-	$(LIBGOSSIP_CFLAGS) $(WARN_CFLAGS)
+	$(LIBGOSSIP_CFLAGS) $(GNOME_KEYRING_CFLAGS) \
+	$(WARN_CFLAGS)
 
 noinst_LTLIBRARIES = libgossip.la
 
@@ -52,6 +53,7 @@ libgossip_la_SOURCES =             			\
 
 libgossip_la_LIBADD =              			\
 	$(LIBGOSSIP_LIBS)          			\
+	$(GNOME_KEYRING_LIBS)               \
 	$(top_builddir)/protocols/jabber/libgossip-jabber.la
 
 libgossipincludedir = $(includedir)/gossip/
Index: libgossip/gossip-account-manager.c
===================================================================
RCS file: /cvs/gnome/gossip/libgossip/gossip-account-manager.c,v
retrieving revision 1.20
diff -p -u -r1.20 gossip-account-manager.c
--- libgossip/gossip-account-manager.c	25 May 2006 14:50:28 -0000	1.20
+++ libgossip/gossip-account-manager.c	3 Jun 2006 12:19:39 -0000
@@ -439,7 +439,10 @@ account_manager_parse_account (GossipAcc
 	xmlNodePtr         child;
 	gchar             *str;
 	GossipAccountType  type;
-	gchar             *name, *id, *password;
+	gchar             *name, *id;
+#ifndef HAVE_GNOME_KEYRING
+	gchar             *password;
+#endif
 	gchar             *server, *resource;
 	guint16            port;
 	gboolean           auto_connect, use_ssl, use_proxy;
@@ -448,7 +451,9 @@ account_manager_parse_account (GossipAcc
 	type = GOSSIP_ACCOUNT_TYPE_JABBER;
 	name = NULL;
 	id = NULL;
+#ifndef HAVE_GNOME_KEYRING
 	password = NULL;
+#endif
 	resource = NULL;
 	server = NULL;
 	port = 5222;
@@ -474,9 +479,11 @@ account_manager_parse_account (GossipAcc
 		else if (strcmp (tag, "id") == 0) {
 			id = g_strdup (str);
 		}
+#ifndef HAVE_GNOME_KEYRING
 		else if (strcmp (tag, "password") == 0) {
 			password = g_strdup (str);
 		}
+#endif
 		else if (strcmp (tag, "server") == 0) {
 			server = g_strdup (str);
 		}
@@ -536,10 +543,12 @@ account_manager_parse_account (GossipAcc
 		if (server) {
 			gossip_account_set_server (account, server);
 		}
-		
+
+#ifndef HAVE_GNOME_KEYRING
 		if (password) {
 			gossip_account_set_password (account, password);
 		}
+#endif
 		
 #ifdef RESOURCE_HACK
 		const gchar *resource_found = NULL;
@@ -575,7 +584,9 @@ account_manager_parse_account (GossipAcc
 	
 	g_free (name);
 	g_free (id);
+#ifndef HAVE_GNOME_KEYRING
 	g_free (password);
+#endif
 	g_free (resource);
 	g_free (server);
 }
@@ -720,7 +731,11 @@ account_manager_file_save (GossipAccount
 		xmlNewTextChild (node, NULL, "id", gossip_account_get_id (account));
 
 		xmlNewTextChild (node, NULL, "resource", gossip_account_get_resource (account));
+#ifdef HAVE_GNOME_KEYRING
+		xmlAddChild (node, xmlNewComment ("password stored in gnome-keyring"));
+#else
 		xmlNewTextChild (node, NULL, "password", gossip_account_get_password (account));
+#endif
 		xmlNewTextChild (node, NULL, "server", gossip_account_get_server (account));
 		xmlNewChild (node, NULL, "port", port);
 
Index: libgossip/gossip-account.c
===================================================================
RCS file: /cvs/gnome/gossip/libgossip/gossip-account.c,v
retrieving revision 1.38
diff -p -u -r1.38 gossip-account.c
--- libgossip/gossip-account.c	23 Apr 2006 15:28:10 -0000	1.38
+++ libgossip/gossip-account.c	3 Jun 2006 12:19:40 -0000
@@ -24,6 +24,10 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 
+#ifdef HAVE_GNOME_KEYRING
+#include <gnome-keyring.h>
+#endif
+
 #include "libgossip-marshal.h"
 
 #include "gossip-account.h"
@@ -76,7 +80,6 @@ enum {
 	PROP_TYPE,
 	PROP_NAME,
 	PROP_ID,
-	PROP_PASSWORD,
 	PROP_RESOURCE,
 	PROP_SERVER,
 	PROP_PORT,
@@ -168,14 +171,6 @@ account_class_init (GossipAccountClass *
 							      G_PARAM_READWRITE));
 
 	g_object_class_install_property (object_class,
-					 PROP_PASSWORD,
-					 g_param_spec_string ("password",
-							      "Account Password",
-							      "Authentication token",
-							      NULL,
-							      G_PARAM_READWRITE));
-
-	g_object_class_install_property (object_class,
 					 PROP_SERVER,
 					 g_param_spec_string ("server",
 							      "Account Server",
@@ -303,9 +298,6 @@ account_get_property (GObject    *object
 	case PROP_ID:
 		g_value_set_string (value, priv->id);
 		break;
-	case PROP_PASSWORD:
-		g_value_set_string (value, priv->password);
-		break;
 	case PROP_RESOURCE:
 		g_value_set_string (value, priv->resource);
 		break;
@@ -353,10 +345,6 @@ account_set_property (GObject      *obje
 		gossip_account_set_id (GOSSIP_ACCOUNT (object),
 				       g_value_get_string (value));
 		break;
-	case PROP_PASSWORD:
-		gossip_account_set_password (GOSSIP_ACCOUNT (object),
-					     g_value_get_string (value));
-		break;
 	case PROP_RESOURCE:
 		gossip_account_set_resource (GOSSIP_ACCOUNT (object),
 					     g_value_get_string (value));
@@ -438,10 +426,41 @@ const gchar *
 gossip_account_get_password (GossipAccount *account)
 {
 	GossipAccountPriv *priv;
+#ifdef HAVE_GNOME_KEYRING
+	GList *l;
+	GnomeKeyringResult r;
+	gchar **jid;
+#endif
 
 	g_return_val_if_fail (GOSSIP_IS_ACCOUNT (account), NULL);
 
 	priv = GET_PRIV (account);
+
+#ifdef HAVE_GNOME_KEYRING
+	jid = g_strsplit (gossip_account_get_id (account), "@", 2);
+	g_assert (jid[0] != NULL);
+	g_assert (jid[1] != NULL);
+
+	r = gnome_keyring_find_network_password_sync (jid[0],
+		NULL, jid[1], NULL,
+		"jabber", NULL, 0,
+		&l);
+	g_strfreev (jid);
+	
+	if (r == GNOME_KEYRING_RESULT_OK) {
+		g_free (priv->password);
+		priv->password = g_strdup (((GnomeKeyringNetworkPasswordData *)l->data)->password);
+		
+		if (g_list_length (l) > 1)
+			g_warning ("%d matching passwords in keyring", g_list_length (l));
+
+		g_list_foreach (l, (GFunc) g_free, NULL);
+		g_list_free (l);
+	} else {
+		g_warning ("%s (%d)\n", "Could not retrieve password from keyring", r);
+	}
+#endif
+
 	return priv->password;
 }
 
@@ -552,18 +571,39 @@ void
 gossip_account_set_password (GossipAccount *account,
 			     const gchar   *password)
 {
+#ifdef HAVE_GNOME_KEYRING
+	gchar **jid;
+	GnomeKeyringResult r;
+	guint32 id;
+#else
 	GossipAccountPriv *priv;
+#endif
 
 	g_return_if_fail (GOSSIP_IS_ACCOUNT (account));
 	g_return_if_fail (password != NULL);
+
+#ifdef HAVE_GNOME_KEYRING
+	jid = g_strsplit (gossip_account_get_id (account), "@", 2);
+	g_assert (jid[0] != NULL);
+	g_assert (jid[1] != NULL);
+	
+	r = gnome_keyring_set_network_password_sync (NULL,
+		jid[0], NULL, jid[1], NULL,
+		"jabber",
+		NULL, 0,
+		password,
+		&id);
+	g_strfreev (jid);
 	
+	if (r != GNOME_KEYRING_RESULT_OK) {
+		g_warning ("%s (%d)\n", "Could not save password to keyring", r);
+	}
+#else
 	priv = GET_PRIV (account);
-	
+
 	g_free (priv->password);
 	priv->password = g_strdup (password);
-
-	g_object_notify (G_OBJECT (account), "password");
-	g_signal_emit (account, signals[CHANGED], 0);
+#endif
 }
 
 void
