[libgdata] contacts: Ensure group IDs use the "base" projection



commit df443a3eabb743df695927fd2943e52d29ee2685
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Sep 4 15:20:19 2010 +0100

    contacts: Ensure group IDs use the "base" projection
    
    Another example of GData services giving out two different formats of the
    same ID and only accepting one of them. We need to ensure that group IDs sent
    to the service use the "base" projection rather than the "full" projection.

 gdata/services/contacts/gdata-contacts-contact.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gdata/services/contacts/gdata-contacts-contact.c b/gdata/services/contacts/gdata-contacts-contact.c
index b250a18..8d1add9 100644
--- a/gdata/services/contacts/gdata-contacts-contact.c
+++ b/gdata/services/contacts/gdata-contacts-contact.c
@@ -917,7 +917,15 @@ get_user_defined_field_xml_cb (const gchar *name, const gchar *value, GString *x
 static void
 get_group_xml_cb (const gchar *href, gpointer deleted, GString *xml_string)
 {
-	g_string_append_printf (xml_string, "<gContact:groupMembershipInfo href='%s'/>", href);
+	gchar *full_pos, *uri = g_strdup (href);
+
+	/* The service API sometimes stubbornly insists on using the "full" view instead of the "base" view, which we have
+	 * to fix, or it complains about an invalid group ID. */
+	full_pos = strstr (uri, "/full/");
+	if (full_pos != NULL)
+		memcpy ((char*) full_pos, "/base/", 6);
+
+	g_string_append_printf (xml_string, "<gContact:groupMembershipInfo href='%s'/>", uri);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]