On Sun, May 03, 2009 at 09:25:28AM +0200, Nicolas wrote:
> "evo_cal->uri" is OK
> 
> but in the function "osync_sink_state_equal":
> old_value = osync_sink_state_get(sinkStateDB, key, error);
> old_value isn't OK ! value is empty !

[...]

> Only when you sync several objtype

Does this patch help at all?

- Chris



diff --git a/src/evolution2_ecal.c b/src/evolution2_ecal.c
index 87b71f0..97677af 100644
--- a/src/evolution2_ecal.c
+++ b/src/evolution2_ecal.c
@@ -98,7 +98,7 @@ static void evo2_ecal_connect(OSyncObjTypeSink *sink, 
OSyncPluginInfo *info, OSy
                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 @@ static void evo2_ecal_sync_done(OSyncObjTypeSink *sink, 
OSyncPluginInfo *info, O
                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_discover(OSyncEvoCalendar *evo_cal, 
OSyncCapabilities *caps
 
 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,10 @@ osync_bool evo2_ecal_initialize(OSyncEvoEnv *env, 
OSyncPluginInfo *info, const c
 
        OSyncPluginConfig *config = osync_plugin_info_get_config(info);
         OSyncPluginResource *resource = 
osync_plugin_config_find_active_resource(config, objtype);
+       uri_key = malloc(5 + strlen(objtype));
+       strcpy(uri_key, "uri_");
+       strcat(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);
diff --git a/src/evolution2_sync.h b/src/evolution2_sync.h
index 34625a5..dc17387 100644
--- a/src/evolution2_sync.h
+++ b/src/evolution2_sync.h
@@ -46,6 +46,7 @@ typedef struct evo2_location {
 } evo2_location;
 
 typedef struct OSyncEvoCalendar {
+       const char *uri_key;
        const char *uri;
        const char *objtype;
        const char *change_id;


------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Barry-devel mailing list
Barry-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/barry-devel

Reply via email to