From: <svn...@op...> - 2009-03-09 08:49:40
|
Author: bricks Date: Mon Mar 9 09:49:26 2009 New Revision: 5283 URL: http://www.opensync.org/changeset/5283 Log: ported example plugins to latest api changes (objtypesink userdata pointer) Modified: trunk/docs/examples/plugins/src/plugin.c trunk/docs/examples/plugins/src/simple_plugin.c Modified: trunk/docs/examples/plugins/src/plugin.c ============================================================================== --- trunk/docs/examples/plugins/src/plugin.c Sun Mar 8 18:00:56 2009 (r5282) +++ trunk/docs/examples/plugins/src/plugin.c Mon Mar 9 09:49:26 2009 (r5283) @@ -28,12 +28,10 @@ { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); //Each time you get passed a context (which is used to track - //calls to your plugin) you can get the data your returned in - //initialize via this call: - // plugin_environment *env = (plugin_environment *)userdata; + //calls to your plugin) - //The sink specific userdata you can get with this call: - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + //cast void* userdata to the sink specific data type + sink_environment *sinkenv = (sink_environment*)userdata; OSyncError *error = NULL; @@ -89,9 +87,8 @@ { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); - //plugin_environment *env = (plugin_environment *)userdata; OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env(info); - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + sink_environment *sinkenv = (sink_environment*)userdata; OSyncError *error = NULL; @@ -222,7 +219,7 @@ { //plugin_environment *env = (plugin_environment *)userdata; - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + sink_environment *sinkenv = (sink_environment*)userdata; /* * Here you have to add, modify or delete a object @@ -260,7 +257,7 @@ * This function will only be called if the sync was successful */ OSyncError *error = NULL; - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + sink_environment *sinkenv = (sink_environment*)userdata; //If we use anchors we have to update it now. //Now you get/calculate the current anchor of the device @@ -284,7 +281,7 @@ static void disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + sink_environment *sinkenv = (sink_environment*)userdata; //Close all stuff you need to close Modified: trunk/docs/examples/plugins/src/simple_plugin.c ============================================================================== --- trunk/docs/examples/plugins/src/simple_plugin.c Sun Mar 8 18:00:56 2009 (r5282) +++ trunk/docs/examples/plugins/src/simple_plugin.c Mon Mar 9 09:49:26 2009 (r5283) @@ -35,12 +35,10 @@ { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); //Each time you get passed a context (which is used to track - //calls to your plugin) you can get the data your returned in - //initialize via this call: - // plugin_environment *env = (plugin_environment *)userdata; + //calls to your plugin) - //The sink specific userdata you can get with this call: - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + //cast void* userdata to the sink specific data type + sink_environment *sinkenv = (sink_environment*)userdata; OSyncError *error = NULL; @@ -88,9 +86,8 @@ { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, userdata, info, ctx); - //plugin_environment *env = (plugin_environment *)userdata; OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env(info); - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + sink_environment *sinkenv = (sink_environment*) userdata; OSyncError *error = NULL; @@ -161,9 +158,7 @@ static void commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata) { - //plugin_environment *env = (plugin_environment *)userdata; - - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + sink_environment *sinkenv = (sink_environment*)userdata;; /* * Here you have to add, modify or delete a object @@ -196,7 +191,7 @@ * This function will only be called if the sync was successful */ OSyncError *error = NULL; - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + sink_environment *sinkenv = (sink_environment*)userdata; //If we use anchors we have to update it now. //Now you get/calculate the current anchor of the device @@ -213,9 +208,9 @@ return; } -static void disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) +static void disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + sink_environment *sinkenv = (sink_environment*)userdata; //Close all stuff you need to close |