[libgdata/libgdata-0-6] contacts: Ensure group IDs use the "base" projection



commit 4e999760f330e8492c04f5bb1fb9e8d5eb9729ea
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 d308f35..1009792 100644
--- a/gdata/services/contacts/gdata-contacts-contact.c
+++ b/gdata/services/contacts/gdata-contacts-contact.c
@@ -447,7 +447,15 @@ get_extended_property_xml_cb (const gchar *name, const gchar *value, GString *xm
 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]