]> www.infradead.org Git - users/dwmw2/ews-sync.git/commitdiff
Add location output
authorDavid Woodhouse <dwmw2@infradead.org>
Fri, 16 Jul 2010 19:53:02 +0000 (20:53 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Fri, 16 Jul 2010 19:53:02 +0000 (20:53 +0100)
ews2ical.c

index 734301f6c9ac05da23cc767bf7c4ed5c361388d8..efe2c5e6f6fefffa25d9773ecefb8cf0b8fdd183 100644 (file)
@@ -15,6 +15,7 @@ int process_organizer(xmlNode *xml_node);
 int process_required_attendees(xmlNode *xml_node);
 int process_start(xmlNode *xml_node);
 int process_end(xmlNode *xml_node);
+int process_location(xmlNode *xml_node);
 int process_body(xmlNode *xml_node);
 int process_subject(xmlNode *xml_node);
 
@@ -135,6 +136,8 @@ int main(int argc, char **argv)
                        process_end(xml_node);
                else if (!strcmp((char *)xml_node->name, "Body"))
                        process_body(xml_node);
+               else if (!strcmp((char *)xml_node->name, "Location"))
+                       process_location(xml_node);
                else if (!strcmp((char *)xml_node->name, "Subject"))
                        process_subject(xml_node);
                else
@@ -215,20 +218,45 @@ int process_required_attendees(xmlNode *xml_node)
        return 0;
 }
 
+int process_time(xmlNode *xml_node, char *name)
+{
+       char *tm = (char *)xmlNodeGetContent(xml_node);
+       if (!tm)
+               return -1;
+
+       fprintf(calfile, "%s:", name);
+       while (*tm) {
+               if (*tm == '-' || *tm == ':')
+                       tm++;
+               fputc(*tm, calfile);
+               tm++;
+       }
+       fputc('\n', calfile);
+       return 0;
+}
 
 int process_start(xmlNode *xml_node)
 {
-       return 0;
+       return process_time(xml_node, "DTSTART");
 }
 
 int process_end(xmlNode *xml_node)
 {
+       return process_time(xml_node, "DTEND");
+}
+
+int process_location (xmlNode *xml_node)
+{
+       const char *dur = (char *)xmlNodeGetContent(xml_node);
+       if (!dur)
+               return -1;
+       fprintf(calfile, "LOCATION: %s\n", dur);
        return 0;
 }
 
 int process_body(xmlNode *xml_node)
 {
-       char *body = (char *)xmlNodeGetContent(xml_node);
+       const char *body = (char *)xmlNodeGetContent(xml_node);
        int col = 12;
 
        if (!body)