|
From: Daniel G. <go...@b1...> - 2009-11-12 08:50:32
|
On Monday 09 November 2009 07:08:32 pm Henrik /KaarPoSoft wrote:
[...]
>
> I have never figured out what the plugin's get_version is used for.
> Could it be used here?
Close, try get_sync_info(). get_sync_info() get called when all the plugins
get loaded:
e.g. osynctool --listplugins
Perfect example would be the SyncML plugin. It's registering 4 plugins in one
get_version() call...
You do this with osync_plugin_env_register_plugin() or so ...
Just set different names for the plugins, then you can have several default-
configuration, due to the different plugins names.
Example:
------8<-----
osync_bool get_sync_info(OSyncPluginEnv *env, OSyncError **error)
{
OSyncPlugin *plugin;
plugin = osync_plugin_new(error);
if (!plugin)
goto error;
osync_plugin_set_name(plugin, "syncml-http-server");
osync_plugin_set_longname(plugin, "SyncML over HTTP Server");
osync_plugin_set_description(plugin, "Plugin to synchronize with
SyncML over HTTP");
osync_plugin_set_initialize(plugin, syncml_http_server_init);
osync_plugin_set_finalize(plugin, finalize);
osync_plugin_set_discover(plugin, syncml_http_server_discover);
if (!osync_plugin_env_register_plugin(env, plugin, error))
goto error;
osync_plugin_unref(plugin);
plugin = osync_plugin_new(error);
if (!plugin)
goto error;
osync_plugin_set_name(plugin, "syncml-http-client");
osync_plugin_set_longname(plugin, "SyncML over HTTP Client");
osync_plugin_set_description(plugin, "Plugin to synchronize with
SyncML over HTTP");
osync_plugin_set_initialize(plugin, syncml_http_client_init);
osync_plugin_set_finalize(plugin, finalize);
osync_plugin_set_discover(plugin, syncml_http_client_discover);
if (!osync_plugin_env_register_plugin(env, plugin, error))
goto error;
osync_plugin_unref(plugin);
return TRUE;
error:
return FALSE;
}
----8<---
This is registering two plugins, which have two different dfeault-
configuration: syncml-http-client and syncml-http-server.
In the case of the SyncML plugin those plugins just differ in the plugin init
function and discover function.
>
> Any comments on this would be most appreciated.
[...]
This is what i try suggested some weeks ago to spawn several plugins for the
mozilla-sync to avoid that user have to set the external_command by their own.
It's just about registering some OSyncPlugin* to OSyncPluginEnv ... even if
those are the same shared-module or so.
Hope this helps.
Best Regards,
Daniel
--
Daniel Gollub Geschaeftsfuehrer: Ralph Dehner
FOSS Developer Unternehmenssitz: Vohburg
B1 Systems GmbH Amtsgericht: Ingolstadt
Mobil: +49-(0)-160 47 73 970 Handelsregister: HRB 3537
EMail: go...@b1... http://www.b1-systems.de
Adresse: B1 Systems GmbH, Osterfeldstraße 7, 85088 Vohburg
http://pgpkeys.pca.dfn.de/pks/lookup?op=get&search=0xED14B95C2F8CA78D
|