From: <svn...@op...> - 2009-09-24 21:30:12
|
Author: paule Date: Thu Sep 24 23:29:56 2009 New Revision: 5836 URL: http://www.opensync.org/changeset/5836 Log: opie-sync: fixes for OpenSync API changes Modified: plugins/opie-sync/src/opie_format.c plugins/opie-sync/src/opie_format.h Modified: plugins/opie-sync/src/opie_format.c ============================================================================== --- plugins/opie-sync/src/opie_format.c Tue Sep 22 09:28:11 2009 (r5835) +++ plugins/opie-sync/src/opie_format.c Thu Sep 24 23:29:56 2009 (r5836) @@ -82,7 +82,7 @@ { /* File-as. This is what the Evo plugin does, so copy it. */ out_xmlfield = osync_xmlfield_new(out_xmlformat, "FormattedName", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else if(!strcasecmp(iprop->name, "Emails")) { @@ -94,7 +94,7 @@ out_xmlfield = osync_xmlfield_new(out_xmlformat, "Categories", error); for(j=0;categorytokens[j]!=NULL;j++) { - osync_xmlfield_add_key_value(out_xmlfield, "Category", categorytokens[j]); + osync_xmlfield_add_key_value(out_xmlfield, "Category", categorytokens[j], error); } g_strfreev(categorytokens); } @@ -106,7 +106,7 @@ else if(!strcasecmp(iprop->name, "HomePhone")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Telephone", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); osync_xmlfield_set_attr(out_xmlfield, "Location", "Home"); /* Removed the VOICE tags for the moment as they are assumed if not present, and if they are KDEPIM shows them up as "Other" */ @@ -115,21 +115,21 @@ else if(!strcasecmp(iprop->name, "HomeFax")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Telephone", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); osync_xmlfield_set_attr(out_xmlfield, "Location", "Home"); osync_xmlfield_set_attr(out_xmlfield, "Type", "Fax"); } else if(!strcasecmp(iprop->name, "HomeMobile")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Telephone", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); osync_xmlfield_set_attr(out_xmlfield, "Location", "Home"); osync_xmlfield_set_attr(out_xmlfield, "Type", "Cellular"); } else if(!strcasecmp(iprop->name, "BusinessPhone")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Telephone", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); osync_xmlfield_set_attr(out_xmlfield, "Location", "Work"); /* Removed the VOICE tags for the moment as they are assumed if not present, and if they are KDEPIM shows them up as "Other" */ @@ -138,53 +138,53 @@ else if(!strcasecmp(iprop->name, "BusinessFax")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Telephone", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); osync_xmlfield_set_attr(out_xmlfield, "Location", "Work"); osync_xmlfield_set_attr(out_xmlfield, "Type", "Fax"); } else if(!strcasecmp(iprop->name, "BusinessMobile")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Telephone", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); osync_xmlfield_set_attr(out_xmlfield, "Location", "Work"); osync_xmlfield_set_attr(out_xmlfield, "Type", "Cellular"); } else if(!strcasecmp(iprop->name, "BusinessPager")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Telephone", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); osync_xmlfield_set_attr(out_xmlfield, "Location", "Work"); osync_xmlfield_set_attr(out_xmlfield, "Type", "Pager"); /* FIXME is this still supported? */ } else if(!strcasecmp(iprop->name, "HomeWebPage")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "BlogUrl", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else if(!strcasecmp(iprop->name, "BusinessWebPage")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Url", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else if(!strcasecmp(iprop->name, "Spouse")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Spouse", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else if(!strcasecmp(iprop->name, "Birthday")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Birthday", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else if(!strcasecmp(iprop->name, "Anniversary")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Anniversary", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else if(!strcasecmp(iprop->name, "Nickname")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Nickname", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else if(!strcasecmp(iprop->name, "Children")) { @@ -193,7 +193,7 @@ else if(!strcasecmp(iprop->name, "Notes")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Note", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else if(!strcasecmp(iprop->name, "rid")) { @@ -210,22 +210,22 @@ else if(!strcasecmp(iprop->name, "Assistant")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Assistant", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else if(!strcasecmp(iprop->name, "Manager")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Manager", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else if(!strcasecmp(iprop->name, "Profession")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Profession", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else if(!strcasecmp(iprop->name, "JobTitle")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Role", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else { @@ -279,7 +279,7 @@ for(j=0;emailtokens[j]!=NULL;j++) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "EMail", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", emailtokens[j]); + osync_xmlfield_set_key_value(out_xmlfield, "Content", emailtokens[j], error); if(defaultemail) { if(!strcmp(emailtokens[j], defaultemail)) { osync_xmlfield_set_attr(out_xmlfield, "Preferred", "true"); @@ -292,7 +292,7 @@ } if(defaultemail) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "EMail", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", defaultemail); + osync_xmlfield_set_key_value(out_xmlfield, "Content", defaultemail, error); osync_xmlfield_set_attr(out_xmlfield, "Preferred", "true"); g_free(defaultemail); } @@ -304,11 +304,11 @@ xmlFreeDoc(idoc); // FIXME: remove this later by adding in a pre-sorted way? - osync_xmlformat_sort(out_xmlformat); + osync_xmlformat_sort(out_xmlformat, error); unsigned int size; char *str; - osync_xmlformat_assemble(out_xmlformat, &str, &size); + osync_xmlformat_assemble(out_xmlformat, &str, &size, error); osync_trace(TRACE_INTERNAL, "Output XMLFormat is:\n%s", str); g_free(str); @@ -345,7 +345,7 @@ OSyncXMLFormat *in_xmlformat = (OSyncXMLFormat *)input; unsigned int size; char *str; - osync_xmlformat_assemble(in_xmlformat, &str, &size); + osync_xmlformat_assemble(in_xmlformat, &str, &size, error); osync_trace(TRACE_INTERNAL, "Input XMLFormat is:\n%s", str); g_free(str); @@ -566,13 +566,13 @@ if(!strcasecmp(iprop->name, "Summary")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Summary", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else if(!strcasecmp(iprop->name, "Description")) { if(strlen(iprop->children->content)) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Description", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } } else if(!strcasecmp(iprop->name, "Priority")) @@ -581,13 +581,13 @@ int priority = atoi(iprop->children->content); char *prio = g_strdup_printf("%d", priority); out_xmlfield = osync_xmlfield_new(out_xmlformat, "Priority", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", prio); + osync_xmlfield_set_key_value(out_xmlfield, "Content", prio, error); g_free(prio); } else if(!strcasecmp(iprop->name, "Progress")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "PercentComplete", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else if(!strcasecmp(iprop->name, "State")) { @@ -608,12 +608,12 @@ status = "NEEDS-ACTION"; } out_xmlfield = osync_xmlfield_new(out_xmlformat, "Status", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", status); + osync_xmlfield_set_key_value(out_xmlfield, "Content", status, error); } else if(!strcasecmp(iprop->name, "StartDate")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "DateStarted", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); osync_xmlfield_set_attr(out_xmlfield, "Value", "DATE"); } else if(!strcasecmp(iprop->name, "Categories")) @@ -622,7 +622,7 @@ out_xmlfield = osync_xmlfield_new(out_xmlformat, "Categories", error); for(j=0;categorytokens[j]!=NULL;j++) { - osync_xmlfield_add_key_value(out_xmlfield, "Category", categorytokens[j]); + osync_xmlfield_add_key_value(out_xmlfield, "Category", categorytokens[j], error); } g_strfreev(categorytokens); } @@ -636,7 +636,7 @@ char *completeDate = xmlGetProp(icur, "CompletedDate"); if(completeDate) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Completed", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", completeDate); + osync_xmlfield_set_key_value(out_xmlfield, "Content", completeDate, error); // RFC2445 says the default value type is DATE-TIME. But Opie only // stores DATE as completed date => alter VALUE to DATE osync_xmlfield_set_attr(out_xmlfield, "Value", "DATE"); @@ -662,7 +662,7 @@ duedatestr = g_strdup_printf("%04d%02d%02d", dateyear, datemonth, dateday); duedate = g_date_new_dmy(dateday, datemonth, dateyear); out_xmlfield = osync_xmlfield_new(out_xmlformat, "Due", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", duedatestr); + osync_xmlfield_set_key_value(out_xmlfield, "Content", duedatestr, error); // RFC2445 says the default value type is DATE-TIME. But Opie only // stores DATE as due date => alter VALUE to DATE osync_xmlfield_set_attr(out_xmlfield, "Value", "DATE"); @@ -681,7 +681,7 @@ char *alarmstr = xmlGetProp(icur, "Alarms"); if(alarmstr && duedatestr) { char *duetimestr = g_strdup_printf("%sT000000", duedatestr); - time_t duetime = osync_time_vtime2unix(duetimestr, 0); + time_t duetime = osync_time_vtime2unix(duetimestr, 0, error); xml_todo_alarm_attr_to_xmlfield(alarmstr, out_xmlformat, &duetime, error); g_free(duetimestr); } @@ -701,11 +701,11 @@ xmlFreeDoc(idoc); // FIXME: remove this later by adding in a pre-sorted way? - osync_xmlformat_sort(out_xmlformat); + osync_xmlformat_sort(out_xmlformat, error); unsigned int size; char *str; - osync_xmlformat_assemble(out_xmlformat, &str, &size); + osync_xmlformat_assemble(out_xmlformat, &str, &size, error); osync_trace(TRACE_INTERNAL, "Output XMLFormat is:\n%s", str); g_free(str); @@ -733,7 +733,7 @@ OSyncXMLFormat *in_xmlformat = (OSyncXMLFormat *)input; unsigned int size; char *str; - osync_xmlformat_assemble(in_xmlformat, &str, &size); + osync_xmlformat_assemble(in_xmlformat, &str, &size, error); osync_trace(TRACE_INTERNAL, "Input XMLFormat is:\n%s", str); g_free(str); @@ -773,7 +773,7 @@ else if(!strcmp("Completed", fieldname)) { completedstr = osync_xmlfield_get_key_value(in_xmlfield, "Content"); if(completedstr) { - struct tm *completed = osync_time_vtime2tm(completedstr); + struct tm *completed = osync_time_vtime2tm(completedstr, error); char *completedstr_out = g_strdup_printf("%04d%02d%02d", completed->tm_year + 1900, (completed->tm_mon + 1), completed->tm_mday); xmlSetProp(on_todo, "Completed", "1"); xmlSetProp(on_todo, "CompletedDate", completedstr_out); @@ -784,7 +784,7 @@ else if(!strcmp("DateStarted", fieldname)) { startedstr = osync_xmlfield_get_key_value(in_xmlfield, "Content"); if(startedstr) { - struct tm *started = osync_time_vtime2tm(startedstr); + struct tm *started = osync_time_vtime2tm(startedstr, error); char *startedstr_out = g_strdup_printf("%04d%02d%02d", (started->tm_year + 1900), (started->tm_mon + 1), started->tm_mday); xmlSetProp(on_todo, "StartDate", startedstr_out); g_free(startedstr_out); @@ -794,7 +794,7 @@ else if(!strcmp("Due", fieldname)) { duestr = osync_xmlfield_get_key_value(in_xmlfield, "Content"); if(duestr) { - struct tm *due = osync_time_vtime2tm(duestr); + struct tm *due = osync_time_vtime2tm(duestr, error); char *dueyear = g_strdup_printf("%04d", (due->tm_year + 1900)); char *duemonth = g_strdup_printf("%02d", (due->tm_mon + 1)); char *dueday = g_strdup_printf("%02d", due->tm_mday); @@ -833,14 +833,14 @@ } } else if(!strcmp("RecurrenceRule", fieldname)) { - xmlfield_recur_to_attr(in_xmlfield, on_todo); + xmlfield_recur_to_attr(in_xmlfield, on_todo, error); } in_xmlfield = osync_xmlfield_get_next(in_xmlfield); } /* Convert alarms */ - xmlformat_todo_alarms_to_attr(in_xmlformat, on_todo, duestr); + xmlformat_todo_alarms_to_attr(in_xmlformat, on_todo, duestr, error); if(!completedstr) xmlSetProp(on_todo, "Completed", "0"); @@ -913,24 +913,24 @@ if(!strcasecmp(iprop->name, "description")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Summary", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else if(!strcasecmp(iprop->name, "note")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Description", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else if(!strcasecmp(iprop->name, "location")) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Location", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); } else if(!strcasecmp(iprop->name, "created")) { time_t createtime = (time_t)atoi(iprop->children->content); - char *createvtime = osync_time_unix2vtime(&createtime); + char *createvtime = osync_time_unix2vtime(&createtime, error); out_xmlfield = osync_xmlfield_new(out_xmlformat, "Created", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content); + osync_xmlfield_set_key_value(out_xmlfield, "Content", iprop->children->content, error); g_free(createvtime); } else if(!strcasecmp(iprop->name, "start")) @@ -941,14 +941,14 @@ struct tm *localtm = g_malloc0(sizeof(struct tm)); localtime_r(&starttime, localtm); char *startvdate = g_strdup_printf("%04d%02d%02d", localtm->tm_year + 1900, (localtm->tm_mon + 1), localtm->tm_mday); - osync_xmlfield_set_key_value(out_xmlfield, "Content", startvdate); + osync_xmlfield_set_key_value(out_xmlfield, "Content", startvdate, error); osync_xmlfield_set_attr(out_xmlfield, "Value", "DATE"); g_free(startvdate); g_free(localtm); } else { - char *startvtime = osync_time_unix2vtime(&starttime); - osync_xmlfield_set_key_value(out_xmlfield, "Content", startvtime); + char *startvtime = osync_time_unix2vtime(&starttime, error); + osync_xmlfield_set_key_value(out_xmlfield, "Content", startvtime, error); g_free(startvtime); } /* Record the start date for use later */ @@ -972,14 +972,14 @@ endtime += 1; localtime_r(&endtime, localtm); char *endvdate = g_strdup_printf("%04d%02d%02d", localtm->tm_year + 1900, (localtm->tm_mon + 1), localtm->tm_mday); - osync_xmlfield_set_key_value(out_xmlfield, "Content", endvdate); + osync_xmlfield_set_key_value(out_xmlfield, "Content", endvdate, error); osync_xmlfield_set_attr(out_xmlfield, "Value", "DATE"); g_free(endvdate); g_free(localtm); } else { - char *endvtime = osync_time_unix2vtime(&endtime); - osync_xmlfield_set_key_value(out_xmlfield, "Content", endvtime); + char *endvtime = osync_time_unix2vtime(&endtime, error); + osync_xmlfield_set_key_value(out_xmlfield, "Content", endvtime, error); g_free(endvtime); } } @@ -989,7 +989,7 @@ out_xmlfield = osync_xmlfield_new(out_xmlformat, "Categories", error); for(j=0;categorytokens[j]!=NULL;j++) { - osync_xmlfield_add_key_value(out_xmlfield, "Category", categorytokens[j]); + osync_xmlfield_add_key_value(out_xmlfield, "Category", categorytokens[j], error); } g_strfreev(categorytokens); } @@ -1012,13 +1012,13 @@ xmlFree(alarmsoundstr); } if(alarmsound == 1) - osync_xmlfield_set_key_value(out_xmlfield, "AlarmAction", "AUDIO"); + osync_xmlfield_set_key_value(out_xmlfield, "AlarmAction", "AUDIO", error); else - osync_xmlfield_set_key_value(out_xmlfield, "AlarmAction", "DISPLAY"); + osync_xmlfield_set_key_value(out_xmlfield, "AlarmAction", "DISPLAY", error); int alarmseconds = -(atoi(alarmminsstr) * 60); char *alarmdu = osync_time_sec2alarmdu(alarmseconds); - osync_xmlfield_set_key_value(out_xmlfield, "AlarmTrigger", alarmdu); + osync_xmlfield_set_key_value(out_xmlfield, "AlarmTrigger", alarmdu, error); g_free(alarmdu); xmlFree(alarmminsstr); } @@ -1034,11 +1034,11 @@ xmlFreeDoc(idoc); // FIXME: remove this later by adding in a pre-sorted way? - osync_xmlformat_sort(out_xmlformat); + osync_xmlformat_sort(out_xmlformat, error); unsigned int size; char *str; - osync_xmlformat_assemble(out_xmlformat, &str, &size); + osync_xmlformat_assemble(out_xmlformat, &str, &size, error); osync_trace(TRACE_INTERNAL, "Output XMLFormat is:\n%s", str); g_free(str); @@ -1066,7 +1066,7 @@ OSyncXMLFormat *in_xmlformat = (OSyncXMLFormat *)input; unsigned int size; char *str; - osync_xmlformat_assemble(in_xmlformat, &str, &size); + osync_xmlformat_assemble(in_xmlformat, &str, &size, error); osync_trace(TRACE_INTERNAL, "Input XMLFormat is:\n%s", str); g_free(str); @@ -1087,19 +1087,19 @@ xmlfield_key_to_attr(in_xmlfield, "Content", on_event, "location"); } else if(!strcmp("Created", fieldname)) { - xmlfield_vtime_to_attr_time_t(in_xmlfield, on_event, "created"); + xmlfield_vtime_to_attr_time_t(in_xmlfield, on_event, "created", error); } else if(!strcmp("DateStarted", fieldname)) { - start_time = xmlfield_vtime_to_attr_time_t(in_xmlfield, on_event, "start"); + start_time = xmlfield_vtime_to_attr_time_t(in_xmlfield, on_event, "start", error); } else if(!strcmp("DateEnd", fieldname)) { - end_time = xmlfield_vtime_to_attr_time_t(in_xmlfield, on_event, "end"); + end_time = xmlfield_vtime_to_attr_time_t(in_xmlfield, on_event, "end", error); } else if(!strcmp("Categories", fieldname)) { xmlfield_categories_to_attr(in_xmlfield, on_event, "Categories"); } else if(!strcmp("RecurrenceRule", fieldname)) { - xmlfield_recur_to_attr(in_xmlfield, on_event); + xmlfield_recur_to_attr(in_xmlfield, on_event, error); } in_xmlfield = osync_xmlfield_get_next(in_xmlfield); @@ -1170,14 +1170,14 @@ char *value = xmlGetProp(icur, "name"); if(value) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Summary", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", value); + osync_xmlfield_set_key_value(out_xmlfield, "Content", value, error); xmlFree(value); } // Description value = xmlNodeGetContent(icur); if(value) { out_xmlfield = osync_xmlfield_new(out_xmlformat, "Description", error); - osync_xmlfield_set_key_value(out_xmlfield, "Content", value); + osync_xmlfield_set_key_value(out_xmlfield, "Content", value, error); xmlFree(value); } } @@ -1189,11 +1189,11 @@ xmlFreeDoc(idoc); // FIXME: remove this later by adding in a pre-sorted way? - osync_xmlformat_sort(out_xmlformat); + osync_xmlformat_sort(out_xmlformat, error); unsigned int size; char *str; - osync_xmlformat_assemble(out_xmlformat, &str, &size); + osync_xmlformat_assemble(out_xmlformat, &str, &size, error); osync_trace(TRACE_INTERNAL, "Output XMLFormat is:\n%s", str); g_free(str); @@ -1218,7 +1218,7 @@ OSyncXMLFormat *in_xmlformat = (OSyncXMLFormat *)input; unsigned int size; char *str; - osync_xmlformat_assemble(in_xmlformat, &str, &size); + osync_xmlformat_assemble(in_xmlformat, &str, &size, error); osync_trace(TRACE_INTERNAL, "Input XMLFormat is:\n%s", str); g_free(str); @@ -1266,28 +1266,28 @@ osync_objformat_set_destroy_func(format, destroy_format1); osync_objformat_set_duplicate_func(format, duplicate_format1); osync_objformat_set_print_func(format, print_format1);*/ - osync_format_env_register_objformat(env, format); + osync_format_env_register_objformat(env, format, error); osync_objformat_unref(format); /* Todo */ format = osync_objformat_new(OPIE_FORMAT_XML_TODO, "todo", error); if (!format) return FALSE; - osync_format_env_register_objformat(env, format); + osync_format_env_register_objformat(env, format, error); osync_objformat_unref(format); /* Event */ format = osync_objformat_new(OPIE_FORMAT_XML_EVENT, "event", error); if (!format) return FALSE; - osync_format_env_register_objformat(env, format); + osync_format_env_register_objformat(env, format, error); osync_objformat_unref(format); /* Note */ format = osync_objformat_new(OPIE_FORMAT_XML_NOTE, "note", error); if (!format) return FALSE; - osync_format_env_register_objformat(env, format); + osync_format_env_register_objformat(env, format, error); osync_objformat_unref(format); return TRUE; @@ -1356,19 +1356,19 @@ xmlSetProp(node_to, attrname, value); } -time_t xmlfield_vtime_to_attr_time_t(OSyncXMLField *xmlfield, xmlNode *node_to, const char *attrname) { +time_t xmlfield_vtime_to_attr_time_t(OSyncXMLField *xmlfield, xmlNode *node_to, const char *attrname, OSyncError **error) { const char *vtime = osync_xmlfield_get_key_value(xmlfield, "Content"); time_t utime = 0; if(vtime) { const char *vtimetype = osync_xmlfield_get_attr(xmlfield, "Value"); if(vtimetype && !strcasecmp(vtimetype, "DATE")) { /* vtime has date but no time, so we treat it as midnight local time */ - struct tm *localtm = osync_time_vtime2tm(vtime); + struct tm *localtm = osync_time_vtime2tm(vtime, error); utime = mktime(localtm); g_free(localtm); } else - utime = osync_time_vtime2unix(vtime, 0); + utime = osync_time_vtime2unix(vtime, 0, error); char *timestr = g_strdup_printf("%d", (int)utime); xmlSetProp(node_to, attrname, timestr); @@ -1389,7 +1389,7 @@ char *key = (char *)(keysptr->data); if(!out_xmlfield) out_xmlfield = osync_xmlfield_new(out_xmlformat, fieldname, error); - osync_xmlfield_set_key_value(out_xmlfield, key, value); + osync_xmlfield_set_key_value(out_xmlfield, key, value, error); xmlFree(value); } @@ -1439,10 +1439,10 @@ /* Frequency */ if(!strcmp(recurType, "Daily")) { - osync_xmlfield_set_key_value(out_xmlfield, "Frequency", "DAILY"); + osync_xmlfield_set_key_value(out_xmlfield, "Frequency", "DAILY", error); } else if(!strcmp(recurType, "Weekly")) { - osync_xmlfield_set_key_value(out_xmlfield, "Frequency", "WEEKLY"); + osync_xmlfield_set_key_value(out_xmlfield, "Frequency", "WEEKLY", error); /* Weekdays */ char *weekdays = xmlGetProp(item_node, "rweekdays"); @@ -1469,22 +1469,22 @@ /* Remove the trailing comma */ g_string_truncate(byday, strlen(byday->str) - 1); - osync_xmlfield_set_key_value(out_xmlfield, "ByDay", byday->str); + osync_xmlfield_set_key_value(out_xmlfield, "ByDay", byday->str, error); g_string_free(byday, TRUE); } xmlFree(weekdays); } } else if(!strcmp(recurType, "MonthlyDate")) { - osync_xmlfield_set_key_value(out_xmlfield, "Frequency", "MONTHLY"); + osync_xmlfield_set_key_value(out_xmlfield, "Frequency", "MONTHLY", error); if(startdate) { char *bymonthday = g_strdup_printf("%i", (int)g_date_get_day(startdate)); - osync_xmlfield_set_key_value(out_xmlfield, "ByMonthDay", bymonthday); + osync_xmlfield_set_key_value(out_xmlfield, "ByMonthDay", bymonthday, error); g_free(bymonthday); } } else if(!strcmp(recurType, "MonthlyDay")) { - osync_xmlfield_set_key_value(out_xmlfield, "Frequency", "MONTHLY"); + osync_xmlfield_set_key_value(out_xmlfield, "Frequency", "MONTHLY", error); if(startdate) { int weekno; char *weeknostr = xmlGetProp(item_node, "rposition"); @@ -1524,19 +1524,19 @@ break; } if(byday) { - osync_xmlfield_set_key_value(out_xmlfield, "ByDay", byday); + osync_xmlfield_set_key_value(out_xmlfield, "ByDay", byday, error); g_free(byday); } } } else if(!strcmp(recurType, "Yearly")) { - osync_xmlfield_set_key_value(out_xmlfield, "Frequency", "YEARLY"); + osync_xmlfield_set_key_value(out_xmlfield, "Frequency", "YEARLY", error); } /* Interval */ char *interval = xmlGetProp(item_node, "rfreq"); if(interval) { - osync_xmlfield_set_key_value(out_xmlfield, "Interval", interval); + osync_xmlfield_set_key_value(out_xmlfield, "Interval", interval, error); xmlFree(interval); } @@ -1546,8 +1546,8 @@ char *recurendstr = xmlGetProp(item_node, "enddt"); if(recurendstr) { time_t recurendtime = (time_t)atoi(recurendstr); - char *recurendvtime = osync_time_unix2vtime(&recurendtime); - osync_xmlfield_set_key_value(out_xmlfield, "Until", recurendvtime); + char *recurendvtime = osync_time_unix2vtime(&recurendtime, error); + osync_xmlfield_set_key_value(out_xmlfield, "Until", recurendvtime, error); g_free(recurendvtime); xmlFree(recurendstr); } @@ -1557,7 +1557,7 @@ } } -void xmlfield_recur_to_attr(OSyncXMLField *in_xmlfield, xmlNode *node_to) { +void xmlfield_recur_to_attr(OSyncXMLField *in_xmlfield, xmlNode *node_to, OSyncError **error) { /* Recurrence for todos and events */ char *enddt = NULL; char *weekdaysrule = NULL; @@ -1606,7 +1606,7 @@ rfreq = g_strdup(keyvalue); } else if (!strcasecmp(keyname, "UNTIL")) { - time_t utime = osync_time_vtime2unix(keyvalue, 0); + time_t utime = osync_time_vtime2unix(keyvalue, 0, error); enddt = g_strdup_printf("%d", (int)utime); } } @@ -1711,20 +1711,20 @@ g_strfreev(alarmargs); if(alarmsound == 1) - osync_xmlfield_set_key_value(out_xmlfield, "AlarmAction", "AUDIO"); + osync_xmlfield_set_key_value(out_xmlfield, "AlarmAction", "AUDIO", error); else - osync_xmlfield_set_key_value(out_xmlfield, "AlarmAction", "DISPLAY"); + osync_xmlfield_set_key_value(out_xmlfield, "AlarmAction", "DISPLAY", error); if(alarmdatestr) { - struct tm *alarmtm = osync_time_vtime2tm(alarmdatestr); + struct tm *alarmtm = osync_time_vtime2tm(alarmdatestr, error); time_t alarmtime = mktime(alarmtm); g_free(alarmtm); - char *alarmdatestr_utc = osync_time_unix2vtime(&alarmtime); + char *alarmdatestr_utc = osync_time_unix2vtime(&alarmtime, error); if(starttime) { char *alarmdu = osync_time_sec2alarmdu((int)difftime(alarmtime, *starttime)); if(alarmdu) { - osync_xmlfield_set_key_value(out_xmlfield, "AlarmTrigger", alarmdu); + osync_xmlfield_set_key_value(out_xmlfield, "AlarmTrigger", alarmdu, error); g_free(alarmdu); } } @@ -1737,7 +1737,7 @@ } } -void xmlformat_todo_alarms_to_attr(OSyncXMLFormat *in_xmlformat, xmlNode *node_to, const char *duedate) { +void xmlformat_todo_alarms_to_attr(OSyncXMLFormat *in_xmlformat, xmlNode *node_to, const char *duedate, OSyncError **error) { /* Convert OpenSync XML Alarm entries on a todo node to Opie Alarms attribute value */ GString *alarms = g_string_new(""); @@ -1754,7 +1754,7 @@ if(duedate) { int alarmdiff = osync_time_alarmdu2sec(trigger); - alarmtm = osync_time_vtime2tm(duedate); + alarmtm = osync_time_vtime2tm(duedate, error); alarmtime = timegm(alarmtm); alarmtime += alarmdiff; } Modified: plugins/opie-sync/src/opie_format.h ============================================================================== --- plugins/opie-sync/src/opie_format.h Tue Sep 22 09:28:11 2009 (r5835) +++ plugins/opie-sync/src/opie_format.h Thu Sep 24 23:29:56 2009 (r5836) @@ -28,15 +28,15 @@ void xmlfield_key_to_attr(OSyncXMLField *xmlfield, const char *key, xmlNode *node_to, const char *attrname); void xmlfield_uid_to_attr(OSyncXMLField *xmlfield, xmlNode *node_to); void xml_uid_attr_to_xmlfield(const char *uid, const char *nodename, OSyncXMLFormat *out_xmlformat, OSyncError **error); -time_t xmlfield_vtime_to_attr_time_t(OSyncXMLField *xmlfield, xmlNode *node_to, const char *attrname); +time_t xmlfield_vtime_to_attr_time_t(OSyncXMLField *xmlfield, xmlNode *node_to, const char *attrname, OSyncError **error); OSyncXMLField *xml_attrs_to_xmlfield_keys(xmlNode *node, OSyncXMLFormat *out_xmlformat, const char *fieldname, GSList *attrs, GSList *keys, OSyncError **error); void dual_list_append(GSList **list1, void *item1, GSList **list2, void *item2); void dual_list_clear(GSList **list1, GSList **list2); void xmlfield_categories_to_attr(OSyncXMLField *in_xmlfield, xmlNode *node_to, const char *category_attr); void xml_recur_attr_to_xmlfield(xmlNode *item_node, OSyncXMLFormat *out_xmlformat, GDate *startdate, OSyncError **error); -void xmlfield_recur_to_attr(OSyncXMLField *in_xmlfield, xmlNode *node_to); +void xmlfield_recur_to_attr(OSyncXMLField *in_xmlfield, xmlNode *node_to, OSyncError **error); void xml_todo_alarm_attr_to_xmlfield(const char *alarmstr, OSyncXMLFormat *out_xmlformat, time_t *starttime, OSyncError **error); -void xmlformat_todo_alarms_to_attr(OSyncXMLFormat *in_xmlformat, xmlNode *node_to, const char *duedate); +void xmlformat_todo_alarms_to_attr(OSyncXMLFormat *in_xmlformat, xmlNode *node_to, const char *duedate, OSyncError **error); void xmlformat_cal_alarms_to_attr(OSyncXMLFormat *in_xmlformat, xmlNode *node_to, time_t *starttime); #endif /* _OPIE_FORMAT_H */ |