1 |
eva 08/10/12 20:43:20 |
2 |
|
3 |
Added: evolution-exchange-2.22.3-exchange-contact.patch |
4 |
Log: |
5 |
Fix exchange contacts tracking, upstream bug #546934. |
6 |
(Portage version: 2.2_rc11/cvs/Linux 2.6.24-gentoo-r8 i686) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 gnome-extra/evolution-exchange/files/evolution-exchange-2.22.3-exchange-contact.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/gnome-extra/evolution-exchange/files/evolution-exchange-2.22.3-exchange-contact.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/gnome-extra/evolution-exchange/files/evolution-exchange-2.22.3-exchange-contact.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: evolution-exchange-2.22.3-exchange-contact.patch |
15 |
=================================================================== |
16 |
--- |
17 |
|
18 |
# Fix exchange contacts tracking, upstream bug #546934 |
19 |
#epatch "${FILESDIR}"/${P}-exchange-contact.patch |
20 |
|
21 |
|
22 |
At http://bugzilla.gnome.org/show_bug.cgi?id=546934 |
23 |
|
24 |
e_book_backend_exchange_get_changes() (and therefore e_book_get_changes() with |
25 |
an Exchange address book) has three different problems: |
26 |
|
27 |
* The list of collected changes in ctx->changes is never returned to the caller. |
28 |
Instead the list is leaked when freeing the context. |
29 |
* For deleted items, an empty vcard with the UID set should be returned. |
30 |
Instead find_deleted_ids() stores the UID directly. |
31 |
* find_deleted_ids() is a callback for g_hash_table_foreach() and modifies |
32 |
the hash that is iterated over. That's a big no-no! The effect is that the |
33 |
iteration is stopped prematurely, leading to incorrect change tracking. |
34 |
g_hash_table_foreach_remove() and its XML wrapper function have to be used |
35 |
instead. |
36 |
|
37 |
Index: addressbook/e-book-backend-exchange.c |
38 |
=================================================================== |
39 |
--- addressbook/e-book-backend-exchange.c (revision 1709) |
40 |
+++ addressbook/e-book-backend-exchange.c (working copy) |
41 |
@@ -2042,17 +2042,29 @@ |
42 |
CORBA_free (change); |
43 |
} |
44 |
|
45 |
-static void |
46 |
+static gboolean |
47 |
find_deleted_ids (const char *id, const char *vcard, gpointer user_data) |
48 |
{ |
49 |
EBookBackendExchangeChangeContext *ctx = user_data; |
50 |
+ gboolean remove = FALSE; |
51 |
|
52 |
if (!g_hash_table_lookup (ctx->seen_ids, id)) { |
53 |
- ctx->changes = g_list_prepend ( |
54 |
- ctx->changes, |
55 |
- e_book_backend_change_delete_new (id)); |
56 |
- e_xmlhash_remove (ctx->ehash, id); |
57 |
+ char *vcard = NULL; |
58 |
+ EContact *contact = e_contact_new (); |
59 |
+ if (contact) { |
60 |
+ e_contact_set (contact, E_CONTACT_UID, id); |
61 |
+ vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30); |
62 |
+ if (vcard) { |
63 |
+ ctx->changes = g_list_prepend ( |
64 |
+ ctx->changes, |
65 |
+ e_book_backend_change_delete_new (vcard)); |
66 |
+ g_free (vcard); |
67 |
+ } |
68 |
+ g_object_unref (contact); |
69 |
+ } |
70 |
+ remove = TRUE; |
71 |
} |
72 |
+ return remove; |
73 |
} |
74 |
|
75 |
static EBookBackendSyncStatus |
76 |
@@ -2135,9 +2147,14 @@ |
77 |
g_list_foreach (ctx->changes, free_change, NULL); |
78 |
ctx->changes = NULL; |
79 |
} else { |
80 |
- e_xmlhash_foreach_key (ctx->ehash, find_deleted_ids, ctx); |
81 |
+ e_xmlhash_foreach_key_remove (ctx->ehash, find_deleted_ids, ctx); |
82 |
e_xmlhash_write (ctx->ehash); |
83 |
} |
84 |
+ |
85 |
+ /* transfer ownership of result to caller before cleaning up */ |
86 |
+ *changes = ctx->changes; |
87 |
+ ctx->changes = NULL; |
88 |
+ |
89 |
e_xmlhash_destroy (ctx->ehash); |
90 |
g_hash_table_destroy (ctx->seen_ids); |
91 |
g_free (ctx); |