diff options
author | Patrick McLean <patrick@cim.mcgill.ca> | 2011-06-20 10:52:33 -0400 |
---|---|---|
committer | Patrick McLean <patrick@cim.mcgill.ca> | 2011-06-20 10:52:33 -0400 |
commit | 8402212a7b1433553fbfbf8c57294aba8e6166e2 (patch) | |
tree | 4e628ec045b5cc9687dcce7550e36d0b74ceb536 /net-im/pidgin/files/pidgin-gnome-keyring-2.patch | |
parent | Manifest update. (diff) | |
download | chutzpah-8402212a7b1433553fbfbf8c57294aba8e6166e2.tar.gz chutzpah-8402212a7b1433553fbfbf8c57294aba8e6166e2.tar.bz2 chutzpah-8402212a7b1433553fbfbf8c57294aba8e6166e2.zip |
Make the gnome-keyring patch actually work.
Diffstat (limited to 'net-im/pidgin/files/pidgin-gnome-keyring-2.patch')
-rw-r--r-- | net-im/pidgin/files/pidgin-gnome-keyring-2.patch | 229 |
1 files changed, 229 insertions, 0 deletions
diff --git a/net-im/pidgin/files/pidgin-gnome-keyring-2.patch b/net-im/pidgin/files/pidgin-gnome-keyring-2.patch new file mode 100644 index 0000000..a15633c --- /dev/null +++ b/net-im/pidgin/files/pidgin-gnome-keyring-2.patch @@ -0,0 +1,229 @@ +diff -ur pidgin-2.8.0.orig//configure.ac pidgin-2.8.0/configure.ac +--- pidgin-2.8.0.orig//configure.ac 2011-06-07 04:44:40.000000000 -0400 ++++ pidgin-2.8.0/configure.ac 2011-06-20 10:16:33.000000000 -0400 +@@ -2379,6 +2379,20 @@ + LDFLAGS="$orig_LDFLAGS" + fi + ++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(PIDGIN_KEYRING, ++ gnome-keyring-1, ++ AC_DEFINE(PIDGIN_ENABLE_KEYRING, [], [Set if we should use gnome-keyring])) ++fi ++ + AC_MSG_CHECKING(for me pot o' gold) + AC_MSG_RESULT(no) + AC_CHECK_FUNCS(gethostid lrand48 timegm) +Only in pidgin-2.8.0: configure.ac.orig +diff -ur pidgin-2.8.0.orig//libpurple/account.c pidgin-2.8.0/libpurple/account.c +--- pidgin-2.8.0.orig//libpurple/account.c 2011-06-07 04:44:40.000000000 -0400 ++++ pidgin-2.8.0/libpurple/account.c 2011-06-20 10:19:17.000000000 -0400 +@@ -49,6 +49,13 @@ + #define PURPLE_ACCOUNT_GET_PRIVATE(account) \ + ((PurpleAccountPrivate *) (account->priv)) + ++#ifdef PIDGIN_ENABLE_KEYRING ++#include <gnome-keyring.h> ++ ++static char * pidgin_account_get_password_from_keyring (const char *_prpl, const char *_user); ++static gboolean pidgin_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 + { +@@ -379,8 +386,13 @@ + if (purple_account_get_remember_password(account) && + ((tmp = purple_account_get_password(account)) != NULL)) + { ++#ifdef PIDGIN_ENABLE_KEYRING ++ pidgin_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) +@@ -875,17 +887,30 @@ + } + + 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)) +- { +- purple_account_set_remember_password(ret, TRUE); +- purple_account_set_password(ret, data); +- g_free(data); +- } ++ gboolean got_pwd = FALSE; ++#ifdef PIDGIN_ENABLE_KEYRING ++ data = pidgin_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"); +@@ -3245,3 +3270,61 @@ + purple_signals_disconnect_by_handle(handle); + purple_signals_unregister_by_instance(handle); + } ++ ++#ifdef PIDGIN_ENABLE_KEYRING ++static char * ++pidgin_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; ++ ++ if (matches == NULL || matches->data == NULL) ++ return NULL; ++ ++ found_item = (GnomeKeyringNetworkPasswordData *) matches->data; ++ ++ password = g_strdup (found_item->password); ++ ++ gnome_keyring_network_password_list_free (matches); ++ ++ return password; ++} ++ ++static gboolean ++pidgin_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 +Only in pidgin-2.8.0/libpurple: account.c.orig +diff -ur pidgin-2.8.0.orig//libpurple/Makefile.am pidgin-2.8.0/libpurple/Makefile.am +--- pidgin-2.8.0.orig//libpurple/Makefile.am 2011-06-07 04:44:40.000000000 -0400 ++++ pidgin-2.8.0/libpurple/Makefile.am 2011-06-20 10:16:33.000000000 -0400 +@@ -305,6 +305,7 @@ + $(DBUS_LIBS) \ + $(GLIB_LIBS) \ + $(LIBXML_LIBS) \ ++ $(PIDGIN_KEYRING_LIBS) \ + $(NETWORKMANAGER_LIBS) \ + $(INTLLIBS) \ + $(FARSIGHT_LIBS) \ +@@ -322,6 +323,7 @@ + $(GLIB_CFLAGS) \ + $(DEBUG_CFLAGS) \ + $(DBUS_CFLAGS) \ ++ $(PIDGIN_KEYRING_CFLAGS) \ + $(LIBXML_CFLAGS) \ + $(FARSIGHT_CFLAGS) \ + $(GSTREAMER_CFLAGS) \ +Only in pidgin-2.8.0/libpurple: Makefile.am.orig +diff -ur pidgin-2.8.0.orig//pidgin/gtkmain.c pidgin-2.8.0/pidgin/gtkmain.c +--- pidgin-2.8.0.orig//pidgin/gtkmain.c 2011-06-07 04:44:41.000000000 -0400 ++++ pidgin-2.8.0/pidgin/gtkmain.c 2011-06-20 10:16:33.000000000 -0400 +@@ -70,6 +70,10 @@ + #include "pidginstock.h" + #include "gtkwhiteboard.h" + ++#ifdef PIDGIN_ENABLE_KEYRING ++#include <gnome-keyring.h> ++#endif ++ + #ifdef HAVE_SIGNAL_H + # include <signal.h> + #endif +@@ -742,6 +746,12 @@ + gtk_rc_add_default_file(search_path); + g_free(search_path); + ++#ifdef PIDGIN_ENABLE_KEYRING ++ GnomeKeyringResult rtn = gnome_keyring_unlock_sync(NULL, NULL); ++ // if (rtn == GNOME_KEYRING_RESULT_DENIED) ++ // return 0; ++#endif ++ + gui_check = gtk_init_check(&argc, &argv); + if (!gui_check) { + char *display = gdk_get_display(); +Only in pidgin-2.8.0/pidgin: gtkmain.c.orig +diff -ur pidgin-2.8.0.orig//pidgin/Makefile.am pidgin-2.8.0/pidgin/Makefile.am +--- pidgin-2.8.0.orig//pidgin/Makefile.am 2011-06-07 04:44:41.000000000 -0400 ++++ pidgin-2.8.0/pidgin/Makefile.am 2011-06-20 10:16:33.000000000 -0400 +@@ -157,6 +157,7 @@ + $(INTLLIBS) \ + $(GTKSPELL_LIBS) \ + $(LIBXML_LIBS) \ ++ $(PIDGIN_KEYRING_LIBS) \ + $(GTK_LIBS) \ + $(top_builddir)/libpurple/libpurple.la + +@@ -177,6 +178,7 @@ + $(GSTREAMER_CFLAGS) \ + $(DEBUG_CFLAGS) \ + $(GTK_CFLAGS) \ ++ $(PIDGIN_KEYRING_CFLAGS) \ + $(DBUS_CFLAGS) \ + $(GTKSPELL_CFLAGS) \ + $(LIBXML_CFLAGS) \ +Only in pidgin-2.8.0/pidgin: Makefile.am.orig |