9968
|
1 |
--- 2.0b4-my/libpurple/Makefile.am 2006-10-19 01:38:16.000000000 +0800
|
|
2 |
+++ 2.0b4-my2/libpurple/Makefile.am 2006-11-13 18:28:51.383417000 +0800
|
10257
|
3 |
@@ -230,6 +230,7 @@
|
|
4 |
$(GLIB_LIBS) \
|
9968
|
5 |
$(LIBXML_LIBS) \
|
|
6 |
$(LIBNM_LIBS) \
|
|
7 |
+ $(GAIM_KEYRING_LIBS) \
|
|
8 |
$(INTLLIBS) \
|
|
9 |
-lm
|
|
10 |
|
10257
|
11 |
@@ -242,5 +243,6 @@
|
9968
|
12 |
$(GLIB_CFLAGS) \
|
|
13 |
$(DEBUG_CFLAGS) \
|
|
14 |
$(DBUS_CFLAGS) \
|
|
15 |
+ $(GAIM_KEYRING_CFLAGS) \
|
|
16 |
$(LIBXML_CFLAGS) \
|
|
17 |
$(LIBNM_CFLAGS)
|
11300
|
18 |
--- pidgin-2.3.0/libpurple/account.c 2007-11-25 03:05:51.000000000 +0800
|
|
19 |
+++ pidgin-2.3.0-my/libpurple/account.c 2007-12-06 11:35:30.201708000 +0800
|
|
20 |
@@ -49,6 +49,13 @@
|
|
21 |
#define PURPLE_ACCOUNT_GET_PRIVATE(account) \
|
|
22 |
((PurpleAccountPrivate *) (account->priv))
|
9968
|
23 |
|
|
24 |
+#ifdef GAIM_ENABLE_KEYRING
|
|
25 |
+#include <gnome-keyring.h>
|
|
26 |
+
|
|
27 |
+static char * gaim_account_get_password_from_keyring (const char *_prpl, const char *_user);
|
|
28 |
+static gboolean gaim_account_set_password_in_keyring (const char *_prpl, const char *_user, const char *password);
|
|
29 |
+#endif
|
|
30 |
+
|
|
31 |
/* TODO: Should use PurpleValue instead of this? What about "ui"? */
|
|
32 |
typedef struct
|
|
33 |
{
|
11300
|
34 |
@@ -363,8 +370,13 @@
|
9968
|
35 |
if (purple_account_get_remember_password(account) &&
|
|
36 |
((tmp = purple_account_get_password(account)) != NULL))
|
|
37 |
{
|
|
38 |
+#ifdef GAIM_ENABLE_KEYRING
|
|
39 |
+ gaim_account_set_password_in_keyring( purple_account_get_protocol_id(account),
|
|
40 |
+ purple_account_get_username(account), tmp);
|
|
41 |
+#else
|
|
42 |
child = xmlnode_new_child(node, "password");
|
|
43 |
xmlnode_insert_data(child, tmp, -1);
|
|
44 |
+#endif
|
|
45 |
}
|
|
46 |
|
|
47 |
if ((tmp = purple_account_get_alias(account)) != NULL)
|
11300
|
48 |
@@ -778,17 +790,30 @@
|
9968
|
49 |
}
|
|
50 |
|
|
51 |
ret = purple_account_new(name, _purple_oscar_convert(name, protocol_id)); /* XXX: */
|
|
52 |
- g_free(name);
|
|
53 |
- g_free(protocol_id);
|
|
54 |
-
|
|
55 |
- /* Read the password */
|
|
56 |
- child = xmlnode_get_child(node, "password");
|
|
57 |
- if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
|
|
58 |
- {
|
|
59 |
- purple_account_set_remember_password(ret, TRUE);
|
|
60 |
- purple_account_set_password(ret, data);
|
|
61 |
- g_free(data);
|
|
62 |
- }
|
|
63 |
+ gboolean got_pwd = FALSE;
|
|
64 |
+#ifdef GAIM_ENABLE_KEYRING
|
|
65 |
+ data = gaim_account_get_password_from_keyring(protocol_id, name);
|
|
66 |
+ if (data)
|
|
67 |
+ {
|
|
68 |
+ got_pwd = TRUE;
|
|
69 |
+ purple_account_set_remember_password(ret, TRUE);
|
|
70 |
+ purple_account_set_password(ret, data);
|
|
71 |
+ g_free(data);
|
|
72 |
+ }
|
|
73 |
+#endif
|
|
74 |
+ if (!got_pwd)
|
|
75 |
+ {
|
|
76 |
+ /* Read the password */
|
|
77 |
+ child = xmlnode_get_child(node, "password");
|
|
78 |
+ if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL))
|
|
79 |
+ {
|
|
80 |
+ purple_account_set_remember_password(ret, TRUE);
|
|
81 |
+ purple_account_set_password(ret, data);
|
|
82 |
+ g_free(data);
|
|
83 |
+ }
|
|
84 |
+ }
|
|
85 |
+ g_free(name);
|
|
86 |
+ g_free(protocol_id);
|
|
87 |
|
|
88 |
/* Read the alias */
|
|
89 |
child = xmlnode_get_child(node, "alias");
|
11300
|
90 |
@@ -2698,3 +2723,61 @@
|
|
91 |
purple_signals_disconnect_by_handle(handle);
|
|
92 |
purple_signals_unregister_by_instance(handle);
|
9968
|
93 |
}
|
|
94 |
+
|
|
95 |
+#ifdef GAIM_ENABLE_KEYRING
|
|
96 |
+static char *
|
|
97 |
+gaim_account_get_password_from_keyring(const char *_prpl, const char *_user)
|
|
98 |
+{
|
|
99 |
+ GnomeKeyringNetworkPasswordData *found_item;
|
|
100 |
+ GnomeKeyringResult result;
|
|
101 |
+ GList *matches;
|
|
102 |
+ char *password;
|
|
103 |
+
|
|
104 |
+ matches = NULL;
|
|
105 |
+
|
|
106 |
+ result = gnome_keyring_find_network_password_sync (
|
|
107 |
+ _user, /* user */
|
|
108 |
+ NULL, /* domain */
|
|
109 |
+ "gaim.local", /* server */
|
|
110 |
+ NULL, /* object */
|
|
111 |
+ _prpl, /* protocol */
|
|
112 |
+ NULL, /* authtype */
|
|
113 |
+ 1863, /* port */
|
|
114 |
+ &matches);
|
|
115 |
+
|
|
116 |
+ if (result != GNOME_KEYRING_RESULT_OK)
|
|
117 |
+ return NULL;
|
|
118 |
+
|
10315
|
119 |
+ if (matches == NULL || matches->data == NULL)
|
10276
|
120 |
+ return NULL;
|
9968
|
121 |
+
|
|
122 |
+ found_item = (GnomeKeyringNetworkPasswordData *) matches->data;
|
|
123 |
+
|
|
124 |
+ password = g_strdup (found_item->password);
|
|
125 |
+
|
|
126 |
+ gnome_keyring_network_password_list_free (matches);
|
|
127 |
+
|
|
128 |
+ return password;
|
|
129 |
+}
|
|
130 |
+
|
|
131 |
+static gboolean
|
|
132 |
+gaim_account_set_password_in_keyring (const char *_prpl, const char *_user, const char *_password)
|
|
133 |
+{
|
|
134 |
+ GnomeKeyringResult result;
|
|
135 |
+ guint32 item_id;
|
|
136 |
+
|
|
137 |
+ result = gnome_keyring_set_network_password_sync (
|
|
138 |
+ NULL, /* default keyring */
|
|
139 |
+ _user, /* user */
|
|
140 |
+ NULL, /* domain */
|
|
141 |
+ "gaim.local", /* server */
|
|
142 |
+ NULL, /* object */
|
|
143 |
+ _prpl, /* protocol */
|
|
144 |
+ NULL, /* authtype */
|
|
145 |
+ 1863, /* port */
|
|
146 |
+ _password, /* password */
|
|
147 |
+ &item_id);
|
|
148 |
+
|
|
149 |
+ return result == GNOME_KEYRING_RESULT_OK;
|
|
150 |
+}
|
|
151 |
+#endif
|
|
152 |
--- pidgin-2.0.0/configure.ac-ori 2007-05-24 14:26:55.133319000 +0800
|
|
153 |
+++ pidgin-2.0.0/configure.ac 2007-05-24 14:27:12.141394000 +0800
|
|
154 |
@@ -1914,6 +1914,20 @@
|
|
155 |
LDFLAGS="$orig_LDFLAGS"
|
|
156 |
fi
|
|
157 |
|
|
158 |
+dnl #######################################################################
|
|
159 |
+dnl # Check for gnome-keyring
|
|
160 |
+dnl #--enable-gnome-keyring=(yes|no)
|
|
161 |
+dnl #######################################################################
|
|
162 |
+AC_ARG_ENABLE(gnome-keyring,
|
|
163 |
+ AC_HELP_STRING([--enable-gnome-keyring],
|
|
164 |
+ [use gnome keyring for storing password [default=no]]),,
|
|
165 |
+ enable_gnome_keyring=no)
|
|
166 |
+if test "x$enable_gnome_keyring" = "xyes"; then
|
|
167 |
+ PKG_CHECK_MODULES(GAIM_KEYRING,
|
|
168 |
+ gnome-keyring-1,
|
|
169 |
+ AC_DEFINE(GAIM_ENABLE_KEYRING, [], [Set if we should use gnome-keyring]))
|
|
170 |
+fi
|
|
171 |
+
|
|
172 |
AC_MSG_CHECKING(for me pot o' gold)
|
|
173 |
AC_MSG_RESULT(no)
|
|
174 |
AC_CHECK_FUNCS(gethostid lrand48)
|
11157
|
175 |
--- old/pidgin/gtkmain.c Wed Oct 24 04:55:59 2007
|
|
176 |
+++ new/pidgin/gtkmain.c Fri Nov 9 10:12:22 2007
|
|
177 |
@@ -67,6 +67,10 @@
|
|
178 |
#include "pidginstock.h"
|
|
179 |
#include "gtkwhiteboard.h"
|
|
180 |
|
|
181 |
+#ifdef GAIM_ENABLE_KEYRING
|
|
182 |
+#include <gnome-keyring.h>
|
|
183 |
+#endif
|
|
184 |
+
|
|
185 |
#ifdef HAVE_SIGNAL_H
|
|
186 |
# include <signal.h>
|
|
187 |
#endif
|
|
188 |
@@ -680,6 +684,12 @@
|
|
189 |
gtk_rc_add_default_file(search_path);
|
|
190 |
g_free(search_path);
|
|
191 |
|
|
192 |
+#ifdef GAIM_ENABLE_KEYRING
|
|
193 |
+ GnomeKeyringResult rtn = gnome_keyring_unlock_sync(NULL, NULL);
|
|
194 |
+ // if (rtn == GNOME_KEYRING_RESULT_DENIED)
|
|
195 |
+ // return 0;
|
|
196 |
+#endif
|
|
197 |
+
|
|
198 |
gui_check = gtk_init_check(&argc, &argv);
|
|
199 |
if (!gui_check) {
|
|
200 |
char *display = gdk_get_display();
|
|
201 |
--- old/pidgin/Makefile.am 2007-08-21 02:12:53.000000000 +0800
|
|
202 |
+++ new/pidgin/Makefile.am 2007-09-18 14:55:09.688398000 +0800
|
|
203 |
@@ -185,6 +185,7 @@
|
|
204 |
$(GTKSPELL_LIBS) \
|
|
205 |
$(STARTUP_NOTIFICATION_LIBS) \
|
|
206 |
$(LIBXML_LIBS) \
|
|
207 |
+ $(GAIM_KEYRING_LIBS) \
|
|
208 |
$(GTK_LIBS) \
|
|
209 |
$(top_builddir)/libpurple/libpurple.la
|
|
210 |
|
|
211 |
@@ -204,6 +205,7 @@
|
|
212 |
$(GSTREAMER_CFLAGS) \
|
|
213 |
$(DEBUG_CFLAGS) \
|
|
214 |
$(GTK_CFLAGS) \
|
|
215 |
+ $(GAIM_KEYRING_CFLAGS) \
|
|
216 |
$(DBUS_CFLAGS) \
|
|
217 |
$(GTKSPELL_CFLAGS) \
|
|
218 |
$(STARTUP_NOTIFICATION_CFLAGS) \
|