From: <svn...@op...> - 2009-05-05 09:06:33
|
Author: bellmich Date: Tue May 5 11:06:16 2009 New Revision: 5635 URL: http://www.opensync.org/changeset/5635 Log: committed patch from nicklas in ticket #1111 (fixes problems with more than one concurrent evolution data store like memo, task and todo) Modified: plugins/evolution2/src/evolution2_ecal.c plugins/evolution2/src/evolution2_sync.h Modified: plugins/evolution2/src/evolution2_ecal.c ============================================================================== --- plugins/evolution2/src/evolution2_ecal.c Wed Apr 29 14:15:50 2009 (r5634) +++ plugins/evolution2/src/evolution2_ecal.c Tue May 5 11:06:16 2009 (r5635) @@ -98,7 +98,7 @@ osync_error_set(&error, OSYNC_ERROR_GENERIC, "Anchor missing for objtype \"%s\"", osync_objtype_sink_get_name(sink)); goto error_free_cal; } - if (!osync_sink_state_equal(state_db, "uri", evo_cal->uri, &state_match, &error)) { + if (!osync_sink_state_equal(state_db, evo_cal->uri_key, evo_cal->uri, &state_match, &error)) { osync_error_set(&error, OSYNC_ERROR_GENERIC, "Anchor comparison failed for objtype \"%s\"", osync_objtype_sink_get_name(sink)); goto error_free_cal; } @@ -151,7 +151,7 @@ osync_error_set(&error, OSYNC_ERROR_GENERIC, "State database missing for objtype \"%s\"", osync_objtype_sink_get_name(sink)); goto error; } - if (!osync_sink_state_set(state_db, "uri", evo_cal->uri, &error)) + if (!osync_sink_state_set(state_db, evo_cal->uri_key, evo_cal->uri, &error)) goto error; GList *changes = NULL; @@ -397,6 +397,7 @@ osync_bool evo2_ecal_initialize(OSyncEvoEnv *env, OSyncPluginInfo *info, const char *objtype, const char *required_format, OSyncError **error) { + char *uri_key; osync_assert(env); osync_assert(info); @@ -428,6 +429,14 @@ OSyncPluginConfig *config = osync_plugin_info_get_config(info); OSyncPluginResource *resource = osync_plugin_config_find_active_resource(config, objtype); + + const int size = strlen(STR_URI_KEY) + strlen(objtype) + 1; + + uri_key = malloc(size * sizeof(char)); + + snprintf(uri_key, size, "%s%s", STR_URI_KEY, objtype); + + cal->uri_key = uri_key; cal->uri = osync_plugin_resource_get_url(resource); if(!cal->uri) { osync_error_set(error,OSYNC_ERROR_GENERIC, "%s url not set", objtype); Modified: plugins/evolution2/src/evolution2_sync.h ============================================================================== --- plugins/evolution2/src/evolution2_sync.h Wed Apr 29 14:15:50 2009 (r5634) +++ plugins/evolution2/src/evolution2_sync.h Tue May 5 11:06:16 2009 (r5635) @@ -40,12 +40,16 @@ #define e_cal_component_get_recurid_as_string() See_evolution2_sync_h_for_note +#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; const char *objtype; const char *change_id; |