5089N/A# date:2006-11-16 owner:elaine type:branding bugster:6439103
5089N/A# Bug 15335933 SUNBT6439103 gaim must use gnome-keyring
5089N/A# Changes should be submitted upstream.
5089N/A gtk_rc_add_default_file(search_path);
5089N/A+ GnomeKeyringResult rtn = gnome_keyring_unlock_sync(NULL, NULL);
5089N/A+ // if (rtn == GNOME_KEYRING_RESULT_DENIED)
5089N/A gui_check = gtk_init_check(&argc, &argv);
5089N/A char *display = gdk_get_display();
5089N/A+dnl #######################################################################
5089N/A+dnl # Check for gnome-keyring
5089N/A+dnl #--enable-gnome-keyring=(yes|no)
5089N/A+dnl #######################################################################
5089N/A+AC_ARG_ENABLE(gnome-keyring,
5089N/A+ AC_HELP_STRING([--enable-gnome-keyring],
5089N/A+ [use gnome keyring for storing password [default=no]]),,
5089N/A+if test "x$enable_gnome_keyring" = "xyes"; then
5089N/A+ PKG_CHECK_MODULES(GAIM_KEYRING,
5089N/A+ AC_DEFINE(GAIM_ENABLE_KEYRING, [], [Set if we should use gnome-keyring]))
5089N/A AC_MSG_CHECKING(for me pot o' gold)
5089N/A AC_CHECK_FUNCS(gethostid lrand48 timegm)
5089N/A #define PURPLE_ACCOUNT_GET_PRIVATE(account) \
5089N/A ((PurpleAccountPrivate *) (account->priv))
5089N/A+static char * gaim_account_get_password_from_keyring (const char *_prpl, const char *_user);
5089N/A+static gboolean gaim_account_set_password_in_keyring (const char *_prpl, const char *_user, const char *password);
5089N/A /* TODO: Should use PurpleValue instead of this? What about "ui"? */
5089N/A if (purple_account_get_remember_password(account) &&
5089N/A ((tmp = purple_account_get_password(account)) != NULL))
5089N/A+ gaim_account_set_password_in_keyring( purple_account_get_protocol_id(account),
5089N/A+ purple_account_get_username(account), tmp);
5089N/A child = xmlnode_new_child(node, "password");
5089N/A xmlnode_insert_data(child, tmp, -1);
5089N/A } else if (_purple_account_is_password_encrypted(account)) {
5089N/A const char *keyring = NULL;
5089N/A ret = purple_account_new(name, _purple_oscar_convert(name, protocol_id)); /* XXX: */
5089N/A+ data = gaim_account_get_password_from_keyring(protocol_id, name);
5089N/A+ purple_account_set_remember_password(ret, TRUE);
5089N/A+ purple_account_set_password(ret, data);
5089N/A+ child = xmlnode_get_child(node, "password");
5089N/A+ const char *keyring_id = xmlnode_get_attrib(child, "keyring_id");
5089N/A+ const char *mode = xmlnode_get_attrib(child, "mode");
5089N/A- child = xmlnode_get_child(node, "password");
5089N/A- const char *keyring_id = xmlnode_get_attrib(child, "keyring_id");
5089N/A- const char *mode = xmlnode_get_attrib(child, "mode");
5089N/A+ data = xmlnode_get_data(child);
5089N/A- data = xmlnode_get_data(child);
5089N/A+ if (keyring_id == NULL || keyring_id[0] == '\0')
5089N/A+ else if (g_strcmp0(keyring_id, "keyring-internal") != 0)
5089N/A+ else if (mode == NULL || mode[0] == '\0' || g_strcmp0(mode, "cleartext") == 0)
5089N/A- if (keyring_id == NULL || keyring_id[0] == '\0')
5089N/A- else if (g_strcmp0(keyring_id, "keyring-internal") != 0)
5089N/A- else if (mode == NULL || mode[0] == '\0' || g_strcmp0(mode, "cleartext") == 0)
5089N/A purple_account_set_remember_password(ret, TRUE);
5089N/A purple_account_set_password(ret, data);
5089N/A child = xmlnode_get_child(node, "alias");
5089N/A return (priv->password_keyring != NULL);
5089N/A+gaim_account_get_password_from_keyring(const char *_prpl, const char *_user)
5089N/A+ GnomeKeyringNetworkPasswordData *found_item;
5089N/A+ GnomeKeyringResult result;
5089N/A+ result = gnome_keyring_find_network_password_sync (
5089N/A+ if (result != GNOME_KEYRING_RESULT_OK)
5089N/A+ if (matches == NULL || matches->data == NULL)
5089N/A+ found_item = (GnomeKeyringNetworkPasswordData *) matches->data;
5089N/A+ password = g_strdup (found_item->password);
5089N/A+ gnome_keyring_network_password_list_free (matches);
5089N/A+void my_GnomeKeyringOperationGetIntCallback(GnomeKeyringResult result, guint32 val, gpointer data)
5089N/A+gaim_account_set_password_in_keyring (const char *_prpl, const char *_user, const char *_password)
5089N/A+ GnomeKeyringResult result;
5089N/A+ gpointer req = gnome_keyring_set_network_password (
5089N/A+ NULL, /* default keyring */
5089N/A+ my_GnomeKeyringOperationGetIntCallback, NULL, NULL);