You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
(56) |
Apr
(109) |
May
(15) |
Jun
(3) |
Jul
(37) |
Aug
(96) |
Sep
(40) |
Oct
(4) |
Nov
(54) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(47) |
Feb
(30) |
Mar
(102) |
Apr
(120) |
May
(68) |
Jun
(54) |
Jul
(53) |
Aug
(122) |
Sep
(190) |
Oct
(71) |
Nov
(85) |
Dec
(108) |
2007 |
Jan
(72) |
Feb
(190) |
Mar
(53) |
Apr
(101) |
May
(145) |
Jun
(148) |
Jul
(167) |
Aug
(143) |
Sep
(23) |
Oct
(198) |
Nov
(223) |
Dec
(195) |
2008 |
Jan
(100) |
Feb
(129) |
Mar
(79) |
Apr
(77) |
May
(34) |
Jun
(95) |
Jul
(112) |
Aug
(160) |
Sep
(82) |
Oct
(124) |
Nov
(199) |
Dec
(355) |
2009 |
Jan
(436) |
Feb
(89) |
Mar
(298) |
Apr
(189) |
May
(33) |
Jun
(88) |
Jul
(105) |
Aug
(44) |
Sep
(181) |
Oct
(87) |
Nov
(75) |
Dec
(1) |
2010 |
Jan
(63) |
Feb
(21) |
Mar
(3) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(26) |
Aug
(37) |
Sep
(26) |
Oct
(15) |
Nov
(13) |
Dec
|
From: <svn...@op...> - 2010-08-14 00:24:27
|
Author: cdfrey Date: Sat Aug 14 02:24:19 2010 New Revision: 6091 URL: http://www.opensync.org/changeset/6091 Log: Oops... opensync.sym is sorted, fixed so test will pass Modified: trunk/opensync.sym Modified: trunk/opensync.sym ============================================================================== --- trunk/opensync.sym Sat Aug 14 02:12:27 2010 (r6090) +++ trunk/opensync.sym Sat Aug 14 02:24:19 2010 (r6091) @@ -576,9 +576,9 @@ osync_plugin_externalplugin_set_external_command osync_plugin_externalplugin_unref osync_plugin_finalize -osync_plugin_get_default_configdir osync_plugin_get_config_type osync_plugin_get_data +osync_plugin_get_default_configdir osync_plugin_get_description osync_plugin_get_longname osync_plugin_get_name |
From: <svn...@op...> - 2010-08-14 00:12:36
|
Author: cdfrey Date: Sat Aug 14 02:12:27 2010 New Revision: 6090 URL: http://www.opensync.org/changeset/6090 Log: Do not strip out the dashes related to timezone offsets With a string such as "2010-05-01T03:15:00.000-03:00", the previous version of the function would remove the dash from the "-03:00" timezone offset. This is not correct. Modified: trunk/opensync/format/opensync_time.c Modified: trunk/opensync/format/opensync_time.c ============================================================================== --- trunk/opensync/format/opensync_time.c Sat Aug 14 01:00:51 2010 (r6089) +++ trunk/opensync/format/opensync_time.c Sat Aug 14 02:12:27 2010 (r6090) @@ -71,13 +71,16 @@ static char *osync_time_timestamp_remove_dash(const char *timestamp) { - int i, len; + int i, len, date; GString *str = g_string_new(""); len = strlen(timestamp); - for (i=0; i < len; i++) { - if (timestamp[i] == '-') + for (i=0, date=1; i < len; i++) { + if (timestamp[i] == 'T') + date = 0; + + if (date && timestamp[i] == '-') continue; if (timestamp[i] == ':') |
From: <svn...@op...> - 2010-08-13 23:00:59
|
Author: cdfrey Date: Sat Aug 14 01:00:51 2010 New Revision: 6089 URL: http://www.opensync.org/changeset/6089 Log: Major cleanup of calendar change code, both get and commit Fixed url / id bug in commit() Fixed ADD / MODIFY / DELETE logic Added state_db entries for every calendar entry, in order to track whether we've seen this item before or not... surely there is a better way, since this method will cause the state_db to grow, and contain an entry for every ID ever seen. Other logic improvements and fixes Modified: plugins/google-calendar/src/gcalendar.c Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Sat Aug 14 01:00:45 2010 (r6088) +++ plugins/google-calendar/src/gcalendar.c Sat Aug 14 01:00:51 2010 (r6089) @@ -22,8 +22,7 @@ */ /* TODO: - * - find a way to report changes to opensync and make it work - * - review code for leaks (I'm not sure if I'm using opensync API correctly...) + * - review code for leaks * */ @@ -324,7 +323,6 @@ { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); struct gc_plgdata *plgdata = data; - char slow_sync_flag = 0; OSyncError *error = NULL; OSyncData *odata = NULL; OSyncChange *chg = NULL; @@ -332,29 +330,26 @@ char *timestamp = NULL, *msg = NULL, *raw_xml = NULL; gcal_event_t event; OSyncError *state_db_error = NULL; + OSyncSinkStateDB *state_db = NULL; - if (!(osync_objtype_sink_get_state_db(sink))) + state_db = osync_objtype_sink_get_state_db(sink); + if( !state_db ) goto error; - timestamp = osync_sink_state_get(osync_objtype_sink_get_state_db(sink), - "cal_timestamp", &state_db_error); + timestamp = osync_sink_state_get(state_db, "cal_timestamp", + &state_db_error); if (!timestamp) { msg = "gcalendar: Anchor returned is NULL!"; goto error; } - if (strlen(timestamp) > 0) - osync_trace(TRACE_INTERNAL, "timestamp is: %s\n", timestamp); - else - osync_trace(TRACE_INTERNAL, "first sync!\n"); + osync_trace(TRACE_INTERNAL, "timestamp is: '%s'\n", timestamp); - if (slow_sync) { - osync_trace(TRACE_INTERNAL, "\n\t\tgcal: Client asked for slow syncing...\n"); - slow_sync_flag = 1; + if (slow_sync || strlen(timestamp) == 0) { + osync_trace(TRACE_INTERNAL, "\n\t\tgcal: slow sync, or first time\n"); result = gcal_get_events(plgdata->calendar, &(plgdata->all_events)); } else { - osync_trace(TRACE_INTERNAL, "\n\t\tgcal: Client asked for fast syncing...\n"); result = gcal_get_updated_events(plgdata->calendar, &(plgdata->all_events), timestamp); @@ -374,9 +369,9 @@ plgdata->all_events.length); } - // Calendar returns most recently updated event as first element for (i = 0; i < plgdata->all_events.length; ++i) { + // grab the next event object event = gcal_event_element(&(plgdata->all_events), i); if (!event) { osync_trace(TRACE_INTERNAL, "Cannot access updated event %d", i); @@ -394,54 +389,94 @@ } } + // are we done yet? libgcal includes the entry with the + // given timestamp, so if the timestamp of this event + // is <= to the timestamp we asked for, then we're done + if( !slow_sync && timestamp_cmp(gcal_event_get_updated(event), timestamp) <= 0 ) + break; + osync_trace(TRACE_INTERNAL, "gevent: timestamp:%s\tevent:%s\n", timestamp, gcal_event_get_updated(event)); - // Workaround for inclusive returned results - if ((timestamp_cmp(timestamp, gcal_event_get_updated(event)) == 0) - && !slow_sync_flag - && !gcal_event_is_deleted(event)) { - osync_trace(TRACE_INTERNAL, "gevent: old event."); - continue; - } else - osync_trace(TRACE_INTERNAL, "gevent: new or deleted event!"); - raw_xml = gcal_event_get_xml(event); - if ((result = xslt_transform(plgdata->xslt_ctx_gcal, - raw_xml))) - goto error; + // grab ID for current change... this is a Google URL + const char *id = gcal_event_get_id(event); - raw_xml = (char*) plgdata->xslt_ctx_gcal->xml_str; - odata = osync_data_new(strdup(raw_xml), - strlen(raw_xml), - plgdata->gcal_format, &error); - if (!odata) - goto cleanup; + // determine changetype - we do not use osync_hashtable here + // because I believe that requires us to download all + // events in order to feed the timestamp to the hashtable + // function... hashtable is more suited to a local access, + // instead of internet access. + OSyncChangeType ct = OSYNC_CHANGE_TYPE_UNKNOWN; + if( gcal_event_is_deleted(event) ) { + ct = OSYNC_CHANGE_TYPE_DELETED; + if( !osync_sink_state_set(state_db, id, "0", &state_db_error) ) { + msg = "Error setting state_db for id"; + goto error; + } + if( slow_sync ) { + // in slow sync mode, we don't care about + // deleted objects + continue; + } + } + else { + // not deleted, so either ADDED or MODIFIED... + // check state_db for id to see if we've seen this + // one before + const char *seen = osync_sink_state_get(state_db, + id, &state_db_error); + if( !seen ) { + msg = "sink_state_get returned NULL"; + goto error; + } - if (!(chg = osync_change_new(&error))) - goto cleanup; - osync_data_set_objtype(odata, osync_objtype_sink_get_name(sink)); - osync_change_set_data(chg, odata); - osync_data_unref(odata); + if( !slow_sync && seen[0] == '1' ) { + // we've seen this object before + ct = OSYNC_CHANGE_TYPE_MODIFIED; + } + else { + ct = OSYNC_CHANGE_TYPE_ADDED; + } + } - osync_change_set_uid(chg, gcal_event_get_id(event)); + // create change object + chg = osync_change_new(&error); + if( !chg ) + goto cleanup; -//FIXME - add hashtable support here, and let it determine the changetype, -//similar to barry-sync. + // setup the change + osync_change_set_uid(chg, id); + osync_change_set_hash(chg, gcal_event_get_updated(event)); + osync_change_set_changetype(chg, ct); + + // fill in the data + if( ct != OSYNC_CHANGE_TYPE_DELETED ) { + raw_xml = gcal_event_get_xml(event); + if( xslt_transform(plgdata->xslt_ctx_gcal, raw_xml) ) { + osync_change_unref(chg); + goto error; + } - if (slow_sync_flag) - osync_change_set_changetype(chg, OSYNC_CHANGE_TYPE_ADDED); - else - if (gcal_event_is_deleted(event)) { - osync_change_set_changetype(chg, OSYNC_CHANGE_TYPE_DELETED); - osync_trace(TRACE_INTERNAL, "deleted entry!"); + raw_xml = (char*) plgdata->xslt_ctx_gcal->xml_str; + odata = osync_data_new(strdup(raw_xml), + strlen(raw_xml), + plgdata->gcal_format, &error); + if( !odata ) { + osync_change_unref(chg); + goto cleanup; } - else - osync_change_set_changetype(chg, OSYNC_CHANGE_TYPE_MODIFIED); + + osync_data_set_objtype(odata, + osync_objtype_sink_get_name(sink)); + osync_change_set_data(chg, odata); + osync_data_unref(odata); + } osync_context_report_change(ctx, chg); osync_change_unref(chg); } + exit: // osync_sink_state_get uses osync_strdup osync_free(timestamp); @@ -613,75 +648,108 @@ osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, data); osync_trace(TRACE_INTERNAL, "hello, from calendar!\n"); - //OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); struct gc_plgdata *plgdata = data; gcal_event_t event = NULL; unsigned int size; int result; char *osync_xml = NULL, *msg = NULL, *raw_xml = NULL, *updated_event = NULL; OSyncData *odata = NULL; + OSyncError *state_db_error = NULL; + OSyncSinkStateDB *state_db = NULL; + + state_db = osync_objtype_sink_get_state_db(sink); + if( !state_db ) + msg = "Cannot start state_db!"; + goto error; - if (!(odata = osync_change_get_data(change))) { + odata = osync_change_get_data(change); + if( !odata ) { msg = "Cannot get raw data from change obj!\n"; goto error; } osync_data_get_data(odata, &osync_xml, &size); - if (!osync_xml) { + if( !osync_xml ) { msg = "Failed getting xml from xmlobj!\n"; goto error; } // Convert to gdata format - if ((result = xslt_transform(plgdata->xslt_ctx_gcal, osync_xml))) { + result = xslt_transform(plgdata->xslt_ctx_gcal, osync_xml); + if( result ) { msg = "Failed converting from osync xmlevent to gcalendar\n"; goto error; } + raw_xml = vtime2gtime( (char*) plgdata->xslt_ctx_gcal->xml_str ); osync_trace(TRACE_EXIT, "osync: %s\ngcont: %s\n\n", osync_xml, raw_xml); - switch (osync_change_get_changetype(change)) { - case OSYNC_CHANGE_TYPE_ADDED: - result = gcal_add_xmlentry(plgdata->calendar, raw_xml, &updated_event); - if (result == -1) { - msg = "Failed adding new event!\n"; - result = gcal_status_httpcode(plgdata->calendar); - goto error; - } + switch( osync_change_get_changetype(change) ) + { + case OSYNC_CHANGE_TYPE_ADDED: + result = gcal_add_xmlentry(plgdata->calendar, raw_xml, + &updated_event); + if( result == -1 ) { + msg = "Failed adding new event!\n"; + result = gcal_status_httpcode(plgdata->calendar); + goto error; + } - if (!(event = gcal_event_new(updated_event))) { - msg = "Failed recovering updated fields!\n"; - goto error; - } + event = gcal_event_new(updated_event); + if( !event ) { + msg = "Failed recovering updated fields!\n"; + goto error; + } + + // mark this as "seen" + if( !osync_sink_state_set(state_db, gcal_event_get_id(event), "1", &state_db_error) ) { + msg = "Error setting added state"; + goto error; + } break; - case OSYNC_CHANGE_TYPE_MODIFIED: - result = gcal_update_xmlentry(plgdata->calendar, - raw_xml, &updated_event, NULL, NULL); - if (result == -1) { - msg = "Failed editing event!\n"; - goto error; - } + case OSYNC_CHANGE_TYPE_MODIFIED: + result = gcal_update_xmlentry(plgdata->calendar, raw_xml, + &updated_event, NULL, NULL); + if( result == -1 ) { + msg = "Failed editing event!\n"; + goto error; + } - if (!(event = gcal_event_new(updated_event))) { - msg = "Failed recovering updated fields!\n"; - goto error; - } - break; + event = gcal_event_new(updated_event); + if( !event ) { + msg = "Failed recovering updated fields!\n"; + goto error; + } - case OSYNC_CHANGE_TYPE_DELETED: - result = gcal_erase_xmlentry(plgdata->calendar, raw_xml); - if (result == -1) { - msg = "Failed deleting event!\n"; - goto error; - } + // mark this as "seen" + if( !osync_sink_state_set(state_db, gcal_event_get_id(event), "1", &state_db_error) ) { + msg = "Error setting modified state"; + goto error; + } break; - default: - osync_context_report_error(ctx, OSYNC_ERROR_NOT_SUPPORTED, - "Unknown change type"); + case OSYNC_CHANGE_TYPE_DELETED: + result = gcal_erase_xmlentry(plgdata->calendar, raw_xml); + if( result == -1 ) { + msg = "Failed deleting event!\n"; + goto error; + } + + // mark this as "unseen" + if( !osync_sink_state_set(state_db, + osync_change_get_uid(change), "0", &state_db_error) ) + { + msg = "Error setting modified state"; goto error; + } + break; + + default: + osync_context_report_error(ctx, OSYNC_ERROR_NOT_SUPPORTED, + "Unknown change type"); + goto error; break; } @@ -690,17 +758,25 @@ if (event) { // update the timestamp - if (plgdata->cal_timestamp) - free(plgdata->cal_timestamp); - plgdata->cal_timestamp = strdup(gcal_event_get_updated(event)); + if( plgdata->cal_timestamp ) { + // only if newer + if( timestamp_cmp(gcal_event_get_updated(event), plgdata->cal_timestamp) > 0 ) { + free(plgdata->cal_timestamp); + plgdata->cal_timestamp = strdup(gcal_event_get_updated(event)); + } + } + else { + plgdata->cal_timestamp = strdup(gcal_event_get_updated(event)); + } + + // error check if (!plgdata->cal_timestamp) { msg = "Failed copying contact timestamp!\n"; goto error; } - // FIXME: not sure if this works // Inform the new ID - osync_change_set_uid(change, gcal_event_get_url(event)); + osync_change_set_uid(change, gcal_event_get_id(event)); gcal_event_delete(event); } |
From: <svn...@op...> - 2010-08-13 23:00:53
|
Author: cdfrey Date: Sat Aug 14 01:00:45 2010 New Revision: 6088 URL: http://www.opensync.org/changeset/6088 Log: Changed uid from gcal's url to its id Hopefully we can use this same ID later when re-building the XML to feed into Google Calendar Modified: plugins/google-calendar/src/gcalendar.c Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Sat Aug 14 01:00:39 2010 (r6087) +++ plugins/google-calendar/src/gcalendar.c Sat Aug 14 01:00:45 2010 (r6088) @@ -423,7 +423,7 @@ osync_change_set_data(chg, odata); osync_data_unref(odata); - osync_change_set_uid(chg, gcal_event_get_url(event)); + osync_change_set_uid(chg, gcal_event_get_id(event)); //FIXME - add hashtable support here, and let it determine the changetype, //similar to barry-sync. @@ -563,7 +563,7 @@ osync_change_set_data(chg, odata); osync_data_unref(odata); - osync_change_set_uid(chg, gcal_contact_get_url(contact)); + osync_change_set_uid(chg, gcal_contact_get_id(contact)); if (slow_sync_flag) osync_change_set_changetype(chg, OSYNC_CHANGE_TYPE_ADDED); |
From: <svn...@op...> - 2010-08-13 23:00:46
|
Author: cdfrey Date: Sat Aug 14 01:00:39 2010 New Revision: 6087 URL: http://www.opensync.org/changeset/6087 Log: Added vtime2gtime(): convert osync's timestamp into something Google accepts Modified: plugins/google-calendar/src/gcalendar.c Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Sat Aug 14 01:00:33 2010 (r6086) +++ plugins/google-calendar/src/gcalendar.c Sat Aug 14 01:00:39 2010 (r6087) @@ -43,6 +43,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <ctype.h> #include <sys/types.h> #include <signal.h> #include <sys/wait.h> @@ -107,6 +108,95 @@ } +const char* findstr(const char *data, const char *format) +{ + const char *match = format; + const char *start = data; + + while( *data && *match ) { + int matched = 0; + + switch( *match ) + { + case '9': + matched = isdigit(*data); + break; + default: + matched = (*data == *match); + break; + } + + if( matched ) { + data++; + match++; + if( *match == 0 ) + return start; + } + else { + data++; + start = data; + match = format; + } + } + + return data; +} + +// vtime2gtime +// +// Searches through data, converting every vtime string it finds into +// a timestamp compatible with Google. i.e. it converts time in the +// format: YYYYMMDDTHHMMSSZ to YYYY-MM-DDTHH:MM:SSZ +// +// Caller is responsible for freeing the returned string. +// +char* vtime2gtime(const char *data) +{ + char *ret = malloc(strlen(data) * 2); + char *target = ret; + + while( *data ) { + // search for YYYYMMDDTHHMMSS + const char *match = findstr(data, "99999999T999999"); + + // copy the non-matching data + memcpy(target, data, match - data); + target += match - data; + + // was there a match? + if( *match ) { + // adjust the timestamp + target[0] = match[0]; + target[1] = match[1]; + target[2] = match[2]; + target[3] = match[3]; + target[4] = '-'; + target[5] = match[4]; + target[6] = match[5]; + target[7] = '-'; + target[8] = match[6]; + target[9] = match[7]; + target[10] = match[8]; + target[11] = match[9]; + target[12] = match[10]; + target[13] = ':'; + target[14] = match[11]; + target[15] = match[12]; + target[16] = ':'; + target[17] = match[13]; + target[18] = match[14]; + target += 19; + data = match + 15; + } + else { + data = match; + } + } + *target = 0; + return ret; +} + + struct gc_plgdata { char *url; @@ -547,7 +637,7 @@ msg = "Failed converting from osync xmlevent to gcalendar\n"; goto error; } - raw_xml = (char*) plgdata->xslt_ctx_gcal->xml_str; + raw_xml = vtime2gtime( (char*) plgdata->xslt_ctx_gcal->xml_str ); osync_trace(TRACE_EXIT, "osync: %s\ngcont: %s\n\n", osync_xml, raw_xml); @@ -624,6 +714,8 @@ error: if (updated_event) free(updated_event); + if (raw_xml) + free(raw_xml); osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, msg); osync_trace(TRACE_EXIT, "%s:%sHTTP code: %d", __func__, msg, result); @@ -660,7 +752,7 @@ msg = "Failed converting from osync xmlcontact to gcontact\n"; goto error; } - raw_xml = (char*) plgdata->xslt_ctx_gcont->xml_str; + raw_xml = vtime2gtime( (char*) plgdata->xslt_ctx_gcont->xml_str ); osync_trace(TRACE_INTERNAL, "osync: %s\ngcont: %s\n\n", osync_xml, raw_xml); @@ -737,6 +829,8 @@ error: if (updated_contact) free(updated_contact); + if (raw_xml) + free(raw_xml); osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, msg); osync_trace(TRACE_EXIT, "%s:%sHTTP code: %d", __func__, msg, result); |
From: <svn...@op...> - 2010-08-13 23:00:41
|
Author: cdfrey Date: Sat Aug 14 01:00:33 2010 New Revision: 6086 URL: http://www.opensync.org/changeset/6086 Log: Started cleanup of gc_get_changes_calendar() Fixed wrong timestamp variable usage Removed unused xslt setup code (already in connect()) Cleaned up timestamp update code to make it more concise, if a little less efficient. Modified: plugins/google-calendar/src/gcalendar.c Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Sat Aug 14 01:00:27 2010 (r6085) +++ plugins/google-calendar/src/gcalendar.c Sat Aug 14 01:00:33 2010 (r6086) @@ -233,14 +233,13 @@ osync_bool slow_sync, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); - char buffer[512]; struct gc_plgdata *plgdata = data; char slow_sync_flag = 0; OSyncError *error = NULL; OSyncData *odata = NULL; OSyncChange *chg = NULL; int result = 0, i; - char *timestamp = NULL, *msg, *raw_xml = NULL; + char *timestamp = NULL, *msg = NULL, *raw_xml = NULL; gcal_event_t event; OSyncError *state_db_error = NULL; @@ -279,28 +278,31 @@ osync_trace(TRACE_INTERNAL, "gcalendar: got them all!\n"); if (plgdata->all_events.length == 0) { osync_trace(TRACE_INTERNAL, "gcalendar: no changes...\n"); - goto no_changes; - } else + goto exit; + } else { osync_trace(TRACE_INTERNAL, "gcalendar: changes count: %d\n", plgdata->all_events.length); + } // Calendar returns most recently updated event as first element - event = gcal_event_element(&(plgdata->all_events), 0); - if (!event) { - msg = "Cannot access last updated event!\n"; - goto error; - } - plgdata->cont_timestamp = strdup(gcal_event_get_updated(event)); - if (!plgdata->cont_timestamp) { - msg = "Failed copying event timestamp!\n"; - goto error; - } - for (i = 0; i < plgdata->all_events.length; ++i) { event = gcal_event_element(&(plgdata->all_events), i); - if (!event) + if (!event) { + osync_trace(TRACE_INTERNAL, "Cannot access updated event %d", i); goto error; + } + + // save first timestamp as new "done" mark + if (i == 0) { + if (plgdata->cal_timestamp) + free(plgdata->cal_timestamp); + plgdata->cal_timestamp = strdup(gcal_event_get_updated(event)); + if (!plgdata->cal_timestamp) { + msg = "Failed copying event timestamp!\n"; + goto error; + } + } osync_trace(TRACE_INTERNAL, "gevent: timestamp:%s\tevent:%s\n", timestamp, gcal_event_get_updated(event)); @@ -333,6 +335,9 @@ osync_change_set_uid(chg, gcal_event_get_url(event)); +//FIXME - add hashtable support here, and let it determine the changetype, +//similar to barry-sync. + if (slow_sync_flag) osync_change_set_changetype(chg, OSYNC_CHANGE_TYPE_ADDED); else @@ -347,19 +352,7 @@ osync_change_unref(chg); } -no_changes: - - // Load XSLT style to convert osync xmlformat-event --> gdata - snprintf(buffer, sizeof(buffer) - 1, "%s/osync2gcal.xslt", - plgdata->xslt_path); - if ((result = xslt_initialize(plgdata->xslt_ctx_gcal, buffer))) { - msg = "Cannot initialize new XSLT!\n"; - goto error; - } - - osync_trace(TRACE_INTERNAL, "\ndone calendar: %s\n", buffer); - -//exit: +exit: // osync_sink_state_get uses osync_strdup osync_free(timestamp); osync_context_report_success(ctx); |
From: <svn...@op...> - 2010-08-13 23:00:34
|
Author: cdfrey Date: Sat Aug 14 01:00:27 2010 New Revision: 6085 URL: http://www.opensync.org/changeset/6085 Log: Remove redundant dir slashes, since they are included in get_default_configdir() Easier portability Modified: plugins/google-calendar/src/gcalendar.c Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Sat Aug 14 01:00:21 2010 (r6084) +++ plugins/google-calendar/src/gcalendar.c Sat Aug 14 01:00:27 2010 (r6085) @@ -178,7 +178,7 @@ if (result == -1) goto error; - snprintf(buffer, sizeof(buffer) - 1, "%s/gcal2osync.xslt", + snprintf(buffer, sizeof(buffer) - 1, "%sgcal2osync.xslt", plgdata->xslt_path); if ((result = xslt_initialize(plgdata->xslt_ctx_gcal, buffer))) goto error; @@ -210,7 +210,7 @@ if (result == -1) goto error; - snprintf(buffer, sizeof(buffer) - 1, "%s/gcont2osync.xslt", + snprintf(buffer, sizeof(buffer) - 1, "%sgcont2osync.xslt", plgdata->xslt_path); if ((result = xslt_initialize(plgdata->xslt_ctx_gcont, buffer))) goto error; @@ -499,7 +499,7 @@ no_changes: // Load XSLT style to convert osync xmlformat-contact --> gdata - snprintf(buffer, sizeof(buffer) - 1, "%s/osync2gcont.xslt", + snprintf(buffer, sizeof(buffer) - 1, "%sosync2gcont.xslt", plgdata->xslt_path); if ((result = xslt_initialize(plgdata->xslt_ctx_gcont, buffer))) { msg = "Cannot initialize new XSLT!\n"; |
From: <svn...@op...> - 2010-08-13 23:00:29
|
Author: cdfrey Date: Sat Aug 14 01:00:21 2010 New Revision: 6084 URL: http://www.opensync.org/changeset/6084 Log: Remove "xslt" directory config and use new osync_plugin_get_default_configdir() Modified: plugins/google-calendar/src/gcalendar.c plugins/google-calendar/src/google-data Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Sat Aug 14 01:00:14 2010 (r6083) +++ plugins/google-calendar/src/gcalendar.c Sat Aug 14 01:00:21 2010 (r6084) @@ -796,7 +796,6 @@ OSyncPluginConfig *config; OSyncList *resources; OSyncList *r; - const char *xslt_config; plgdata = osync_try_malloc0(sizeof(struct gc_plgdata), error); config = osync_plugin_info_get_config(info); @@ -806,13 +805,7 @@ goto error_freeplg; } - xslt_config = osync_plugin_config_get_advancedoption_value_by_name(config, "xslt"); - if( !xslt_config ) { - osync_trace(TRACE_INTERNAL, "Cannot locate xslt config!\n"); - goto error_freeplg; - } - - plgdata->xslt_path = strdup(xslt_config); + plgdata->xslt_path = strdup(osync_plugin_get_default_configdir()); if( !plgdata->xslt_path ) goto error_freeplg; Modified: plugins/google-calendar/src/google-data ============================================================================== --- plugins/google-calendar/src/google-data Sat Aug 14 01:00:14 2010 (r6083) +++ plugins/google-calendar/src/google-data Sat Aug 14 01:00:21 2010 (r6084) @@ -2,14 +2,6 @@ <config version="1.0"> <AdvancedOptions> <AdvancedOption> - <!-- Location of XSLT files used to make conversion --> - <DisplayName>Path to XSLT files</DisplayName> - <Name>xslt</Name> - <Type>string</Type> - <Value>/usr/local/share/libopensync1/defaults</Value> - </AdvancedOption> - - <AdvancedOption> <!-- to be implemented in libgcal: use other calendar than default --> <DisplayName>Calendar title</DisplayName> <Name>title</Name> |
From: <svn...@op...> - 2010-08-13 23:00:23
|
Author: cdfrey Date: Sat Aug 14 01:00:14 2010 New Revision: 6083 URL: http://www.opensync.org/changeset/6083 Log: Fixed XSLT converters' use of Summary and Description vevent fields Modified: plugins/google-calendar/src/gcal2osync.xslt plugins/google-calendar/src/osync2gcal.xslt Modified: plugins/google-calendar/src/gcal2osync.xslt ============================================================================== --- plugins/google-calendar/src/gcal2osync.xslt Sat Aug 14 01:00:07 2010 (r6082) +++ plugins/google-calendar/src/gcal2osync.xslt Sat Aug 14 01:00:14 2010 (r6083) @@ -79,9 +79,15 @@ </Content> </DateStarted> + <Summary> + <Content> + <xsl:value-of select="descendant::atom:title"/> + </Content> + </Summary> + <Description> <Content> - <xsl:value-of select="descendant::atom:title"/> + <xsl:value-of select="descendant::atom:content"/> </Content> </Description> Modified: plugins/google-calendar/src/osync2gcal.xslt ============================================================================== --- plugins/google-calendar/src/osync2gcal.xslt Sat Aug 14 01:00:07 2010 (r6082) +++ plugins/google-calendar/src/osync2gcal.xslt Sat Aug 14 01:00:14 2010 (r6083) @@ -28,12 +28,12 @@ <title> <xsl:attribute name="type">text</xsl:attribute> - <xsl:value-of select="descendant::Description/Content"/> + <xsl:value-of select="descendant::Summary/Content"/> </title> <content> <xsl:attribute name="type">text</xsl:attribute> - <xsl:value-of select="descendant::Comment/Content"/> + <xsl:value-of select="descendant::Description/Content"/> </content> <link> |
From: <svn...@op...> - 2010-08-13 23:00:15
|
Author: cdfrey Date: Sat Aug 14 01:00:07 2010 New Revision: 6082 URL: http://www.opensync.org/changeset/6082 Log: Use xmlformat-event-doc and xmlformat-contact-doc Need the string versions of the XML data, not the binary ones. Modified: plugins/google-calendar/src/google-data Modified: plugins/google-calendar/src/google-data ============================================================================== --- plugins/google-calendar/src/google-data Sat Aug 14 01:00:00 2010 (r6081) +++ plugins/google-calendar/src/google-data Sat Aug 14 01:00:07 2010 (r6082) @@ -38,7 +38,7 @@ <Formats> <Format> <!-- <Name>google-contact</Name> --> - <Name>xmlformat-contact</Name> + <Name>xmlformat-contact-doc</Name> </Format> </Formats> <Name>My private google contacts</Name> @@ -51,7 +51,7 @@ <Formats> <Format> <!-- <Name>google-event</Name> --> - <Name>xmlformat-event</Name> + <Name>xmlformat-event-doc</Name> </Format> </Formats> <Name>My private google calendar</Name> |
From: <svn...@op...> - 2010-08-13 23:00:08
|
Author: cdfrey Date: Sat Aug 14 01:00:00 2010 New Revision: 6081 URL: http://www.opensync.org/changeset/6081 Log: Set to run as process... this avoids some odd segfaults in libxml2 Modified: plugins/google-calendar/src/gcalendar.c Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Sat Aug 14 00:59:54 2010 (r6080) +++ plugins/google-calendar/src/gcalendar.c Sat Aug 14 01:00:00 2010 (r6081) @@ -1019,6 +1019,7 @@ osync_plugin_set_initialize(plugin, gc_initialize); osync_plugin_set_finalize(plugin, gc_finalize); osync_plugin_set_discover(plugin, gc_discover); + osync_plugin_set_start_type(plugin, OSYNC_START_TYPE_PROCESS); if( !osync_plugin_env_register_plugin(env, plugin, error) ) goto error; |
From: <svn...@op...> - 2010-08-13 23:00:01
|
Author: cdfrey Date: Sat Aug 14 00:59:54 2010 New Revision: 6080 URL: http://www.opensync.org/changeset/6080 Log: Updated AUTHORS Modified: plugins/google-calendar/AUTHORS Modified: plugins/google-calendar/AUTHORS ============================================================================== --- plugins/google-calendar/AUTHORS Sat Aug 14 00:59:48 2010 (r6079) +++ plugins/google-calendar/AUTHORS Sat Aug 14 00:59:54 2010 (r6080) @@ -1 +1,3 @@ -Writteen by Adenilson Cavalcanti <ade...@in...> +Written by Adenilson Cavalcanti <ade...@in...> +Updates for opensync 0.39, and libgcal 0.9.5 by Chris Frey <cd...@fo...> + |
From: <svn...@op...> - 2010-08-13 22:59:56
|
Author: cdfrey Date: Sat Aug 14 00:59:48 2010 New Revision: 6079 URL: http://www.opensync.org/changeset/6079 Log: Update INSTALL dependency list Modified: plugins/google-calendar/INSTALL Modified: plugins/google-calendar/INSTALL ============================================================================== --- plugins/google-calendar/INSTALL Sat Aug 14 00:48:01 2010 (r6078) +++ plugins/google-calendar/INSTALL Sat Aug 14 00:59:48 2010 (r6079) @@ -1,3 +1,5 @@ -Same compiling instructions as opensync trunk (0.4x), has a requirement -libgcal: +Same compiling instructions as opensync trunk (0.4x). + +Also has a requirement libgcal, developed using version 0.9.5: http://libgcal.googlecode.com + |
From: <svn...@op...> - 2010-08-13 22:48:11
|
Author: cdfrey Date: Sat Aug 14 00:48:01 2010 New Revision: 6078 URL: http://www.opensync.org/changeset/6078 Log: API: added osync_plugin_get_default_configdir() to access OPENSYNC_CONFIGDIR Modified: trunk/opensync.sym trunk/opensync/group/opensync_member.c trunk/opensync/plugin/opensync_plugin_config.c trunk/opensync/plugin/opensync_plugin_config.h Modified: trunk/opensync.sym ============================================================================== --- trunk/opensync.sym Sat Aug 14 00:47:52 2010 (r6077) +++ trunk/opensync.sym Sat Aug 14 00:48:01 2010 (r6078) @@ -576,6 +576,7 @@ osync_plugin_externalplugin_set_external_command osync_plugin_externalplugin_unref osync_plugin_finalize +osync_plugin_get_default_configdir osync_plugin_get_config_type osync_plugin_get_data osync_plugin_get_description Modified: trunk/opensync/group/opensync_member.c ============================================================================== --- trunk/opensync/group/opensync_member.c Sat Aug 14 00:47:52 2010 (r6077) +++ trunk/opensync/group/opensync_member.c Sat Aug 14 00:48:01 2010 (r6078) @@ -277,10 +277,12 @@ osync_free(filename); #ifdef OPENSYNC_UNITTESTS filename = osync_strdup_printf("%s"G_DIR_SEPARATOR_S"%s", - member->default_configdir ? member->default_configdir : OPENSYNC_CONFIGDIR, + member->default_configdir ? member->default_configdir : osync_plugin_get_default_configdir(), member->pluginname); #else - filename = osync_strdup_printf(OPENSYNC_CONFIGDIR G_DIR_SEPARATOR_S"%s", member->pluginname); + filename = osync_strdup_printf("%s%s", + osync_plugin_get_default_configdir(), + member->pluginname); #endif osync_trace(TRACE_INTERNAL, "Reading default %s", filename); } Modified: trunk/opensync/plugin/opensync_plugin_config.c ============================================================================== --- trunk/opensync/plugin/opensync_plugin_config.c Sat Aug 14 00:47:52 2010 (r6077) +++ trunk/opensync/plugin/opensync_plugin_config.c Sat Aug 14 00:48:01 2010 (r6078) @@ -1338,6 +1338,11 @@ return FALSE; } +const char *osync_plugin_get_default_configdir(void) +{ + return OPENSYNC_CONFIGDIR G_DIR_SEPARATOR_S; +} + OSyncPluginConfig *osync_plugin_config_new(OSyncError **error) { OSyncPluginConfig *config = osync_try_malloc0(sizeof(OSyncPluginConfig), error); Modified: trunk/opensync/plugin/opensync_plugin_config.h ============================================================================== --- trunk/opensync/plugin/opensync_plugin_config.h Sat Aug 14 00:47:52 2010 (r6077) +++ trunk/opensync/plugin/opensync_plugin_config.h Sat Aug 14 00:48:01 2010 (r6078) @@ -57,6 +57,20 @@ **/ typedef unsigned int OSyncPluginConfigSupportedFlags; +/** @brief Returns the built-in default plugin configuration directory + * + * Returns a string containing the build-time directory where + * default plugin config files are stored, including trailing directory + * separator character. (Usually "/usr/share/libopensync1/defaults/") + * + * Note that this is only really necessary if your plugin stores additional + * config files in the defaults directory that it needs to access later. + * + * @returns String with directory + * + */ +OSYNC_EXPORT const char *osync_plugin_get_default_configdir(void); + /** @brief Create a new plugin config object * * @param error Pointer to and error struct |
From: <svn...@op...> - 2010-08-13 22:48:00
|
Author: cdfrey Date: Sat Aug 14 00:47:52 2010 New Revision: 6077 URL: http://www.opensync.org/changeset/6077 Log: Allow time functions to accept YYYY-MM-DDTHH:MM:SS formats Some formats, such as google calendar, hold timestamps in a format that includes dashes and colons. It makes sense to accept both in the library time routines. Modified: trunk/opensync/format/opensync_time.c Modified: trunk/opensync/format/opensync_time.c ============================================================================== --- trunk/opensync/format/opensync_time.c Sat Aug 14 00:47:44 2010 (r6076) +++ trunk/opensync/format/opensync_time.c Sat Aug 14 00:47:52 2010 (r6077) @@ -166,7 +166,8 @@ { osync_trace(TRACE_ENTRY, "%s(%s)", __func__, vtime); struct tm *utime = g_try_malloc0(sizeof(struct tm)); - + char *plainvtime = NULL; + if (!utime) { osync_error_set(error, OSYNC_ERROR_GENERIC, "Could not allocate memory for time stuct."); goto error; @@ -179,7 +180,10 @@ utime->tm_min = 0; utime->tm_sec = 0; - sscanf(vtime, "%04d%02d%02dT%02d%02d%02d%*01c", + // make sure vtime is in format: YYYYMMDDTHHMMSS... + plainvtime = osync_time_timestamp_remove_dash(vtime); + + sscanf(plainvtime, "%04d%02d%02dT%02d%02d%02d%*01c", &(utime->tm_year), &(utime->tm_mon), &(utime->tm_mday), &(utime->tm_hour), &(utime->tm_min), &(utime->tm_sec)); @@ -192,6 +196,7 @@ /* ask C library to clean up any anomalies */ mktime(utime); + free(plainvtime); osync_trace(TRACE_EXIT, "%s", __func__); return utime; error: |
From: <svn...@op...> - 2010-08-13 22:47:54
|
Author: cdfrey Date: Sat Aug 14 00:47:44 2010 New Revision: 6076 URL: http://www.opensync.org/changeset/6076 Log: time: put UTC detection in one function only Modified: trunk/opensync/format/opensync_time.c Modified: trunk/opensync/format/opensync_time.c ============================================================================== --- trunk/opensync/format/opensync_time.c Sat Jul 10 05:49:35 2010 (r6075) +++ trunk/opensync/format/opensync_time.c Sat Aug 14 00:47:44 2010 (r6076) @@ -139,6 +139,8 @@ osync_bool osync_time_isutc(const char *vtime) { + // use strstr() here so that if there are milliseconds in the + // timestamp, the Z still gets found if (!strstr(vtime, "Z")) return FALSE; @@ -542,7 +544,7 @@ struct tm *tm_local = NULL, *tm_utc = NULL; osync_trace(TRACE_ENTRY, "%s(%s,%i)", __func__, localtime, offset); - if (strstr(localtime, "Z")) { + if (osync_time_isutc(localtime)) { utc = g_strdup(localtime); goto end; } @@ -582,7 +584,7 @@ struct tm *tm_local = NULL, *tm_utc = NULL; osync_trace(TRACE_ENTRY, "%s(%s,%i)", __func__, utc, offset); - if (!strstr(utc, "Z")) { + if (!osync_time_isutc(utc)) { localtime = g_strdup(utc); return localtime; } |
From: <svn...@op...> - 2010-07-10 03:49:44
|
Author: cdfrey Date: Sat Jul 10 05:49:35 2010 New Revision: 6075 URL: http://www.opensync.org/changeset/6075 Log: Fixed memory leaks in environment freeing, and in strings returned from evolution Modified: plugins/evolution2/src/evolution2_sync.c plugins/evolution2/src/evolution2_sync.h Modified: plugins/evolution2/src/evolution2_sync.c ============================================================================== --- plugins/evolution2/src/evolution2_sync.c Sat Jul 10 04:03:28 2010 (r6074) +++ plugins/evolution2/src/evolution2_sync.c Sat Jul 10 05:49:35 2010 (r6075) @@ -40,6 +40,10 @@ { OSyncEvoCalendar *cal = (OSyncEvoCalendar *)data; + if (cal->uri_key) { + free(cal->uri_key); + cal->uri_key = NULL; + } if (cal->calendar) { g_object_unref(cal->calendar); cal->calendar = NULL; @@ -52,6 +56,8 @@ osync_objformat_unref(cal->format); cal->format = NULL; } + + osync_free(cal); } static void free_env(OSyncEvoEnv *env) @@ -79,9 +85,19 @@ GSList *s; for (s = e_source_group_peek_sources (group); s; s = s->next) { ESource *source = E_SOURCE (s->data); - osync_trace(TRACE_INTERNAL, "Comparing source uri %s and %s", e_source_get_uri(source), uri); - if (!strcmp(e_source_get_uri(source), uri)) + + // e_source_get_uri() returns an allocated string + // that we need to free + char *source_uri = e_source_get_uri(source); + osync_trace(TRACE_INTERNAL, "Comparing source uri %s and %s", source_uri, uri); + int cmp = strcmp(source_uri, uri); + g_free(source_uri); + if (!cmp) return source; + + // e_source_peek_name() does not seem to require + // freeing... *sigh* had to read the source code to + // find this out osync_trace(TRACE_INTERNAL, "Comparing source name %s and %s", e_source_peek_name(source), uri); if (!strcmp(e_source_peek_name(source), uri)) return source; Modified: plugins/evolution2/src/evolution2_sync.h ============================================================================== --- plugins/evolution2/src/evolution2_sync.h Sat Jul 10 04:03:28 2010 (r6074) +++ plugins/evolution2/src/evolution2_sync.h Sat Jul 10 05:49:35 2010 (r6075) @@ -44,7 +44,7 @@ typedef struct OSyncEvoCalendar { - const char *uri_key; + char *uri_key; const char *uri; const char *objtype; const char *change_id; |
From: <svn...@op...> - 2010-07-10 02:03:37
|
Author: cdfrey Date: Sat Jul 10 04:03:28 2010 New Revision: 6074 URL: http://www.opensync.org/changeset/6074 Log: Fixed memory leak in osync_member_load() Modified: trunk/opensync/group/opensync_member.c Modified: trunk/opensync/group/opensync_member.c ============================================================================== --- trunk/opensync/group/opensync_member.c Sat Jul 10 03:52:00 2010 (r6073) +++ trunk/opensync/group/opensync_member.c Sat Jul 10 04:03:28 2010 (r6074) @@ -411,6 +411,7 @@ goto error_free_doc; osync_member_add_objtype_sink(member, sink); + osync_objtype_sink_unref(sink); } else if (!xmlStrcmp(cur->name, (const xmlChar *)"timeout")) { /* Sink Function Timeout settings for main sink */ if (!member->main_sink) |
From: <svn...@op...> - 2010-07-10 01:52:10
|
Author: cdfrey Date: Sat Jul 10 03:52:00 2010 New Revision: 6073 URL: http://www.opensync.org/changeset/6073 Log: Fixed more memory leaks, and removed unused struct Modified: plugins/evolution2/src/evolution2_ebook.c plugins/evolution2/src/evolution2_ecal.c plugins/evolution2/src/evolution2_sync.c plugins/evolution2/src/evolution2_sync.h Modified: plugins/evolution2/src/evolution2_ebook.c ============================================================================== --- plugins/evolution2/src/evolution2_ebook.c Fri Jul 9 21:27:14 2010 (r6072) +++ plugins/evolution2/src/evolution2_ebook.c Sat Jul 10 03:52:00 2010 (r6073) @@ -30,7 +30,7 @@ #include "evolution2_ebook.h" -EBook *evo2_ebook_open_book(char *path, OSyncError **error) +EBook *evo2_ebook_open_book(const char *path, OSyncError **error) { EBook *addressbook = NULL; GError *gerror = NULL; @@ -98,7 +98,7 @@ osync_assert(caps); if (env->contact_sink) { - if (!(book = evo2_ebook_open_book(g_strdup(env->addressbook_path), error))) { + if (!(book = evo2_ebook_open_book(env->addressbook_path, error))) { goto error; } writable = e_book_is_writable(book); @@ -139,7 +139,7 @@ OSyncEvoEnv *env = (OSyncEvoEnv *)userdata; osync_bool state_match; - if (!(env->addressbook = evo2_ebook_open_book(osync_strdup(env->addressbook_path), &error))) { + if (!(env->addressbook = evo2_ebook_open_book(env->addressbook_path, &error))) { goto error; } Modified: plugins/evolution2/src/evolution2_ecal.c ============================================================================== --- plugins/evolution2/src/evolution2_ecal.c Fri Jul 9 21:27:14 2010 (r6072) +++ plugins/evolution2/src/evolution2_ecal.c Sat Jul 10 03:52:00 2010 (r6073) @@ -30,7 +30,7 @@ #include "evolution2_capabilities.h" #include "evolution2_ecal.h" -ECal *evo2_ecal_open_cal(char *path, ECalSourceType source_type, OSyncError **error) +ECal *evo2_ecal_open_cal(const char *path, ECalSourceType source_type, OSyncError **error) { ECal *calendar = NULL; GError *gerror = NULL; @@ -88,7 +88,7 @@ osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); OSyncEvoCalendar * evo_cal = (OSyncEvoCalendar *)userdata; - if (!(evo_cal->calendar = evo2_ecal_open_cal(osync_strdup(evo_cal->uri), evo_cal->source_type, &error))) { + if (!(evo_cal->calendar = evo2_ecal_open_cal(evo_cal->uri, evo_cal->source_type, &error))) { goto error; } @@ -370,7 +370,7 @@ osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, evo_cal, caps, error); if (evo_cal->sink) { - if (!(cal = evo2_ecal_open_cal(osync_strdup(evo_cal->uri), evo_cal->source_type, error))) { + if (!(cal = evo2_ecal_open_cal(evo_cal->uri, evo_cal->source_type, error))) { goto error; } if (!e_cal_is_read_only(cal, &read_only, &gerror)) { Modified: plugins/evolution2/src/evolution2_sync.c ============================================================================== --- plugins/evolution2/src/evolution2_sync.c Fri Jul 9 21:27:14 2010 (r6072) +++ plugins/evolution2/src/evolution2_sync.c Sat Jul 10 03:52:00 2010 (r6073) @@ -58,7 +58,10 @@ { if (env->contact_sink) osync_objtype_sink_unref(env->contact_sink); - + if (env->pluginInfo) + osync_plugin_info_unref(env->pluginInfo); + if (env->change_id) + g_free(env->change_id); g_list_foreach(env->calendars, free_osync_evo_calendar, NULL); g_list_free(env->calendars); @@ -68,7 +71,7 @@ -ESource *evo2_find_source(ESourceList *list, char *uri) +ESource *evo2_find_source(ESourceList *list, const char *uri) { GSList *g; for (g = e_source_list_peek_groups (list); g; g = g->next) { @@ -100,9 +103,9 @@ env->pluginInfo = osync_plugin_info_ref(info); osync_trace(TRACE_INTERNAL, "Setting change id: %s", osync_plugin_info_get_groupname(info)); - + env->change_id = g_strdup(osync_plugin_info_get_groupname(info)); - + osync_trace(TRACE_INTERNAL, "The config: %p", osync_plugin_info_get_config(info)); Modified: plugins/evolution2/src/evolution2_sync.h ============================================================================== --- plugins/evolution2/src/evolution2_sync.h Fri Jul 9 21:27:14 2010 (r6072) +++ plugins/evolution2/src/evolution2_sync.h Sat Jul 10 03:52:00 2010 (r6073) @@ -43,11 +43,6 @@ #define STR_URI_KEY "uri_" -typedef struct evo2_location { - char *name; - char *uri; -} evo2_location; - typedef struct OSyncEvoCalendar { const char *uri_key; const char *uri; @@ -73,6 +68,6 @@ OSyncPluginInfo *pluginInfo; } OSyncEvoEnv; -ESource *evo2_find_source(ESourceList *list, char *uri); +ESource *evo2_find_source(ESourceList *list, const char *uri); #endif |
From: <svn...@op...> - 2010-07-09 19:27:21
|
Author: cdfrey Date: Fri Jul 9 21:27:14 2010 New Revision: 6072 URL: http://www.opensync.org/changeset/6072 Log: Limit slow syncs to events that have DTSTART fields In some cases, when data is deleted from Evolution, the VEVENT blocks in the corresponding .ics files do not get deleted, but just trimmed down to basic fields, which lack a DTSART. During a slow sync, these "semi-deleted" records come back, and blow the XML validation, since there is no DTSTART. Limiting slow-sync records to ones with DTSTART fixes this issue. Modified: plugins/evolution2/src/evolution2_ecal.c Modified: plugins/evolution2/src/evolution2_ecal.c ============================================================================== --- plugins/evolution2/src/evolution2_ecal.c Fri Jul 9 21:27:08 2010 (r6071) +++ plugins/evolution2/src/evolution2_ecal.c Fri Jul 9 21:27:14 2010 (r6072) @@ -250,7 +250,7 @@ } } else { osync_trace(TRACE_INTERNAL, "slow_sync for %s", evo_cal->objtype); - if (!e_cal_get_object_list_as_comp (evo_cal->calendar, "(contains? \"any\" \"\")", &changes, &gerror)) { + if (!e_cal_get_object_list_as_comp (evo_cal->calendar, "(has-start?)", &changes, &gerror)) { osync_error_set(&error, OSYNC_ERROR_GENERIC, "Failed to get %s changes: %s", evo_cal->objtype, gerror ? gerror->message : "None"); goto error; } |
From: <svn...@op...> - 2010-07-09 19:27:15
|
Author: cdfrey Date: Fri Jul 9 21:27:08 2010 New Revision: 6071 URL: http://www.opensync.org/changeset/6071 Log: Set pointers to null after they are freed Modified: plugins/evolution2/src/evolution2_sync.c Modified: plugins/evolution2/src/evolution2_sync.c ============================================================================== --- plugins/evolution2/src/evolution2_sync.c Fri Jul 9 21:27:00 2010 (r6070) +++ plugins/evolution2/src/evolution2_sync.c Fri Jul 9 21:27:08 2010 (r6071) @@ -40,23 +40,29 @@ { OSyncEvoCalendar *cal = (OSyncEvoCalendar *)data; - if (cal->calendar) + if (cal->calendar) { g_object_unref(cal->calendar); - if (cal->sink) + cal->calendar = NULL; + } + if (cal->sink) { osync_objtype_sink_unref(cal->sink); - if (cal->format) + cal->sink = NULL; + } + if (cal->format) { osync_objformat_unref(cal->format); + cal->format = NULL; + } } static void free_env(OSyncEvoEnv *env) { if (env->contact_sink) osync_objtype_sink_unref(env->contact_sink); - + g_list_foreach(env->calendars, free_osync_evo_calendar, NULL); g_list_free(env->calendars); - + g_free(env); } |
From: <svn...@op...> - 2010-07-09 19:27:10
|
Author: cdfrey Date: Fri Jul 9 21:27:00 2010 New Revision: 6070 URL: http://www.opensync.org/changeset/6070 Log: Update for osync_list_free() API change Modified: plugins/evolution2/src/evolution2_ebook.c plugins/evolution2/src/evolution2_ecal.c plugins/evolution2/src/evolution2_sync.c Modified: plugins/evolution2/src/evolution2_ebook.c ============================================================================== --- plugins/evolution2/src/evolution2_ebook.c Fri Jul 9 21:22:20 2010 (r6069) +++ plugins/evolution2/src/evolution2_ebook.c Fri Jul 9 21:27:00 2010 (r6070) @@ -443,6 +443,7 @@ OSyncObjFormatSink *objformatsink = r->data; if(!strcmp("vcard30", osync_objformat_sink_get_objformat(objformatsink))) { hasObjFormat = TRUE; break;} } + osync_list_free(objformatsinks); if (!hasObjFormat) { osync_error_set(error, OSYNC_ERROR_GENERIC, "Format vcard30 not set."); goto error; Modified: plugins/evolution2/src/evolution2_ecal.c ============================================================================== --- plugins/evolution2/src/evolution2_ecal.c Fri Jul 9 21:22:20 2010 (r6069) +++ plugins/evolution2/src/evolution2_ecal.c Fri Jul 9 21:27:00 2010 (r6070) @@ -449,6 +449,7 @@ OSyncObjFormatSink *objformatsink = r->data; if(!strcmp(required_format, osync_objformat_sink_get_objformat(objformatsink))) { hasObjFormat = TRUE; break;} } + osync_list_free(objformatsinks); if (!hasObjFormat) { osync_error_set(error, OSYNC_ERROR_GENERIC, "Format %s not set.", required_format); return FALSE; Modified: plugins/evolution2/src/evolution2_sync.c ============================================================================== --- plugins/evolution2/src/evolution2_sync.c Fri Jul 9 21:22:20 2010 (r6069) +++ plugins/evolution2/src/evolution2_sync.c Fri Jul 9 21:27:00 2010 (r6070) @@ -169,6 +169,7 @@ osync_objtype_sink_set_available(sink, TRUE); } + osync_list_free(list); OSyncVersion *version = osync_version_new(error); osync_version_set_plugin(version, "Evolution"); |
From: <svn...@op...> - 2010-07-09 19:22:27
|
Author: cdfrey Date: Fri Jul 9 21:22:20 2010 New Revision: 6069 URL: http://www.opensync.org/changeset/6069 Log: Updated gdata_format so it compiles with latest API I'm not sure what this thing does, or even if it is necessary. It looks pretty sparse. Modified: plugins/google-calendar/src/gdata_format.c Modified: plugins/google-calendar/src/gdata_format.c ============================================================================== --- plugins/google-calendar/src/gdata_format.c Fri Jul 9 21:22:14 2010 (r6068) +++ plugins/google-calendar/src/gdata_format.c Fri Jul 9 21:22:20 2010 (r6069) @@ -41,7 +41,28 @@ #include <opensync/opensync-format.h> #include <opensync/opensync-time.h> -osync_bool xmlcontact_to_gcontact(char *input, unsigned int inpsize, +static osync_bool xmlcontact_to_gcontact(char *input, unsigned int inpsize, + char **output, unsigned int *outpsize, + osync_bool *free_input, const char *config, + void *userdata, OSyncError **error); +static osync_bool xmlevent_to_gevent(char *input, unsigned int inpsize, + char **output, unsigned int *outpsize, + osync_bool *free_input, const char *config, + void *userdata, OSyncError **error); +static osync_bool gcontact_to_xmlcontact(char *input, unsigned int inpsize, + char **output, unsigned int *outpsize, + osync_bool *free_input, const char *config, + void *userdata, OSyncError **error); +static osync_bool gevent_to_xmlevent(char *input, unsigned int inpsize, + char **output, unsigned int *outpsize, + osync_bool *free_input, const char *config, + void *userdata, OSyncError **error); +static void *gc_data_initialize(const char *config, OSyncError **error); +static osync_bool gc_data_finalize(void *userdata, OSyncError **error); + + + +static osync_bool xmlcontact_to_gcontact(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, void *userdata, OSyncError **error) @@ -50,7 +71,7 @@ return FALSE; } -osync_bool xmlevent_to_gevent(char *input, unsigned int inpsize, +static osync_bool xmlevent_to_gevent(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, void *userdata, OSyncError **error) @@ -59,7 +80,7 @@ return FALSE; } -osync_bool gcontact_to_xmlcontact(char *input, unsigned int inpsize, +static osync_bool gcontact_to_xmlcontact(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, void *userdata, OSyncError **error) @@ -68,7 +89,7 @@ return FALSE; } -osync_bool gevent_to_xmlevent(char *input, unsigned int inpsize, +static osync_bool gevent_to_xmlevent(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, void *userdata, OSyncError **error) @@ -77,43 +98,54 @@ return FALSE; } +static void *gc_data_initialize(const char *config, OSyncError **error) +{ + struct xslt_resources *converter = NULL; + converter = xslt_new(); + + return converter; +} + +static osync_bool gc_data_finalize(void *userdata, OSyncError **error) +{ + struct xslt_resources *converter = NULL; + if (!userdata) + return TRUE; + + converter = (struct xslt_resources *)userdata; + xslt_delete(converter); + return TRUE; +} + osync_bool get_format_info(OSyncFormatEnv *env, OSyncError **error) { OSyncObjFormat *gcont = osync_objformat_new("google-contact", "contact", error); if (!gcont) - return FALSE; + goto error; OSyncObjFormat *gevent = osync_objformat_new("google-event", "event", error); if (!gevent) - return FALSE; + goto error; // TODO: register (and write) auxiliary functions: // compare/create/destroy/blah... - osync_format_env_register_objformat(env, gcont); + if( !osync_format_env_register_objformat(env, gcont, error) ) + goto error; osync_objformat_unref(gcont); - osync_format_env_register_objformat(env, gevent); + if( !osync_format_env_register_objformat(env, gevent, error) ) + goto error; osync_objformat_unref(gevent); -} - -void *gc_data_initialize(OSyncError **error) -{ - struct xslt_resources *converter = NULL; - converter = xslt_new(); - - return converter; -} - -void gc_data_finalize(void *userdata) -{ - struct xslt_resources *converter = NULL; - if (!userdata) - return; - converter = (struct xslt_resources *)userdata; - xslt_delete(converter); + return TRUE; +error: + if( gcont ) + osync_objformat_unref(gcont); + if( gevent ) + osync_objformat_unref(gevent); + return FALSE; } osync_bool get_conversion_info(OSyncFormatEnv *env) @@ -137,7 +169,8 @@ osync_assert(conv); osync_converter_set_initialize_func(conv, gc_data_initialize); osync_converter_set_finalize_func(conv, gc_data_finalize); - osync_format_env_register_converter(env, conv); + if( !osync_format_env_register_converter(env, conv, &error) ) + goto error; osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_CONV, xml_event, gevent, @@ -145,7 +178,8 @@ osync_assert(conv); osync_converter_set_initialize_func(conv, gc_data_initialize); osync_converter_set_finalize_func(conv, gc_data_finalize); - osync_format_env_register_converter(env, conv); + if( !osync_format_env_register_converter(env, conv, &error) ) + goto error; osync_converter_unref(conv); // from gdata to xmlformat @@ -154,7 +188,8 @@ osync_assert(conv); osync_converter_set_initialize_func(conv, gc_data_initialize); osync_converter_set_finalize_func(conv, gc_data_finalize); - osync_format_env_register_converter(env, conv); + if( !osync_format_env_register_converter(env, conv, &error) ) + goto error; osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_CONV, gevent, xml_event, @@ -163,10 +198,19 @@ osync_converter_set_initialize_func(conv, gc_data_initialize); osync_converter_set_finalize_func(conv, gc_data_finalize); - osync_format_env_register_converter(env, conv); + if( !osync_format_env_register_converter(env, conv, &error) ) + goto error; osync_converter_unref(conv); return TRUE; + +error: + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, + osync_error_print(&error)); + osync_error_unref(&error); + if( conv ) + osync_converter_unref(conv); + return FALSE; } int get_version(void) |
From: <svn...@op...> - 2010-07-09 19:22:21
|
Author: cdfrey Date: Fri Jul 9 21:22:14 2010 New Revision: 6068 URL: http://www.opensync.org/changeset/6068 Log: Converted comments to // style Modified: plugins/google-calendar/src/gdata_format.c Modified: plugins/google-calendar/src/gdata_format.c ============================================================================== --- plugins/google-calendar/src/gdata_format.c Fri Jul 9 21:22:08 2010 (r6067) +++ plugins/google-calendar/src/gdata_format.c Fri Jul 9 21:22:14 2010 (r6068) @@ -46,7 +46,7 @@ osync_bool *free_input, const char *config, void *userdata, OSyncError **error) { - /* TODO: how to get path to XSLT file using 'config'? */ + // TODO: how to get path to XSLT file using 'config'? return FALSE; } @@ -55,7 +55,7 @@ osync_bool *free_input, const char *config, void *userdata, OSyncError **error) { - /* TODO: how to get path to XSLT file using 'config'? */ + // TODO: how to get path to XSLT file using 'config'? return FALSE; } @@ -64,7 +64,7 @@ osync_bool *free_input, const char *config, void *userdata, OSyncError **error) { - /* TODO: how to get path to XSLT file using 'config'? */ + // TODO: how to get path to XSLT file using 'config'? return FALSE; } @@ -73,7 +73,7 @@ osync_bool *free_input, const char *config, void *userdata, OSyncError **error) { - /* TODO: how to get path to XSLT file using 'config'? */ + // TODO: how to get path to XSLT file using 'config'? return FALSE; } @@ -88,7 +88,8 @@ if (!gevent) return FALSE; - /* TODO: register (and write) auxiliary functions: compare/create/destroy/blah...*/ + // TODO: register (and write) auxiliary functions: + // compare/create/destroy/blah... osync_format_env_register_objformat(env, gcont); osync_objformat_unref(gcont); @@ -120,17 +121,17 @@ OSyncFormatConverter *conv = NULL; OSyncError *error = NULL; - /* osync xml formats */ + // osync xml formats OSyncObjFormat *xml_contact = osync_format_env_find_objformat(env, "xmlformat-contact"); OSyncObjFormat *xml_event = osync_format_env_find_objformat(env, "xmlformat-event"); - /* gdata formats */ + // gdata formats OSyncObjFormat *gevent = osync_format_env_find_objformat(env, "google-event"); osync_assert(gevent); OSyncObjFormat *gcontact = osync_format_env_find_objformat(env, "google-contact"); osync_assert(gcontact); - /* from xmlformat to gdata */ + // from xmlformat to gdata conv = osync_converter_new(OSYNC_CONVERTER_CONV, xml_contact, gcontact, xmlcontact_to_gcontact, &error); osync_assert(conv); @@ -147,7 +148,7 @@ osync_format_env_register_converter(env, conv); osync_converter_unref(conv); - /* from gdata to xmlformat */ + // from gdata to xmlformat conv = osync_converter_new(OSYNC_CONVERTER_CONV, gcontact, xml_contact, gcontact_to_xmlcontact, &error); osync_assert(conv); @@ -172,3 +173,4 @@ { return 1; } + |
From: <svn...@op...> - 2010-07-09 19:22:16
|
Author: cdfrey Date: Fri Jul 9 21:22:08 2010 New Revision: 6067 URL: http://www.opensync.org/changeset/6067 Log: libgcal API changes and other related compile fixes This module now compiles!!! :-) Modified: plugins/google-calendar/src/gcalendar.c Modified: plugins/google-calendar/src/gcalendar.c ============================================================================== --- plugins/google-calendar/src/gcalendar.c Fri Jul 9 21:22:02 2010 (r6066) +++ plugins/google-calendar/src/gcalendar.c Fri Jul 9 21:22:08 2010 (r6067) @@ -241,7 +241,7 @@ OSyncChange *chg = NULL; int result = 0, i; char *timestamp = NULL, *msg, *raw_xml = NULL; - gcal_event event; + gcal_event_t event; OSyncError *state_db_error = NULL; if (!(osync_objtype_sink_get_state_db(sink))) @@ -389,7 +389,7 @@ OSyncChange *chg = NULL; int result = 0, i; char *timestamp = NULL, *msg, *raw_xml = NULL; - gcal_contact contact; + gcal_contact_t contact; OSyncError *state_db_error = NULL; if (!(osync_objtype_sink_get_state_db(sink))) @@ -467,7 +467,7 @@ raw_xml))) goto error; - raw_xml = plgdata->xslt_ctx_gcont->xml_str; + raw_xml = (char*) plgdata->xslt_ctx_gcont->xml_str; odata = osync_data_new(strdup(raw_xml), strlen(raw_xml), plgdata->gcont_format, &error); @@ -532,8 +532,9 @@ osync_trace(TRACE_INTERNAL, "hello, from calendar!\n"); //OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); struct gc_plgdata *plgdata = data; - gcal_event event = NULL; - int size, result; + gcal_event_t event = NULL; + unsigned int size; + int result; char *osync_xml = NULL, *msg = NULL, *raw_xml = NULL, *updated_event = NULL; OSyncData *odata = NULL; @@ -553,7 +554,7 @@ msg = "Failed converting from osync xmlevent to gcalendar\n"; goto error; } - raw_xml = plgdata->xslt_ctx_gcal->xml_str; + raw_xml = (char*) plgdata->xslt_ctx_gcal->xml_str; osync_trace(TRACE_EXIT, "osync: %s\ngcont: %s\n\n", osync_xml, raw_xml); @@ -573,8 +574,8 @@ break; case OSYNC_CHANGE_TYPE_MODIFIED: - result = gcal_update_xmlentry(plgdata->calendar, raw_xml, &updated_event, - NULL); + result = gcal_update_xmlentry(plgdata->calendar, + raw_xml, &updated_event, NULL, NULL); if (result == -1) { msg = "Failed editing event!\n"; goto error; @@ -644,8 +645,9 @@ osync_trace(TRACE_INTERNAL, "hello, from contacts!\n"); struct gc_plgdata *plgdata = data; - gcal_contact contact = NULL; - int size, result; + gcal_contact_t contact = NULL; + unsigned int size; + int result; char *osync_xml = NULL, *msg = NULL, *raw_xml = NULL, *updated_contact = NULL; OSyncData *odata = NULL; @@ -665,7 +667,7 @@ msg = "Failed converting from osync xmlcontact to gcontact\n"; goto error; } - raw_xml = plgdata->xslt_ctx_gcont->xml_str; + raw_xml = (char*) plgdata->xslt_ctx_gcont->xml_str; osync_trace(TRACE_INTERNAL, "osync: %s\ngcont: %s\n\n", osync_xml, raw_xml); @@ -685,8 +687,8 @@ break; case OSYNC_CHANGE_TYPE_MODIFIED: - result = gcal_update_xmlentry(plgdata->contacts, raw_xml, &updated_contact, - NULL); + result = gcal_update_xmlentry(plgdata->contacts, + raw_xml, &updated_contact, NULL, NULL); if (result == -1) { msg = "Failed editing contact!\n"; goto error; |