[OGo-Evolution] evolution-groupdav patch - Re: [OGo-Developer] ZideStore - VTODO
PUT not yet implemented
Janosch Rolles
evolution@opengroupware.org
Mon, 12 Dec 2005 21:04:12 +0100
--=-dzQGIhvAKTljYu9IXPSb
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
> Would you mind to post a patch for review? Crashers in my (groupdav)
> branch of the Noodle connector are a major reason why I stopped
> working on it (no time to locate the bug).
The patch for the evolution-groupdav-2.0 release is attached to this
message. I hope it works for you, too.
It contains the following changes:
* uses "libedataserverui/e-passwords.h" instead of
"e-util/e-passwords.h"
* uses xxxxx:0 as etag if getetag is not set or empty
(empty etags were one of the reasons for crashes)
* cuts off XML input from the groupdav server after
"</D:multistatus>" (for some reason response.length
is being set to invalid values, garbage bytes after
"</D:multistatus>" are causing crashes while parsing)
* cuts off VCALENDAR input after "END:VCALENDAR"
(same as above, causing crashes)
I was not (yet) able to find out why response.length is being set to
invalid values. The workaround seems to work fine.
It is also possible that the server's response really does contain the
garbage bytes appended to the valid data - but I don't think so.
However, how can I test this? Is there an easy way to send groupdav
requests and read the response? Can I use a web browser? Or is there
some simple script or tool available for testing?
> > Question 1)
> > Is there anybody who will implement the VTODO PUT in ZideStore,
> > soon? I
> > could help by testing it with my version of evolution-groupdav and
> > this
> > way create a full featured evolution-groupdav plugin.
>
> I planned to do that before OGo 1.0, but right now I'm not sure
> whether I manage in time. Probably not.
It would be great if you could do this and I will try to help as good as
I can - maybe by testing and fixing connector issues. Please tell me,
where I can help. I think this is better than a solution hacked into the
zidestore code by someone like me who does not really know zidestore and
objective c.
Thanks again...
Janosch
--=-dzQGIhvAKTljYu9IXPSb
Content-Disposition: attachment; filename=evolution-groupdav-0.2_fix_crashes.patch
Content-Type: text/x-patch; name=evolution-groupdav-0.2_fix_crashes.patch; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
diff -Naur evolution-groupdav-0.2_orig/calendar/e-cal-backend-ogo.c evolution-groupdav-0.2_clean/calendar/e-cal-backend-ogo.c
--- evolution-groupdav-0.2_orig/calendar/e-cal-backend-ogo.c 2005-02-25 03:20:48.000000000 +0100
+++ evolution-groupdav-0.2_clean/calendar/e-cal-backend-ogo.c 2005-12-12 17:57:28.000000000 +0100
@@ -710,10 +710,12 @@
priv = ogo->priv;
/* FIXME: We only support events right now */
+ /* janosch: lets try inserting tasks...
if (e_cal_backend_get_kind (E_CAL_BACKEND (backend)) == ICAL_VTODO_COMPONENT) {
e_cal_backend_notify_error (E_CAL_BACKEND (backend), _("Currently, creating new tasks is unsupported"));
return GNOME_Evolution_Calendar_OtherError;
}
+ */
/* check the component for validity */
icalcomp = icalparser_parse_string (*calobj);
@@ -776,10 +778,13 @@
gchar *new_contents;
/* FIXME: We only support events right now */
+ /* janosch: lets try updating tasks...
if (e_cal_backend_get_kind (E_CAL_BACKEND (backend)) == ICAL_VTODO_COMPONENT) {
e_cal_backend_notify_error (E_CAL_BACKEND (backend), _("Currently, modifying tasks is unsupported"));
return GNOME_Evolution_Calendar_OtherError;
}
+ */
+
*old_object = NULL;
diff -Naur evolution-groupdav-0.2_orig/plugins/config/camel-ogo-listener.c evolution-groupdav-0.2_clean/plugins/config/camel-ogo-listener.c
--- evolution-groupdav-0.2_orig/plugins/config/camel-ogo-listener.c 2004-12-22 15:47:52.000000000 +0100
+++ evolution-groupdav-0.2_clean/plugins/config/camel-ogo-listener.c 2005-12-12 18:10:50.000000000 +0100
@@ -28,7 +28,14 @@
#include "camel-ogo-listener.h"
#include <string.h>
#include <camel/camel-i18n.h>
+
+// janosch: use new header path
+#include <libedataserverui/e-passwords.h>
+/*
#include <e-util/e-passwords.h>
+*/
+
+
/*stores some info about all currently existing ogo accounts
list of OGoAccountInfo structures */
diff -Naur evolution-groupdav-0.2_orig/utils/ogo-connection.c evolution-groupdav-0.2_clean/utils/ogo-connection.c
--- evolution-groupdav-0.2_orig/utils/ogo-connection.c 2005-02-25 03:42:48.000000000 +0100
+++ evolution-groupdav-0.2_clean/utils/ogo-connection.c 2005-12-12 17:48:56.000000000 +0100
@@ -359,6 +359,15 @@
http_status = soup_session_send_message (conn->priv->soup_session, message);
if ((status = get_status_from_http_response (http_status)) == OGO_CONNECTION_STATUS_OK) {
+
+ // janosch: response.length seems to be wrong, lets write a '\0' into the string to terminate it at the correct position
+ char *s = strstr(message->response.body, "END:VCALENDAR");
+ if (s != NULL) {
+ s[0+strlen("END:VCALENDAR")] = '\0';
+ }
+ message->response.length = strlen(message->response.body);
+
+
*item_contents = g_strndup (message->response.body,
message->response.length);
} else {
@@ -403,6 +412,16 @@
uri_node = find_first_child (response, "href");
if (uri_node->children->content)
item->uri = g_strdup (uri_node->children->content);
+
+
+ // janosch: create zero etag from href (will be overwritten by getetag, if getetag is available)
+ char* short_id;
+ char etag[100];
+ short_id = rindex(item->uri, '/') + 1;
+ sprintf(etag, "%s:0", short_id);
+ item->etag = g_strdup (etag);
+
+
propstat = find_first_child (response, "propstat");
prop = find_first_child (propstat, "prop");
@@ -412,7 +431,12 @@
/* Now walk through all properties */
for (value = prop->children; value != NULL; value = value->next) {
if (strcmp (value->name, "getetag") == 0) {
- item->etag = g_strdup (value->children->content);
+ // janosch: ignore empty getetag content
+ if ( value->children == NULL || value->children->content == NULL || strlen(value->children->content)==0 ) {
+ // ignore
+ } else {
+ item->etag = g_strdup (value->children->content);
+ }
}
}
@@ -441,6 +465,14 @@
http_status = soup_session_send_message (conn->priv->soup_session, message);
if ((status = get_status_from_http_response (http_status)) == OGO_CONNECTION_STATUS_OK) {
+ // janosch: response.length seems to be wrong, lets write a '\0' into the string to terminate it at the correct position
+ char *s = strstr(message->response.body, "</D:multistatus>");
+ if (s != NULL) {
+ s[0+strlen("</D:multistatus>")] = '\0';
+ }
+ message->response.length = strlen(message->response.body);
+
+
xmlDocPtr doc;
doc = xmlReadMemory (message->response.body, message->response.length,
--=-dzQGIhvAKTljYu9IXPSb--