components/desktop/pidgin/patches/pidgin-01-gnome-keyring.patch
author Rich Burridge <rich.burridge@oracle.com>
Mon, 16 Nov 2015 16:48:46 -0800
changeset 5091 81e5d6b75c3c
child 7368 13871af9f746
permissions -rw-r--r--
22185024 Move pidgin from Desktop to Userland
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5091
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     1
# date:2006-11-16 owner:elaine type:branding bugster:6439103
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     2
# Bug 15335933 SUNBT6439103 gaim must use gnome-keyring
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     3
#
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     4
# Changes should be submitted upstream.
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     5
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     6
--- pidgin-2.7.11/libpurple/Makefile.am.orig	2011-03-11 10:20:27.000000000 +0800
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     7
+++ pidgin-2.7.11/libpurple/Makefile.am	2011-03-14 09:45:48.768422314 +0800
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     8
@@ -305,6 +305,7 @@
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     9
 	$(DBUS_LIBS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    10
 	$(GLIB_LIBS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    11
 	$(LIBXML_LIBS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    12
+        $(GAIM_KEYRING_LIBS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    13
 	$(NETWORKMANAGER_LIBS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    14
 	$(INTLLIBS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    15
 	$(FARSTREAM_LIBS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    16
@@ -322,6 +323,7 @@
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    17
 	$(GLIB_CFLAGS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    18
 	$(DEBUG_CFLAGS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    19
 	$(DBUS_CFLAGS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    20
+        $(GAIM_KEYRING_CFLAGS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    21
 	$(LIBXML_CFLAGS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    22
 	$(FARSTREAM_CFLAGS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    23
 	$(GSTREAMER_CFLAGS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    24
--- pidgin-2.7.11/pidgin/gtkmain.c.orig	2011-03-11 10:20:28.000000000 +0800
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    25
+++ pidgin-2.7.11/pidgin/gtkmain.c	2011-03-14 09:45:48.767697192 +0800
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    26
@@ -70,6 +70,10 @@
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    27
 #include "pidginstock.h"
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    28
 #include "gtkwhiteboard.h"
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    29
 
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    30
+#ifdef GAIM_ENABLE_KEYRING
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    31
+#include <gnome-keyring.h>
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    32
+#endif
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    33
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    34
 #ifdef HAVE_SIGNAL_H
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    35
 # include <signal.h>
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    36
 #endif
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    37
@@ -742,6 +746,12 @@
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    38
 	gtk_rc_add_default_file(search_path);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    39
 	g_free(search_path);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    40
 
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    41
+#ifdef  GAIM_ENABLE_KEYRING
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    42
+        GnomeKeyringResult rtn = gnome_keyring_unlock_sync(NULL, NULL);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    43
+        // if (rtn == GNOME_KEYRING_RESULT_DENIED)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    44
+        //   return 0;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    45
+#endif
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    46
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    47
 	gui_check = gtk_init_check(&argc, &argv);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    48
 	if (!gui_check) {
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    49
 		char *display = gdk_get_display();
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    50
--- pidgin-2.7.11/pidgin/Makefile.am.orig	2011-03-11 10:20:28.000000000 +0800
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    51
+++ pidgin-2.7.11/pidgin/Makefile.am	2011-03-14 09:45:48.768028256 +0800
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    52
@@ -177,6 +177,7 @@
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    53
 	$(GSTREAMER_CFLAGS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    54
 	$(DEBUG_CFLAGS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    55
 	$(GTK_CFLAGS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    56
+        $(GAIM_KEYRING_CFLAGS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    57
 	$(DBUS_CFLAGS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    58
 	$(GTKSPELL_CFLAGS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    59
 	$(LIBXML_CFLAGS) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    60
--- pidgin-2.7.11/configure.ac.orig	2011-03-11 10:20:27.000000000 +0800
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    61
+++ pidgin-2.7.11/configure.ac	2011-03-14 09:45:48.770550233 +0800
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    62
@@ -2382,6 +2382,20 @@
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    63
 	LDFLAGS="$orig_LDFLAGS"
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    64
 fi
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    65
 
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    66
+dnl #######################################################################
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    67
+dnl # Check for gnome-keyring
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    68
+dnl #--enable-gnome-keyring=(yes|no)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    69
+dnl #######################################################################
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    70
+AC_ARG_ENABLE(gnome-keyring,
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    71
+              AC_HELP_STRING([--enable-gnome-keyring],
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    72
+                             [use gnome keyring for storing password [default=no]]),,
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    73
+              enable_gnome_keyring=no)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    74
+if test "x$enable_gnome_keyring" = "xyes"; then
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    75
+    PKG_CHECK_MODULES(GAIM_KEYRING,
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    76
+                      gnome-keyring-1,
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    77
+                      AC_DEFINE(GAIM_ENABLE_KEYRING, [], [Set if we should use gnome-keyring]))
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    78
+fi
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    79
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    80
 AC_MSG_CHECKING(for me pot o' gold)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    81
 AC_MSG_RESULT(no)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    82
 AC_CHECK_FUNCS(gethostid lrand48 timegm)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    83
--- pidgin-2.10.11/libpurple/account.c.orig	Tue Feb 17 15:27:17 2015
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    84
+++ pidgin-2.10.11/libpurple/account.c	Tue Feb 17 15:27:17 2015
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    85
@@ -54,6 +54,14 @@
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    86
 #define PURPLE_ACCOUNT_GET_PRIVATE(account) \
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    87
 	((PurpleAccountPrivate *) (account->priv))
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    88
 
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    89
+#ifdef GAIM_ENABLE_KEYRING
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    90
+#include <gnome-keyring.h>
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    91
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    92
+static char * gaim_account_get_password_from_keyring (const char *_prpl, const char *_user);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    93
+static gboolean gaim_account_set_password_in_keyring (const char *_prpl, const char *_user, const char *password);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    94
+#endif
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    95
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    96
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    97
 /* TODO: Should use PurpleValue instead of this?  What about "ui"? */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    98
 typedef struct
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    99
 {
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   100
@@ -393,8 +401,13 @@
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   101
 	if (purple_account_get_remember_password(account) &&
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   102
 		((tmp = purple_account_get_password(account)) != NULL))
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   103
 	{
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   104
+#ifdef GAIM_ENABLE_KEYRING
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   105
+	        gaim_account_set_password_in_keyring( purple_account_get_protocol_id(account),
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   106
+                                          purple_account_get_username(account), tmp);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   107
+#else
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   108
 		child = xmlnode_new_child(node, "password");
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   109
 		xmlnode_insert_data(child, tmp, -1);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   110
+#endif
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   111
 	} else if (_purple_account_is_password_encrypted(account)) {
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   112
 		const char *keyring = NULL;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   113
 		const char *mode = NULL;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   114
@@ -909,27 +925,37 @@
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   115
 	}
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   116
 
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   117
 	ret = purple_account_new(name, _purple_oscar_convert(name, protocol_id)); /* XXX: */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   118
-	g_free(name);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   119
-	g_free(protocol_id);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   120
+        gboolean got_pwd = FALSE;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   121
+#ifdef GAIM_ENABLE_KEYRING
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   122
+        data = gaim_account_get_password_from_keyring(protocol_id, name);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   123
+        if (data)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   124
+        {
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   125
+                got_pwd = TRUE;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   126
+                purple_account_set_remember_password(ret, TRUE);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   127
+                purple_account_set_password(ret, data);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   128
+                g_free(data);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   129
+        }
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   130
+#endif
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   131
+	if (!got_pwd)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   132
+	{
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   133
+	        /* Read the password */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   134
+               child = xmlnode_get_child(node, "password");
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   135
+	       if (child != NULL) {
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   136
+ 		      const char *keyring_id = xmlnode_get_attrib(child, "keyring_id");
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   137
+		      const char *mode = xmlnode_get_attrib(child, "mode");
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   138
+		      gboolean is_plaintext;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   139
 
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   140
-	/* Read the password */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   141
-	child = xmlnode_get_child(node, "password");
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   142
-	if (child != NULL) {
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   143
-		const char *keyring_id = xmlnode_get_attrib(child, "keyring_id");
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   144
-		const char *mode = xmlnode_get_attrib(child, "mode");
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   145
-		gboolean is_plaintext;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   146
+		      data = xmlnode_get_data(child);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   147
 
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   148
-		data = xmlnode_get_data(child);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   149
+		      if (keyring_id == NULL || keyring_id[0] == '\0')
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   150
+		      	      is_plaintext = TRUE;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   151
+		      else if (g_strcmp0(keyring_id, "keyring-internal") != 0)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   152
+			      is_plaintext = FALSE;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   153
+		      else if (mode == NULL || mode[0] == '\0' || g_strcmp0(mode, "cleartext") == 0)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   154
+			      is_plaintext = TRUE;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   155
+		      else
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   156
+			      is_plaintext = FALSE;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   157
 
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   158
-		if (keyring_id == NULL || keyring_id[0] == '\0')
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   159
-			is_plaintext = TRUE;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   160
-		else if (g_strcmp0(keyring_id, "keyring-internal") != 0)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   161
-			is_plaintext = FALSE;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   162
-		else if (mode == NULL || mode[0] == '\0' || g_strcmp0(mode, "cleartext") == 0)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   163
-			is_plaintext = TRUE;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   164
-		else
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   165
-			is_plaintext = FALSE;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   166
-
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   167
 		if (is_plaintext) {
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   168
 			purple_account_set_remember_password(ret, TRUE);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   169
 			purple_account_set_password(ret, data);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   170
@@ -940,6 +966,9 @@
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   171
 		}
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   172
 		g_free(data);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   173
 	}
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   174
+	}
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   175
+	g_free(name);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   176
+	g_free(protocol_id);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   177
 
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   178
 	/* Read the alias */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   179
 	child = xmlnode_get_child(node, "alias");
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   180
@@ -3350,3 +3378,66 @@
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   181
 
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   182
 	return (priv->password_keyring != NULL);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   183
 }
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   184
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   185
+#ifdef GAIM_ENABLE_KEYRING
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   186
+static char *
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   187
+gaim_account_get_password_from_keyring(const char *_prpl, const char *_user)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   188
+{
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   189
+  GnomeKeyringNetworkPasswordData *found_item;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   190
+  GnomeKeyringResult               result;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   191
+  GList                           *matches;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   192
+  char                            *password;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   193
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   194
+  matches = NULL;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   195
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   196
+  result = gnome_keyring_find_network_password_sync (
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   197
+               _user,          /* user     */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   198
+               NULL,           /* domain   */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   199
+               "gaim.local",   /* server   */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   200
+               NULL,           /* object   */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   201
+               _prpl,          /* protocol */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   202
+               NULL,           /* authtype */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   203
+               1863,           /* port     */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   204
+               &matches);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   205
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   206
+  if (result != GNOME_KEYRING_RESULT_OK)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   207
+    return NULL;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   208
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   209
+  if (matches == NULL || matches->data == NULL)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   210
+    return NULL;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   211
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   212
+  found_item = (GnomeKeyringNetworkPasswordData *) matches->data;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   213
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   214
+  password = g_strdup (found_item->password);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   215
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   216
+  gnome_keyring_network_password_list_free (matches);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   217
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   218
+  return password;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   219
+}
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   220
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   221
+void my_GnomeKeyringOperationGetIntCallback(GnomeKeyringResult result, guint32 val, gpointer data)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   222
+{
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   223
+  return;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   224
+}
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   225
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   226
+static gboolean
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   227
+gaim_account_set_password_in_keyring (const char *_prpl, const char *_user, const char *_password)
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   228
+{
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   229
+  GnomeKeyringResult result;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   230
+  guint32            item_id;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   231
+
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   232
+  gpointer req = gnome_keyring_set_network_password (
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   233
+                NULL,           /* default keyring */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   234
+                _user,          /* user            */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   235
+                NULL,           /* domain          */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   236
+                "gaim.local",   /* server          */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   237
+                NULL,           /* object          */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   238
+                _prpl,          /* protocol        */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   239
+                NULL,           /* authtype        */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   240
+                1863,           /* port            */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   241
+                _password,       /* password        */
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   242
+                my_GnomeKeyringOperationGetIntCallback, NULL, NULL);
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   243
+  return TRUE;
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   244
+}
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   245
+#endif
81e5d6b75c3c 22185024 Move pidgin from Desktop to Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   246
+