From 35a366f01966b5c7cc105a7ff97c83970cd4211e Mon Sep 17 00:00:00 2001 From: Adenilson Cavalcanti Date: Wed, 3 Sep 2008 13:52:55 -0400 Subject: [PATCH] Adding infrastructure to create a format plugin (still doesn't nothing, but at least it builds/install fine). --- src/CMakeLists.txt | 4 ++++ src/gcalendar.c | 2 ++ src/gdata_format.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 src/gdata_format.c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 81a8f2b..db2ccfc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,13 +1,17 @@ + LINK_DIRECTORIES( ${OPENSYNC_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS} ${LIBXML2_LIBRARY_DIRS} ${LIBXSLT_LIBRARY_DIRS} ${LIBGCAL_LIBRARY_DIRS} ) INCLUDE_DIRECTORIES( ${OPENSYNC_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LIBXSLT_INCLUDE_DIRS} ${LIBGCAL_INCLUDE_DIRS} ) OPENSYNC_PLUGIN_ADD( gcalendar gcalendar.c ) +OPENSYNC_FORMAT_ADD( gdata-format gdata_format.c ) TARGET_LINK_LIBRARIES( gcalendar ${OPENSYNC_LIBRARIES} ${GLIB2_LIBRARIES} ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${LIBGCAL_LIBRARIES}) +TARGET_LINK_LIBRARIES( gdata-format ${OPENSYNC_LIBRARIES} ${GLIB2_LIBRARIES} ) ###### INSTALL ################### OPENSYNC_PLUGIN_INSTALL( gcalendar ) +OPENSYNC_FORMAT_INSTALL( gdata-format ) # Install config template OPENSYNC_PLUGIN_CONFIG( google-data ) diff --git a/src/gcalendar.c b/src/gcalendar.c index bad8e90..a98b9be 100644 --- a/src/gcalendar.c +++ b/src/gcalendar.c @@ -696,6 +696,7 @@ static void *gc_initialize(OSyncPlugin *plugin, if (plgdata->calendar) { osync_trace(TRACE_INTERNAL, "\tcreating calendar sink...\n"); OSyncFormatEnv *formatenv1 = osync_plugin_info_get_format_env(info); + /* TODO: put google-event here? */ plgdata->gcal_format = osync_format_env_find_objformat(formatenv1, "xmlformat-event"); if (!plgdata->gcal_format) goto error_freeplg; @@ -721,6 +722,7 @@ static void *gc_initialize(OSyncPlugin *plugin, if (plgdata->contacts) { osync_trace(TRACE_INTERNAL, "\tcreating contact sink...\n"); OSyncFormatEnv *formatenv2 = osync_plugin_info_get_format_env(info); + /* TODO: put google-contact here? */ plgdata->gcont_format = osync_format_env_find_objformat(formatenv2, "xmlformat-contact"); if (!plgdata->gcont_format) goto error_freeplg; diff --git a/src/gdata_format.c b/src/gdata_format.c new file mode 100644 index 0000000..9652a2c --- /dev/null +++ b/src/gdata_format.c @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2004-2005 Armin Bauer + * Copyright (C) 2008 Instituto Nokia de Tecnologia + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/** + * @file gdata_format.c + * @author Adenilson Cavalcanti da Silva + * @date Wed Sep 3 12:33:08 2008 + * + * @brief A google data (contacts/calendar events) format plugin. + * + * It seems to be requirement to make the whole thing work, yada, yada, yada. I'm taking + * as a base the mock_format.c file from opensync trunk and hoping for the best. + */ + +#include "xslt_aux.h" + +#include +#include + +osync_bool get_conversion_info(OSyncFormatEnv *env, OSyncError **error) +{ + OSyncFormatConverter *conv = NULL; + + return TRUE; +} + +int get_version(void) +{ + return 1; +} -- 2.11.4.GIT