Changeset 3395

Show
Ignore:
Timestamp:
07/07/08 09:48:56 (2 months ago)
Author:
dgollub
Message:

Handle the case that a plugin can have no plugin configuration.
Since the implementation of OSyncPluginRessource it's very unlikely that
a plugin will not have any configuration.

TODO: Split OSyncPluginRessource in a seperated configuration.
Independent of OSyncPluginConfig.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/opensync/client/opensync_client.c

    r3348 r3395  
    464464        char *configdir = NULL; 
    465465        char *formatdir = NULL; 
     466        int haspluginconfig = 0; 
    466467        OSyncPluginConfig *config = NULL; 
    467468        OSyncQueue *outgoing = NULL; 
     
    475476        osync_message_read_string(message, &groupname); 
    476477        osync_message_read_string(message, &configdir); 
    477  
    478         if (!osync_demarshal_pluginconfig(message, &config, error)) 
     478        osync_message_read_int(message, &haspluginconfig); 
     479 
     480        if (haspluginconfig && !osync_demarshal_pluginconfig(message, &config, error)) 
    479481                goto error; 
    480482         
     
    526528         
    527529        osync_plugin_info_set_configdir(client->plugin_info, configdir); 
    528         osync_plugin_info_set_config(client->plugin_info, config); 
    529530        osync_plugin_info_set_loop(client->plugin_info, client->context); 
    530531        osync_plugin_info_set_format_env(client->plugin_info, client->format_env); 
    531532        osync_plugin_info_set_groupname(client->plugin_info, groupname); 
     533 
     534        if (config) 
     535                osync_plugin_info_set_config(client->plugin_info, config); 
    532536         
    533537#ifdef OPENSYNC_UNITTESTS 
     
    584588        g_free(groupname); 
    585589        g_free(formatdir); 
    586         osync_plugin_config_unref(config); 
     590         
     591        if (config) 
     592                osync_plugin_config_unref(config); 
    587593         
    588594        osync_trace(TRACE_EXIT, "%s", __func__); 
     
    600606        g_free(groupname); 
    601607        g_free(formatdir); 
    602         osync_plugin_config_unref(config); 
     608 
     609        if (config) 
     610                osync_plugin_config_unref(config); 
     611 
    603612        osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); 
    604613        return FALSE; 
  • trunk/opensync/client/opensync_client_proxy.c

    r3348 r3395  
    10041004        osync_assert(proxy); 
    10051005         
     1006        int haspluginconfig = config ? TRUE : FALSE; 
     1007 
    10061008        callContext *ctx = osync_try_malloc0(sizeof(callContext), error); 
    10071009        if (!ctx) 
     
    10221024        osync_message_write_string(message, groupname); 
    10231025        osync_message_write_string(message, configdir); 
    1024  
    1025         if (!osync_marshal_pluginconfig(message, config, error)) 
     1026        osync_message_write_int(message, haspluginconfig); 
     1027 
     1028        if (haspluginconfig && !osync_marshal_pluginconfig(message, config, error)) 
    10261029                goto error; 
    10271030