#include "libews.h"
-icalcomponent *fetch_item(int xmlfd, GError **error);
+icalcomponent *fetch_item(int xmlfd, const char *parent_id, icaltimezone *zone, GError **error);
+
+icalcomponent *(hack_fetch_subitem)(void *priv,
+ const gchar *item_id,
+ const gchar *parent_id,
+ icaltimezone *zone,
+ GError **error);
int main(int argc, char **argv)
{
fprintf(stderr, "Too many args. Want only xml file and ical file\n");
return -1;
}
- calcomp = fetch_item(xmlfd, &error);
+ calcomp = fetch_item(xmlfd, NULL, NULL, &error);
if (!calcomp) {
fprintf(stderr, "Failed to convert: %s\n", error->message);
return 0;
}
-icalcomponent *fetch_item(int xmlfd, GError **error)
+icalcomponent *fetch_item(int xmlfd, const char *parent_id, icaltimezone *zone, GError **error)
{
xmlDocPtr xml_doc;
xmlNode *xml_node;
exit(1);
}
- return ews_calitem_to_ical(xml_node, NULL, NULL, NULL, NULL, error);
+ return ews_calitem_to_ical(xml_node, parent_id, zone, NULL /*hack_fetch_subitem*/, NULL, error);
}
+
+icalcomponent *(hack_fetch_subitem)(void *priv,
+ const gchar *item_id,
+ const gchar *parent_id,
+ icaltimezone *zone,
+ GError **error)
+{
+ icalcomponent *comp;
+
+ int fd = open(item_id, O_RDONLY);
+ if (fd == -1) {
+ g_set_error(error, EWS_ERROR, EWS_ERROR_PARSE,
+ "Failed to open file '%s'", item_id);
+ return NULL;
+ }
+ comp = fetch_item(fd, parent_id, zone, error);
+#if 0
+ printf("subitem %p\n", comp);
+ if (comp) {
+ char *outbuf =icalcomponent_as_ical_string_r(comp);
+ fprintf(stderr, "%s", outbuf);
+ free(outbuf);
+ }
+#endif
+ return comp;
+}