From: <svn...@op...> - 2009-04-11 18:28:10
|
Author: scriptor Date: Sat Apr 11 20:28:01 2009 New Revision: 5573 URL: http://www.opensync.org/changeset/5573 Log: Added some tests about the detector functions. Added: plugins/ldap-sync/tests/check_convert_from_to (contents, props changed) plugins/ldap-sync/tests/check_detector1.c plugins/ldap-sync/tests/check_do_convert_from_to.c plugins/ldap-sync/tests/vcards/ plugins/ldap-sync/tests/vcards/README plugins/ldap-sync/tests/vcards/evo2-full1.vcf plugins/ldap-sync/tests/vcards/evo2-full2.vcf plugins/ldap-sync/tests/vcards/evo2-multiline.vcf plugins/ldap-sync/tests/vcards/evo2-photo.vcf plugins/ldap-sync/tests/vcards/evo2-special.vcf plugins/ldap-sync/tests/vcards/evo2-umlaute.vcf plugins/ldap-sync/tests/vcards/kdepim-full1-2.1.vcf plugins/ldap-sync/tests/vcards/kdepim-full1-3.0.vcf plugins/ldap-sync/tests/vcards/kdepim-full2-2.1.vcf plugins/ldap-sync/tests/vcards/kdepim-full2-3.0.vcf plugins/ldap-sync/tests/vcards/kdepim-multiline-2.1.vcf plugins/ldap-sync/tests/vcards/kdepim-multiline-3.0.vcf plugins/ldap-sync/tests/vcards/kdepim-nonuid-2.1.vcf plugins/ldap-sync/tests/vcards/kdepim-photo1-2.1.vcf plugins/ldap-sync/tests/vcards/kdepim-photo1-3.0.vcf plugins/ldap-sync/tests/vcards/kdepim-photo2-2.1.vcf plugins/ldap-sync/tests/vcards/kdepim-photo2-3.0.vcf plugins/ldap-sync/tests/vcards/kdepim-sound1-2.1.vcf plugins/ldap-sync/tests/vcards/kdepim-sound1-3.0.vcf plugins/ldap-sync/tests/vcards/kdepim-sound2-2.1.vcf plugins/ldap-sync/tests/vcards/kdepim-sound2-3.0.vcf plugins/ldap-sync/tests/vcards/kdepim-special-2.1.vcf plugins/ldap-sync/tests/vcards/kdepim-special-3.0.vcf plugins/ldap-sync/tests/vcards/kdepim-umlaute-2.1.vcf plugins/ldap-sync/tests/vcards/kdepim-umlaute-3.0.vcf plugins/ldap-sync/tests/vevents/ plugins/ldap-sync/tests/vevents/README plugins/ldap-sync/tests/vevents/evolution2-1-hour-alarm.vcf plugins/ldap-sync/tests/vevents/evolution2-1-hour-alarm2.vcf plugins/ldap-sync/tests/vevents/evolution2-1-hour.vcf plugins/ldap-sync/tests/vevents/evolution2-all-day.vcf plugins/ldap-sync/tests/vevents/evolution2-all-day2.vcf plugins/ldap-sync/tests/vevents/evolution2-evo2-recur-until.vcf plugins/ldap-sync/tests/vevents/evolution2-free-busy.vcf plugins/ldap-sync/tests/vevents/evolution2-full-special.vcf plugins/ldap-sync/tests/vevents/evolution2-rec-every-year.vcf plugins/ldap-sync/tests/vevents/evolution2-rec-except.vcf plugins/ldap-sync/tests/vevents/evolution2-rec-for.vcf plugins/ldap-sync/tests/vevents/evolution2-rec-forever.vcf plugins/ldap-sync/tests/vevents/evolution2-rec-until.vcf plugins/ldap-sync/tests/vevents/kdepim-1-hour-1.0.vcs plugins/ldap-sync/tests/vevents/kdepim-1-hour-2.0.ics plugins/ldap-sync/tests/vnotes/ plugins/ldap-sync/tests/vnotes/README plugins/ldap-sync/tests/vnotes/vnote-minimal.vnt plugins/ldap-sync/tests/vnotes/vnote1-same.vnt plugins/ldap-sync/tests/vnotes/vnote1-similar.vnt plugins/ldap-sync/tests/vnotes/vnote1.vnt plugins/ldap-sync/tests/vnotes/vnote2.vnt plugins/ldap-sync/tests/vnotes/vnote3.vnt plugins/ldap-sync/tests/vtodos/ plugins/ldap-sync/tests/vtodos/README plugins/ldap-sync/tests/vtodos/evolution2-todo-full1.vcf plugins/ldap-sync/tests/vtodos/evolution2-todo-full2.vcf plugins/ldap-sync/tests/vtodos/evolution2-todo-full3.vcf plugins/ldap-sync/tests/vtodos/evolution2-todo-full4.vcf plugins/ldap-sync/tests/vtodos/evolution2-todo-full5.vcf plugins/ldap-sync/tests/vtodos/evolution2-todo-full6.vcf plugins/ldap-sync/tests/vtodos/evolution2-todo-full7.vcf plugins/ldap-sync/tests/vtodos/evolution2-todo-simple.vcf plugins/ldap-sync/tests/vtodos/kdepim-todoful1.vcs plugins/ldap-sync/tests/xmlformats/ plugins/ldap-sync/tests/xmlformats/README plugins/ldap-sync/tests/xmlformats/contact.xml plugins/ldap-sync/tests/xmlformats/contact1.xml plugins/ldap-sync/tests/xmlformats/contact2.xml plugins/ldap-sync/tests/xmlformats/contact3.xml plugins/ldap-sync/tests/xmlformats/contact3_unique.xml plugins/ldap-sync/tests/xmlformats/contact4.xml plugins/ldap-sync/tests/xmlformats/contact4_unique.xml plugins/ldap-sync/tests/xmlformats/event.xml Modified: plugins/ldap-sync/tests/CMakeLists.txt Modified: plugins/ldap-sync/tests/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/tests/CMakeLists.txt Sat Apr 11 20:27:17 2009 (r5572) +++ plugins/ldap-sync/tests/CMakeLists.txt Sat Apr 11 20:28:01 2009 (r5573) @@ -4,7 +4,7 @@ # So I have simply commented out those tests, where some data is missing # or where the errors are known to me. -OPTION ( RUN_LONG_TESTS "Should the tests with osynctool running under valgrind be run? They take quite some time.") +OPTION ( RUN_LONG_TESTS "Should the tests with osynctool running under valgrind be run? They take quite some time." off) SET ( TESTDIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE STRING "Path where the test scripts are located.") SET ( XSLDIR "${CMAKE_SOURCE_DIR}/src/xslt" CACHE STRING "Path where the stylesheeets are located.") @@ -284,6 +284,56 @@ ADD_TEST( plugin4 ${TESTDIR}/check_osynctool_file1 "plugin4" ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) + +############################################### +# Check the detector functions: +ADD_EXECUTABLE( check_detector1 check_detector1.c ) + +LINK_DIRECTORIES( ${OPENSYNC_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS} ${LIBXML2_LIBRARY_DIRS} ${LIBXSLT_LIBRARY_DIRS} ) +INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${OPENSYNC_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LIBXSLT_INCLUDE_DIRS} ) +TARGET_LINK_LIBRARIES( check_detector1 ${OPENSYNC_LIBRARIES} ${GLIB2_LIBRARIES} ${LIBXML2_LIBRARY_DIRS} ${LIBXSLT_LIBRARIES} ) + +ADD_TEST( detect1 check_detector1 ${TESTDIR}/contact1.xml ) + +ADD_TEST( detect2 check_detector1 ${TESTDIR}/contact2.xml ) + +ADD_TEST( detect3 check_detector1 ${TESTDIR}/event1.xml ) + +ADD_TEST( detect4 check_detector1 ${TESTDIR}/todo1.xml ) + +ADD_TEST( detect5 check_detector1 ${TESTDIR}/note1.xml ) + +ADD_TEST( detect6 check_detector1 ${TESTDIR}/note2.xml ) + +# This would be a "correct negative", if I may say so: +# We expect the script to fail. And this failing would be OK. +#ADD_TEST( false_result check_detector1 ${TESTDIR}/check_detector1.c ) + + + + + +######################################################### +# Check the converter functions: +ADD_EXECUTABLE( check_do_convert_from_to check_do_convert_from_to.c ) + +LINK_DIRECTORIES( ${OPENSYNC_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS} ${LIBXML2_LIBRARY_DIRS} ${LIBXSLT_LIBRARY_DIRS} ) +INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} ${OPENSYNC_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LIBXSLT_INCLUDE_DIRS} ) +TARGET_LINK_LIBRARIES( check_do_convert_from_to ${OPENSYNC_LIBRARIES} ${GLIB2_LIBRARIES} ${LIBXML2_LIBRARY_DIRS} ${LIBXSLT_LIBRARIES} ) + +ADD_TEST( convert_vcards1 ${TESTDIR}/check_convert_from_to ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/vcards/*.vcf" "--to-ldap-evolutionperson" ) +ADD_TEST( convert_vcards2 ${TESTDIR}/check_convert_from_to ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/vcards/*.vcf" "--to-ldap-inetorgperson" ) +ADD_TEST( convert_vevents1 ${TESTDIR}/check_convert_from_to ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/vevents/*.?c?" "--to-ldap-event" ) +ADD_TEST( convert_vtodos1 ${TESTDIR}/check_convert_from_to ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/vtodos/*.vc?" "--to-ldap-todo" ) +ADD_TEST( convert_vnotes1 ${TESTDIR}/check_convert_from_to ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/vnotes/*.vnt" "--to-ldap-note" ) +ADD_TEST( convert_xmlformat_contacts1 ${TESTDIR}/check_convert_from_to ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/xmlformats/contact*.xml" "--to-ldap-evolutionperson" ) +ADD_TEST( convert_xmlformat_contacts2 ${TESTDIR}/check_convert_from_to ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/xmlformats/contact*.xml" "--to-ldap-inetorgperson" ) +ADD_TEST( convert_xmlformat_event ${TESTDIR}/check_convert_from_to ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/tests/xmlformats/event*.xml" "--to-ldap-event" ) + + + + + ########################################################## # Interact with the LDAP server using external tools only... # This set of tests checks whether the LDAP server is sufficiently Added: plugins/ldap-sync/tests/check_convert_from_to ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/check_convert_from_to Sat Apr 11 20:28:01 2009 (r5573) @@ -0,0 +1,113 @@ +#!/bin/bash + +set -x + +FILE=$0 +PLUGINNAME="ldap-sync" +PLUGINPATH="$1/src" +BUILDDIR=$1 +SOURCEFORMAT_EXPRESSION="$3" +TARGETFORMAT="$4" + + + +if test -z "$SOURCEFORMAT_EXPRESSION"; then + echo "$FILE:$LINENO: ERROR: \$TARGETFORMAT is empty. Exiting." + exit 1; +fi + + +if test -z "$TARGETFORMAT"; then + echo "$FILE:$LINENO: ERROR: \$TARGETFORMAT is empty. Exiting." + exit 1; +fi + + + +SOURCE_DIR=`dirname $FILE` +if test ! -d "$SOURCE_DIR"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR\" is not a directory. Exiting." + exit 1 +fi + +if test ! -r "$SOURCE_DIR/test.conf"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/test.conf\" could not be read. Exiting." + exit 1 +fi + +if test ! -r "$SOURCE_DIR/check_osynctool_common.inc"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/test.conf\" could not be read. Exiting." + exit 1 +fi + +CHECK_DO_CONVERT_FROM_TO=$(which check_do_convert_from_to 2> /dev/null) +if test -z "$CHECK_DO_CONVERT_FROM_TO"; then + if test -f "./check_do_convert_from_to"; then + CHECK_DO_CONVERT_FROM_TO="./check_do_convert_from_to" + else + dir=$(dirname $FILE) + if test -d "$dir"; then + if test -f "${dir}/check_do_convert_from_to"; then + CHECK_DO_CONVERT_FROM_TO="${dir}/check_do_convert_from_to" + else + if test -d "$BUILDDIR"; then + CHECK_DO_CONVERT_FROM_TO="${BUILDDIR}/tests/check_do_convert_from_to" + fi + fi + fi + fi +fi + + + +if test -z "$CHECK_DO_CONVERT_FROM_TO"; then + echo "$FILE:$LINENO: ERROR: \$CHECK_DO_CONVERT_FROM_TO is empty. Exiting." + exit 1; +fi + +if test ! -f "$CHECK_DO_CONVERT_FROM_TO"; then + echo "$FILE:$LINENO: ERROR: $CHECK_DO_CONVERT_FROM_TO could not be found. Exiting." + exit 1; +fi + +if test ! -x "$CHECK_DO_CONVERT_FROM_TO"; then + echo "$FILE:$LINENO: ERROR: $CHECK_DO_CONVERT_FROM_TO could be found, but is not executable. Exiting." + exit 1; +fi + + +source "$SOURCE_DIR/test.conf" +TMPDIR=`mktemp -d /tmp/ldap_sync_test.XXXXXX` || exit 1 +echo "TMPDIR = \"$TMPDIR\"" + + +echo -e "\n\n\nAbout to convert to $TARGETFORMAT:" +for f in $SOURCEFORMAT_EXPRESSION; do + echo "$f" +done +echo -e "\n\n\n" + + + +rv=1 +for f in $SOURCEFORMAT_EXPRESSION; do + $CHECK_DO_CONVERT_FROM_TO $f $TARGETFORMAT + rv=$? + if test $rv -ne 0; then + if test -d "$TMPDIR"; then + rm -rf "$TMPDIR" + fi + exit 1 + fi +done + + + + + +if test -d "$TMPDIR"; then + rm -rf "$TMPDIR" +fi + +exit $rv + Added: plugins/ldap-sync/tests/check_detector1.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/check_detector1.c Sat Apr 11 20:28:01 2009 (r5573) @@ -0,0 +1,190 @@ +/* + * $Id: check_detector1.c 5382 2009-03-28 18:09:31Z scriptor $ + * + * ldap-sync - A plugin for the opensync framework + * + * Copyright (C) 2009 Juergen Leising <jle...@us...> + * + * 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 + * + */ + + + +#include <errno.h> +#include <opensync/opensync.h> +#include <opensync/opensync-data.h> +#include <opensync/opensync-format.h> +#include <opensync/opensync-helper.h> +#include <opensync/opensync-plugin.h> +#include <stdio.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> + + + +int usage(char *name); + + +int usage(char *name) +{ + if (name == NULL) { + name = (char *)__FILE__; + } + + fprintf (stderr, "Usage: %s <inputfile> <options>\n\n", name); + fprintf (stderr, "--help\t\tShow this help message\n"); + fprintf (stderr, "--out <file>\tStore the output into this file. Leaving out this option means, print it to stdout.\n"); + return 1; +} + + + +int main (int argc, char *argv[]) +{ + OSyncData *data = NULL; + OSyncError *error = NULL; + OSyncFormatEnv *format_env = NULL; + OSyncObjFormat *sourceformat = NULL; + OSyncFormatConverterPath *converter_path = NULL; + char *input_filename = NULL; + char *buffer = NULL; + struct stat stat_buffer; + unsigned int size; + + + + if (argc < 2) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Not enough arguments. You must state the name of the input file to be converted.", __FILE__, __LINE__); + goto error; + } + + + if (!strcmp(argv[0], "-h") || !strcmp(argv[0], "--help")) { + usage(argv[0]); + return 0; + } + + + + + input_filename = argv[1]; + + if (input_filename == NULL) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: input_filename = NULL. input_filename has not been set.", __FILE__, __LINE__); + + goto error; + } + + errno = 0; + if (stat(input_filename, &stat_buffer)) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Could not load \"%s\": %s", __FILE__, __LINE__, input_filename, strerror(errno)); + goto error; + } + + + // Load the contents of the input file into buffer + if (!osync_file_read(input_filename, &buffer, &size, &error)) { + if (!osync_error_is_set(&error)) + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_file_read() has failed.", __FILE__, __LINE__); + + goto error; + } + + // The size returned by osync_file_read() does NOT include the + // terminating 0. But we need a size that does include it. + size++; + + + // Allocate a new format environment + format_env = osync_format_env_new(&error); + if (format_env == NULL) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: format_env = NULL. ", __FILE__, __LINE__); + goto error; + } + + + // Let the format environment load all kinds of plugins + if (!osync_format_env_load_plugins(format_env, NULL, &error)) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Could not load any format plugin.", __FILE__, __LINE__); + goto error; + } + + + // Alloacate a format object specifically intended for the input file. + // At first, we create an OSyncData object with "plain" as sort of a + // general object format. Just to have something to begin with. + sourceformat = osync_format_env_find_objformat(format_env, "plain"); + if (sourceformat == NULL) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: sourceformat = NULL. Objformat object could not be generated.", __FILE__, __LINE__); + goto error; + } + + + // Allocate a new data object with the contents of the input file + data = osync_data_new(buffer, size, sourceformat, &error); + if (data == NULL) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: data = NULL.", __FILE__, __LINE__); + goto error; + } + + + // Analyze the source format and redefine the format object. + sourceformat = osync_format_env_detect_objformat(format_env, data); + if (sourceformat == NULL) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: sourceformat = NULL. Source format could NOT be recognized.", __FILE__, __LINE__); + goto error; + } + + + // Tell the data object what kind of source format we have just found. + osync_data_set_objformat(data, sourceformat); + if (osync_error_is_set(&error)) { + goto error; + } + + + + if (data) + osync_data_unref(data); + + if (converter_path) + osync_converter_path_unref(converter_path); + + if (format_env) + osync_format_env_unref(format_env); + + return 0; + + +error: + if (data) + osync_data_unref(data); + + if (converter_path) + osync_converter_path_unref(converter_path); + + if (format_env) + osync_format_env_unref(format_env); + + if (osync_error_is_set(&error)) { + fprintf(stderr, "%s\n", osync_error_print(&error)); + osync_error_unref(&error); + } + + return 1; +} Added: plugins/ldap-sync/tests/check_do_convert_from_to.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/check_do_convert_from_to.c Sat Apr 11 20:28:01 2009 (r5573) @@ -0,0 +1,933 @@ +/* + * $Id$ + * + * ldap-sync - A plugin for the opensync framework + * + * Copyright (C) 2009 Juergen Leising <jle...@us...> + * + * 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 + * + */ + + + +#include <errno.h> +#include <opensync/opensync.h> +#include <opensync/opensync-data.h> +#include <opensync/opensync-format.h> +#include <opensync/opensync-helper.h> +#include <opensync/opensync-plugin.h> +#include <stdio.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> + +#undef DEBUG + + + + +typedef enum conv_detection { + TARGET_AUTO = 0, + TARGET_VCARD_21, + TARGET_VCARD_30, + TARGET_LDAP_EVOLUTIONPERSON, + TARGET_LDAP_INETORGPERSON, + TARGET_VEVENT_10, + TARGET_VEVENT_20, + TARGET_LDAP_EVENT, + TARGET_VTODO_10, + TARGET_VTODO_20, + TARGET_LDAP_TODO, + TARGET_VNOTE_11, + TARGET_VJOURNAL, + TARGET_LDAP_NOTE, + TARGET_XMLFORMAT +} conv_detection; + + + + +OSyncObjFormat *conv_run_detection(OSyncFormatEnv *env, const char *sfname, conv_detection type, OSyncError **error); +int usage(char *name); + + + + + + + + + + + + + + + +OSyncObjFormat *conv_run_detection(OSyncFormatEnv *env, const char *sfname, conv_detection type, OSyncError **error) +{ + OSyncObjFormat *targetformat = NULL; + + + if (env == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: env = NULL. ", __FILE__, __LINE__); + goto error; + } + + if (sfname == NULL) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: sfname = NULL. ", __FILE__, __LINE__); + goto error; + } + + + + fprintf(stderr, "Type of the source format: \"%s\".\n", sfname); + + + + if (!strcmp(sfname, "vcard21")) { + switch (type) { + case TARGET_AUTO: + case TARGET_VCARD_30: + targetformat = osync_format_env_find_objformat(env, "vcard30"); + break; + + case TARGET_LDAP_EVOLUTIONPERSON: + targetformat = osync_format_env_find_objformat(env, "ldap-evolutionperson"); + break; + + case TARGET_LDAP_INETORGPERSON: + targetformat = osync_format_env_find_objformat(env, "ldap-inetorgperson"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-contact"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert vcard21 into this format. Supported formats: xmlformat, ldap-evolutionperson, ldap-inetorgperson, vcard30.", __FILE__, __LINE__); + goto error; + } + + + + } else if (!strcmp(sfname, "vcard30")) { + switch (type) { + case TARGET_AUTO: + case TARGET_VCARD_21: + targetformat = osync_format_env_find_objformat(env, "vcard21"); + break; + + case TARGET_LDAP_EVOLUTIONPERSON: + targetformat = osync_format_env_find_objformat(env, "ldap-evolutionperson"); + break; + + case TARGET_LDAP_INETORGPERSON: + targetformat = osync_format_env_find_objformat(env, "ldap-inetorgperson"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-contact"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert vcard30 into this format. Supported formats: xmlformat, ldap-evolutionperson, ldap-inetorgperson, vcard21.", __FILE__, __LINE__); + goto error; + } + + + + } else if (!strcmp(sfname, "vevent10")) { + switch (type) { + case TARGET_AUTO: + case TARGET_VEVENT_20: + targetformat = osync_format_env_find_objformat(env, "vevent20"); + break; + + case TARGET_LDAP_EVENT: + targetformat = osync_format_env_find_objformat(env, "ldap-event"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-event"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert vevent10 into this format. Supported formats: xmlformat, ldap-event, vevent20.", __FILE__, __LINE__); + goto error; + } + + + + } else if (!strcmp(sfname, "vevent20")) { + switch (type) { + case TARGET_AUTO: + case TARGET_VEVENT_10: + targetformat = osync_format_env_find_objformat(env, "vevent10"); + break; + + case TARGET_LDAP_EVENT: + targetformat = osync_format_env_find_objformat(env, "ldap-event"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-event"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert vevent20 into this format. Supported formats: xmlformat, ldap-event, vevent10.", __FILE__, __LINE__); + goto error; + } + + + + } else if (!strcmp(sfname, "vtodo10")) { + switch (type) { + case TARGET_AUTO: + case TARGET_VTODO_20: + targetformat = osync_format_env_find_objformat(env, "vtodo20"); + break; + + case TARGET_LDAP_TODO: + targetformat = osync_format_env_find_objformat(env, "ldap-todo"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-todo"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert vtodo10 into this format. Supported formats: xmlformat, ldap-todo, vtodo20.", __FILE__, __LINE__); + goto error; + } + + + + } else if (!strcmp(sfname, "vtodo20")) { + switch (type) { + case TARGET_AUTO: + case TARGET_VTODO_10: + targetformat = osync_format_env_find_objformat(env, "vtodo10"); + break; + + case TARGET_LDAP_TODO: + targetformat = osync_format_env_find_objformat(env, "ldap-todo"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-todo"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert vtodo20 into this format. Supported formats: xmlformat, ldap-todo, vtodo10\n", __FILE__, __LINE__); + goto error; + } + + + + } else if (!strcmp(sfname, "vnote11")) { + switch (type) { + case TARGET_AUTO: + case TARGET_VJOURNAL: + targetformat = osync_format_env_find_objformat(env, "vjournal"); + break; + + case TARGET_LDAP_NOTE: + targetformat = osync_format_env_find_objformat(env, "ldap-note"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-note"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert vnote11 into this format. Supported formats: xmlformat, ldap-note, vjournal.", __FILE__, __LINE__); + goto error; + } + + + + } else if (!strcmp(sfname, "vjournal")) { + switch (type) { + case TARGET_AUTO: + case TARGET_VNOTE_11: + targetformat = osync_format_env_find_objformat(env, "vnote11"); + break; + + case TARGET_LDAP_NOTE: + targetformat = osync_format_env_find_objformat(env, "ldap-event"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-note"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert vjournal into this format. Supported formats: xmlformat, ldap-note, vnote11.", __FILE__, __LINE__); + goto error; + } + + + + } else if (!strcmp(sfname, "xmlformat-contact-doc") || !strcmp(sfname, "xmlformat-contact")) { + switch (type) { + case TARGET_LDAP_EVOLUTIONPERSON: + targetformat = osync_format_env_find_objformat(env, "ldap-evolutionperson"); + break; + + case TARGET_LDAP_INETORGPERSON: + targetformat = osync_format_env_find_objformat(env, "ldap-inetorgperson"); + break; + + case TARGET_VCARD_21: + targetformat = osync_format_env_find_objformat(env, "vcard21"); + break; + + case TARGET_AUTO: + case TARGET_VCARD_30: + targetformat = osync_format_env_find_objformat(env, "vcard30"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-contact"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert xmlformat-contact-doc into this format. Supported formats: vcard21, vcard30, ldap-evolutionperson, ldap-inetorgperson, xmlformat-contact.", __FILE__, __LINE__); + goto error; + } + + + + } else if (!strcmp(sfname, "xmlformat-event-doc") || !strcmp(sfname, "xmlformat-event")) { + switch (type) { + case TARGET_VEVENT_10: + targetformat = osync_format_env_find_objformat(env, "vevent10"); + break; + + case TARGET_LDAP_EVENT: + targetformat = osync_format_env_find_objformat(env, "ldap-event"); + break; + + case TARGET_AUTO: + case TARGET_VEVENT_20: + targetformat = osync_format_env_find_objformat(env, "vevent20"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-event"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert xmlformat-event-doc into this format. Supported formats: vevent10, vevent20, ldap-event, xmlformat-event.", __FILE__, __LINE__); + goto error; + } + + + } else if (!strcmp(sfname, "xmlformat-todo-doc") || !strcmp(sfname, "xmlformat-todo")) { + switch (type) { + case TARGET_VTODO_10: + targetformat = osync_format_env_find_objformat(env, "vtodo10"); + break; + + case TARGET_LDAP_TODO: + targetformat = osync_format_env_find_objformat(env, "ldap-todo"); + break; + + case TARGET_AUTO: + case TARGET_VTODO_20: + targetformat = osync_format_env_find_objformat(env, "vtodo20"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-todo"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert xmlformat-todo-doc into this format. Supported formats: vtodo10, vtodo20, ldap-todo, xmlformat-todo.", __FILE__, __LINE__); + goto error; + } + + + + } else if (!strcmp(sfname, "xmlformat-note-doc") || !strcmp(sfname, "xmlformat-note")) { + switch (type) { + case TARGET_AUTO: + case TARGET_VNOTE_11: + targetformat = osync_format_env_find_objformat(env, "vnote11"); + break; + + case TARGET_LDAP_NOTE: + targetformat = osync_format_env_find_objformat(env, "ldap-note"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-note"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert xmlformat-note-doc into this format. Supported formats: vnote11, ldap-note, xmlformat-note.", __FILE__, __LINE__); + goto error; + } + + + + } else if (!strcmp(sfname, "xmlformat-journal-doc")) { + switch (type) { + case TARGET_AUTO: + case TARGET_VJOURNAL: + targetformat = osync_format_env_find_objformat(env, "vjournal"); + break; + + case TARGET_LDAP_NOTE: + targetformat = osync_format_env_find_objformat(env, "ldap-note"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-journal"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert xmlformat-journal-doc into this format. Supported formats: vjournal, ldap-note, xmlformat-journal.", __FILE__, __LINE__); + goto error; + } + + + + + + } else if (!strcmp(sfname, "ldap-evolutionperson")) { + switch(type) { + case TARGET_AUTO: + case TARGET_VCARD_30: + targetformat = osync_format_env_find_objformat(env, "vcard30"); + break; + + case TARGET_VCARD_21: + targetformat = osync_format_env_find_objformat(env, "vcard21"); + break; + + case TARGET_LDAP_INETORGPERSON: + targetformat = osync_format_env_find_objformat(env, "ldap-inetorgperson"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-contact"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert ldap-evolutionperson into this format. Supported formats: xmlformat, vcard21, vcard30, ldap-inetorgperson.", __FILE__, __LINE__); + goto error; + } + + + + } else if (!strcmp(sfname, "ldap-inetorgperson")) { + switch(type) { + case TARGET_AUTO: + case TARGET_VCARD_30: + targetformat = osync_format_env_find_objformat(env, "vcard30"); + break; + + case TARGET_VCARD_21: + targetformat = osync_format_env_find_objformat(env, "vcard21"); + break; + + case TARGET_LDAP_EVOLUTIONPERSON: + targetformat = osync_format_env_find_objformat(env, "ldap-evolutionperson"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-contact"); + break; + + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert ldap-inetorgperson into this format. Supported formats: xmlformat, vcard21, vcard30, ldap-evolutionperson.", __FILE__, __LINE__); + goto error; + } + + + + } else if (!strcmp(sfname, "ldap-event")) { + switch(type) { + case TARGET_AUTO: + case TARGET_VEVENT_20: + targetformat = osync_format_env_find_objformat(env, "vevent20"); + break; + + case TARGET_VEVENT_10: + targetformat = osync_format_env_find_objformat(env, "vevent10"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-event"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert ldap-event into this format. Supported formats: xmlformat, vevent10, vevent20", __FILE__, __LINE__); + goto error; + } + + + + } else if (!strcmp(sfname, "ldap-todo")) { + switch(type) { + case TARGET_AUTO: + case TARGET_VTODO_20: + targetformat = osync_format_env_find_objformat(env, "vtodo20"); + break; + + case TARGET_VTODO_10: + targetformat = osync_format_env_find_objformat(env, "vtodo10"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-todo"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert ldap-todo into this format. Supported formats: xmlformat, vtodo10, vtodo20.", __FILE__, __LINE__); + goto error; + } + + + + } else if (!strcmp(sfname, "ldap-note")) { + switch(type) { + case TARGET_AUTO: + case TARGET_VJOURNAL: + targetformat = osync_format_env_find_objformat(env, "vjournal"); + break; + + case TARGET_VNOTE_11: + targetformat = osync_format_env_find_objformat(env, "vnote11"); + break; + + case TARGET_XMLFORMAT: + targetformat = osync_format_env_find_objformat(env, "xmlformat-note"); + break; + + default: + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to convert ldap-note into this format. Supported formats: xmlformat, vjournal, vnote11.", __FILE__, __LINE__); + goto error; + } + + + + } else { + osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Cannot convert format \"%s\" to anything, at all. Unable to find any suitable converter.", __FILE__, __LINE__, sfname); + goto error; + } + + + fprintf(stderr, "Type of the target format: \"%s\".\n", (char *)osync_objformat_get_name(targetformat)); + + + return targetformat; + +error: + if (osync_error_is_set(error)) { + fprintf(stderr, "%s:%i: ERROR: %s\n", __FILE__, __LINE__, osync_error_print(error)); + } else { + fprintf(stderr, "%s:%i: ERROR: Unknown reason.\n", __FILE__, __LINE__); + } + + return NULL; +} + + +int usage(char *name) +{ + if (name == NULL) { + name = (char *)__FILE__; + } + + fprintf(stderr, "Usage: %s <inputfile> <options>\n\n", name); + fprintf(stderr, "--help\t\tShow this help message\n"); + fprintf(stderr, "--out <file>\tStore the output into this file. Leaving out this option means, print it to stdout.\n"); + fprintf(stderr, "--to-vcard21\tConvert to vcard 2.1\n"); + fprintf(stderr, "--to-vcard30\tConvert to vcard 3.0\n"); + fprintf(stderr, "--to-ldap-evolutionperson\tConvert to LDAP evolutionperson\n"); + fprintf(stderr, "--to-ldap-inetorgperson\tConvert to LDAP inetorgperson\n"); + fprintf(stderr, "--to-vevent10\tConvert to vevent 1.0\n"); + fprintf(stderr, "--to-vevent20\tConvert to vevent 2.0\n"); + fprintf(stderr, "--to-ldap-event\tConvert to LDAP event\n"); + fprintf(stderr, "--to-vtodo10\tConvert to vtodo 1.0\n"); + fprintf(stderr, "--to-vtodo20\tConvert to vtodo 2.0\n"); + fprintf(stderr, "--to-ldap-todo\tConvert to LDAP todo\n"); + fprintf(stderr, "--to-vnote11\tConvert to vnote 1.1\n"); + fprintf(stderr, "--to-vjournal\tConvert to vjournal\n"); + fprintf(stderr, "--to-ldap-note\tConvert to LDAP note\n"); + fprintf(stderr, "--to-xmlformat\tConvert to xmlformat\n"); + + return 1; +} + + + +int main (int argc, char *argv[]) +{ + OSyncData *data = NULL; + OSyncError *error = NULL; + OSyncFormatEnv *format_env = NULL; + OSyncObjFormat *sourceformat = NULL; + OSyncObjFormat *targetformat = NULL; + OSyncFormatConverterPath *converter_path = NULL; + OSyncList *l = NULL, *list = NULL; + conv_detection detection_type = TARGET_AUTO; + char *program = NULL; + char *format_config = NULL; + char *input_filename = NULL; + char *output_filename = NULL; + char *buffer = NULL; + char *result = NULL; + struct stat stat_buffer; + unsigned int size; + int i = 0; + + + + if (argc < 2) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Not enough arguments. You must state the name of the input file to be converted.", __FILE__, __LINE__); + goto error; + } + + + if (!strcmp(argv[0], "-h") || !strcmp(argv[0], "--help")) { + usage(argv[0]); + return 0; + } + + + program = argv[0]; + + input_filename = argv[1]; + + for (i = 2; i < argc; i++) { + char *arg = argv[i]; + + + if (!strcmp(arg, "--help") || !strcmp(arg, "-h")) { + usage(program); + return 0; + + } else if (!strcmp(arg, "--to-vcard21")) { + detection_type = TARGET_VCARD_21; + + } else if (!strcmp(arg, "--to-vcard30")) { + detection_type = TARGET_VCARD_30; + + } else if (!strcmp (arg, "--to-vevent10")) { + detection_type = TARGET_VEVENT_10; + + } else if (!strcmp (arg, "--to-vevent20")) { + detection_type = TARGET_VEVENT_20; + + } else if (!strcmp (arg, "--to-vtodo10")) { + detection_type = TARGET_VTODO_10; + + } else if (!strcmp (arg, "--to-vtodo20")) { + detection_type = TARGET_VTODO_20; + + } else if (!strcmp (arg, "--to-vnote11")) { + detection_type = TARGET_VNOTE_11; + + } else if (!strcmp (arg, "--to-vjournal")) { + detection_type = TARGET_VJOURNAL; + + } else if (!strcmp (arg, "--to-xmlformat")) { + detection_type = TARGET_XMLFORMAT; + + } else if (!strcmp (arg, "--to-ldap-evolutionperson")) { + detection_type = TARGET_LDAP_EVOLUTIONPERSON; + + } else if (!strcmp (arg, "--to-ldap-inetorgperson")) { + detection_type = TARGET_LDAP_INETORGPERSON; + + } else if (!strcmp (arg, "--to-ldap-event")) { + detection_type = TARGET_LDAP_EVENT; + + } else if (!strcmp (arg, "--to-ldap-todo")) { + detection_type = TARGET_LDAP_TODO; + + } else if (!strcmp (arg, "--to-ldap-note")) { + detection_type = TARGET_LDAP_NOTE; + } else if (!strcmp (arg, "--out")) { + if (!strncmp(argv[i + 1], "--", 2)) { + fprintf(stderr, "ERROR: Output filename MUST NOT begin with \'--\'. Use --help, if necessary."); + continue; + + } else if (!strncmp(argv[i + 1], "-", 1)) { + fprintf(stderr, "ERROR: Output filename MUST NOT begin with \'-\'. Use --help, if necessary."); + continue; + + } else if (argv[i + 1] == 0) { + fprintf(stderr, "ERROR: --out must be followed by a name of a file where the output can be written to. Use --help, if necessary."); + continue; + + } else { + output_filename = argv[i + 1]; + i++; + } + + } else if (!strcmp (arg, "--")) { + break; + + } else if (arg[0] == '-') { + fprintf(stderr, "%s:%i: ERROR: \"-\" is an invalid option. Use --help, if necessary.\n", __FILE__, __LINE__); + goto error; + + } else { + fprintf(stderr, "%s:%i: ERROR: Unknown option.\n", __FILE__, __LINE__); + goto error; + + } + } + + + + if (input_filename == NULL) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: input_filename = NULL. input_filename has not been set.", __FILE__, __LINE__); + + goto error; + } + + if (input_filename[0] == 0) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: input_filename[0] = 0. input_filename has not been set.", __FILE__, __LINE__); + + goto error; + } + + + errno = 0; + if (stat(input_filename, &stat_buffer)) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Could not load \"%s\": %s", __FILE__, __LINE__, input_filename, strerror(errno)); + goto error; + } + + + // Load the contents of the input file into buffer + if (!osync_file_read(input_filename, &buffer, &size, &error)) { + if (!osync_error_is_set(&error)) + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_file_read() has failed.", __FILE__, __LINE__); + + goto error; + } + + // The size returned by osync_file_read does NOT include the + // terminating 0. But we need a size that does include it. + size++; + + + // Allocate a new format environment + format_env = osync_format_env_new(&error); + if (format_env == NULL) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: format_env = NULL. ", __FILE__, __LINE__); + goto error; + } + + + // Let the format environment load all kinds of plugins + if (!osync_format_env_load_plugins(format_env, NULL, &error)) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Could not load any format plugin.", __FILE__, __LINE__); + goto error; + } + + + // Alloacate a format object specifically intended for the input file. + // At first, we create an OSyncData object with "plain" as sort of a + // general object format. Just to have something to begin with. + sourceformat = osync_format_env_find_objformat(format_env, "plain"); + if (sourceformat == NULL) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: sourceformat = NULL. Objformat object could not be generated.", __FILE__, __LINE__); + goto error; + } + + + // Allocate a new data object with the contents of the input file + data = osync_data_new(buffer, size, sourceformat, &error); + if (data == NULL) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: data = NULL.", __FILE__, __LINE__); + goto error; + } + + + // Analyze the source format + + sourceformat = osync_format_env_detect_objformat(format_env, data); + if (sourceformat == NULL) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: sourceformat = NULL. Source format could not be recognized.", __FILE__, __LINE__); + goto error; + } + + +/* + if (!osync_format_env_detect_objformat_full(format_env, data, &sourceformat, &error)) { + if (!osync_error_is_set(&error)) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: osync_format_env_detect_objformat_full() has failed.", __FILE__, __LINE__); + } + + goto error; + } +*/ + + + if (sourceformat == NULL) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: sourceformat = NULL. Source format could not be recognized.", __FILE__, __LINE__); + goto error; + } + + + char *sourceformat_name = (char *)osync_objformat_get_name(sourceformat); + +#if 0 + // Workaround + if (!strcmp(sourceformat_name, "xmlformat-contact-doc")) { + sourceformat_name = (char *)"xmlformat-contact"; + sourceformat = osync_objformat_new(sourceformat_name, "contact", &error); + } +#endif + + + // Tell the data object what kind of source format we have just found. + osync_data_set_objformat(data, sourceformat); + if (osync_error_is_set(&error)) { + goto error; + } + + + + + // Try and get the target format + targetformat = conv_run_detection(format_env, sourceformat_name, detection_type, &error); + if (targetformat == NULL) { + if (!osync_error_is_set(&error)) + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: targetformat could not be recognized.", __FILE__, __LINE__); + + goto error; + } + + + + // Try and find the converter path for a particular source format and + // target format + converter_path = osync_format_env_find_path(format_env, sourceformat, targetformat, &error); + if (converter_path == NULL) { + if (!osync_error_is_set(&error)) + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: converter_pathcould not be found for sourceformat = \"%s\" and targetformat = \"%s\".", __FILE__, __LINE__, sourceformat, targetformat); + + goto error; + } + + + if (format_config) { + osync_converter_path_set_config(converter_path, format_config); + fprintf(stderr, "%s:%i: config of converter path: \"%s\"\n", __FILE__, __LINE__, osync_converter_path_get_config (converter_path)); +#ifdef DEBUG + } else { + fprintf(stderr, "%s:%i: WARNING: format_config = NULL.\n", __FILE__, __LINE__); +#endif + } + + + + + + + + + // Dump the converters involved in the conversion path, + // but only the ones which reside at the edges. + l = NULL; + list = osync_converter_path_get_edges(converter_path); + if (list) { + for (l = list; l; l = l->next) { + if (l->data) { + fprintf(stderr, "Edge converter: \"%s\"\n", osync_objformat_get_name(osync_converter_get_targetformat(l->data))); + } + } + } else { + osync_trace(TRACE_ERROR, "%s:%i: WARNING: list = NULL.", __FILE__, __LINE__); + } + + + + // Now, convert the data from sourceformat to targetformat + if (!osync_format_env_convert(format_env, converter_path, data, &error)) { + if (!osync_error_is_set(&error)) + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: conversion could not be performed for sourceformat = \"%s\" and targetformat = \"%s\".", __FILE__, __LINE__, sourceformat, targetformat); + + goto error; + } + + + if (data == NULL) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: output data = NULL. Conversion must have failed.", __FILE__, __LINE__); + goto error; + } + + + result = osync_data_get_printable(data); + if (result == NULL) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: result = NULL. Conversion must have failed.", __FILE__, __LINE__); + goto error; + } + + + + // Output to screen or file + if (output_filename) { + if (!osync_file_write(output_filename, result, strlen(result), 0644, &error)) { + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: Unable to write file %s.", __FILE__, __LINE__, output_filename); + goto error; + } + } else { + printf("%s\n", result); + } + + + + if (data) + osync_data_unref(data); + + if (converter_path) + osync_converter_path_unref(converter_path); + + if (format_env) + osync_format_env_unref(format_env); + + return 0; + + +error: + if (data) + osync_data_unref(data); + + if (converter_path) + osync_converter_path_unref(converter_path); + + if (format_env) + osync_format_env_unref(format_env); + + if (osync_error_is_set(&error)) { + fprintf(stderr, "%s\n", osync_error_print(&error)); + osync_error_unref(&error); + } + + return 1; +} Added: plugins/ldap-sync/tests/vcards/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/vcards/README Sat Apr 11 20:28:01 2009 (r5573) @@ -0,0 +1,3 @@ +*.vcf files copied from the opensync-plugin-vformat. +Thanks go to the authors of the opensync-plugin-vformat format plugin. + Added: plugins/ldap-sync/tests/vcards/evo2-full1.vcf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/vcards/evo2-full1.vcf Sat Apr 11 20:28:01 2009 (r5573) @@ -0,0 +1,47 @@ +BEGIN:VCARD +VERSION:3.0 +FN:Title First Middle Last Suffix +N:Last;First;Middle;Title;Suffix +ORG:organization;department;office +REV:2005-02-26T10:41:24Z +ROLE:profession +TITLE:title +UID:pas-id-421A5F6100000014 +URL:homepage +X-EVOLUTION-FILE-AS:Last\, First +X-EVOLUTION-MANAGER:manager +X-EVOLUTION-ASSISTANT:assistant +NICKNAME:nickname +BDAY:2005-02-10 +X-EVOLUTION-ANNIVERSARY:2005-02-08 +X-EVOLUTION-SPOUSE:spouse +NOTE:This is a note! +CATEGORIES:Birthday,Business +X-EVOLUTION-BLOG-URL:weblog +CALURI:calendar +FBURL:freebusy +X-EVOLUTION-VIDEO-URL:video chat +X-MOZILLA-HTML:TRUE +EMAIL;TYPE=WORK;X-EVOLUTION-UI-SLOT=1:workemail +EMAIL;TYPE=HOME;X-EVOLUTION-UI-SLOT=2:homeemail +EMAIL;TYPE=OTHER;X-EVOLUTION-UI-SLOT=3:otheremail +EMAIL;TYPE=OTHER;X-EVOLUTION-UI-SLOT=4:otheremail2 +TEL;TYPE=WORK;TYPE=VOICE;X-EVOLUTION-UI-SLOT=1:bizphone +TEL;TYPE=HOME;TYPE=VOICE;X-EVOLUTION-UI-SLOT=2:homephone +TEL;TYPE=CELL;X-EVOLUTION-UI-SLOT=3:mobphone +TEL;TYPE=WORK;TYPE=FAX;X-EVOLUTION-UI-SLOT=4:biz fax +TEL;TYPE="X-EVOLUTION-ASSISTANT";X-EVOLUTION-UI-SLOT=5:assistantphone +TEL;TYPE="X-EVOLUTION-CALLBACK";X-EVOLUTION-UI-SLOT=6:callback +TEL;TYPE=CAR;X-EVOLUTION-UI-SLOT=7:car phone +TEL;TYPE=PREF;X-EVOLUTION-UI-SLOT=8:primary phone +X-AIM;TYPE=HOME;X-EVOLUTION-UI-SLOT=1:aim +X-YAHOO;TYPE=HOME;X-EVOLUTION-UI-SLOT=2:yahoo +X-ICQ;TYPE=HOME;X-EVOLUTION-UI-SLOT=3:icq +X-GROUPWISE;TYPE=HOME;X-EVOLUTION-UI-SLOT=4:groupwise +ADR;TYPE=WORK:PO-BOX2;;Address2;City2;State2;zip2;country2 +LABEL;TYPE=WORK:Address2\nCity2\, State2\nzip2\nPO-BOX2\ncountry2 +ADR;TYPE=HOME:PO-BOX1;;Address1;City1;State1;zip1;country1 +LABEL;TYPE=HOME:Address1\nCity1\, State1\nzip1\nPO-BOX1\ncountry1 +ADR;TYPE=OTHER:PO-BOX3;;Address3;City3;State3;zip3;country3 +LABEL;TYPE=OTHER:Address3\nCity3\, State3\nzip3\nPO-BOX3\ncountry3 +END:VCARD \ No newline at end of file Added: plugins/ldap-sync/tests/vcards/evo2-full2.vcf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/vcards/evo2-full2.vcf Sat Apr 11 20:28:01 2009 (r5573) @@ -0,0 +1,47 @@ +BEGIN:VCARD +VERSION:3.0 +FN:Title First Middle Last Suffix +N:Last;First;Middle;Title;Suffix +ORG:organization;department;office +REV:2005-02-26 +ROLE:profession +TITLE:title +UID:pas-id-421A5F6100000014 +URL:homepage +X-EVOLUTION-FILE-AS:Last\, First +X-EVOLUTION-MANAGER:manager +X-EVOLUTION-ASSISTANT:assistant +NICKNAME:nickname +BDAY:2005-02-10 +X-EVOLUTION-ANNIVERSARY:2005-02-08 +X-EVOLUTION-SPOUSE:spouse +NOTE:This is a note! +CATEGORIES:Birthday,Business +X-EVOLUTION-BLOG-URL:weblog +CALURI:calendar +FBURL:freebusy +X-EVOLUTION-VIDEO-URL:video chat +X-MOZILLA-HTML:TRUE +ADR;TYPE=WORK:PO-BOX2;;Address2;City2;State2;zip2;country2 +LABEL;TYPE=WORK:Address2\nCity2\, State2\nzip2\nPO-BOX2\ncountry2 +ADR;TYPE=HOME:PO-BOX1;;Address1;City1;State1;zip1;country1 +LABEL;TYPE=HOME:Address1\nCity1\, State1\nzip1\nPO-BOX1\ncountry1 +ADR;TYPE=OTHER:PO-BOX3;;Address3;City3;State3;zip3;country3 +LABEL;TYPE=OTHER:Address3\nCity3\, State3\nzip3\nPO-BOX3\ncountry3 +EMAIL;TYPE=WORK;X-EVOLUTION-UI-SLOT=1:workemail +EMAIL;TYPE=HOME;X-EVOLUTION-UI-SLOT=2:homeemail +EMAIL;TYPE=OTHER;X-EVOLUTION-UI-SLOT=3:otheremail +EMAIL;TYPE=OTHER;X-EVOLUTION-UI-SLOT=4:otheremail2 +TEL;TYPE="X-EVOLUTION-COMPANY";X-EVOLUTION-UI-SLOT=1:company phone +TEL;TYPE=HOME;TYPE=FAX;X-EVOLUTION-UI-SLOT=2:homefax +TEL;TYPE=FAX;X-EVOLUTION-UI-SLOT=3:other fax +TEL;TYPE=PAGER;X-EVOLUTION-UI-SLOT=4:pager +TEL;TYPE=ISDN;X-EVOLUTION-UI-SLOT=5:ISDN +TEL;TYPE=VOICE;X-EVOLUTION-UI-SLOT=6:other phone +TEL;TYPE="X-EVOLUTION-RADIO";X-EVOLUTION-UI-SLOT=7:radio +TEL;TYPE="X-EVOLUTION-TELEX";X-EVOLUTION-UI-SLOT=8:telex +X-JABBER;TYPE=HOME;X-EVOLUTION-UI-SLOT=3:jabber +X-YAHOO;TYPE=HOME;X-EVOLUTION-UI-SLOT=2:yahoo +X-MSN;TYPE=HOME;X-EVOLUTION-UI-SLOT=1:msn +X-GROUPWISE;TYPE=HOME;X-EVOLUTION-UI-SLOT=4:groupwise +END:VCARD \ No newline at end of file Added: plugins/ldap-sync/tests/vcards/evo2-multiline.vcf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/vcards/evo2-multiline.vcf Sat Apr 11 20:28:01 2009 (r5573) @@ -0,0 +1,53 @@ +BEGIN:VCARD +VERSION:3.0 +FN:Title First Middle Last Suffix +N:Last;First;Middle;Title;Suffix +ORG:organization;department;office +REV:20050226 +ROLE:profession +TITLE:title +UID:pas-id-421A5F6100000014 +URL:homepage +X-EVOLUTION-FILE-AS:Last\, First +X-EVOLUTION-MANAGER:manager +X-EVOLUTION-ASSISTANT:assistant +NICKNAME:nickname +BDAY:2005-02-10 +X-EVOLUTION-ANNIVERSARY:2005-02-08 +X-EVOLUTION-SPOUSE:spouse +NOTE:This is a multiline note!\nNote how there are multiple\nl\ni\nn\ne\ns +CATEGORIES:Birthday,Business +X-EVOLUTION-BLOG-URL:weblog +CALURI:calendar +FBURL:freebusy +X-EVOLUTION-VIDEO-URL:video chat +X-MOZILLA-HTML:TRUE +ADR;TYPE=WORK:PO-BOX2;Multiline street\nmultiline city;Address2;City2;State + 2;zip2;country2 +LABEL;TYPE=WORK:Address2\nMultiline street\nmultiline city\nCity2\, State2\ + nzip2\nPO-BOX2\ncountry2 +ADR;TYPE=HOME:PO-BOX1;Multiline street\nmultiline city\n;Address1;City1;Sta + te1;zip1;country1 +LABEL;TYPE=HOME:Address1\nMultiline street\nmultiline city\n\nCity1\, State + 1\nzip1\nPO-BOX1\ncountry1 +ADR;TYPE=OTHER:PO-BOX3;Multiline street\nmultiline city;Address3;City3;Stat + e3;zip3;country3 +LABEL;TYPE=OTHER:Address3\nMultiline street\nmultiline city\nCity3\, State3 + \nzip3\nPO-BOX3\ncountry3 +EMAIL;TYPE=WORK;X-EVOLUTION-UI-SLOT=1:workemail +EMAIL;TYPE=HOME;X-EVOLUTION-UI-SLOT=2:homeemail +EMAIL;TYPE=OTHER;X-EVOLUTION-UI-SLOT=3:otheremail +EMAIL;TYPE=OTHER;X-EVOLUTION-UI-SLOT=4:otheremail2 +TEL;TYPE="X-EVOLUTION-COMPANY";X-EVOLUTION-UI-SLOT=1:company phone +TEL;TYPE=HOME;TYPE=FAX;X-EVOLUTION-UI-SLOT=2:homefax +TEL;TYPE=FAX;X-EVOLUTION-UI-SLOT=3:other fax +TEL;TYPE=PAGER;X-EVOLUTION-UI-SLOT=4:pager +TEL;TYPE=ISDN;X-EVOLUTION-UI-SLOT=5:ISDN +TEL;TYPE=VOICE;X-EVOLUTION-UI-SLOT=6:other phone +TEL;TYPE="X-EVOLUTION-RADIO";X-EVOLUTION-UI-SLOT=7:radio +TEL;TYPE="X-EVOLUTION-TELEX";X-EVOLUTION-UI-SLOT=8:telex +X-JABBER;TYPE=HOME;X-EVOLUTION-UI-SLOT=3:jabber +X-YAHOO;TYPE=HOME;X-EVOLUTION-UI-SLOT=2:yahoo +X-MSN;TYPE=HOME;X-EVOLUTION-UI-SLOT=1:msn +X-GROUPWISE;TYPE=HOME;X-EVOLUTION-UI-SLOT=4:groupwise +END:VCARD \ No newline at end of file Added: plugins/ldap-sync/tests/vcards/evo2-photo.vcf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/vcards/evo2-photo.vcf Sat Apr 11 20:28:01 2009 (r5573) @@ -0,0 +1,59 @@ +BEGIN:VCARD +VERSION:3.0 +FN:Title First Middle Last Suffix +N:Last;First;Middle;Title;Suffix +ORG:organization;department;office +REV:20050226T104124,2Z +ROLE:profession +TITLE:title +UID:pas-id-421A5F6100000014 +URL:homepage +X-EVOLUTION-FILE-AS:Last\, First +X-EVOLUTION-MANAGER:manager +X-EVOLUTION-ASSISTANT:assistant +NICKNAME:nickname +BDAY:2005-02-10 +X-EVOLUTION-ANNIVERSARY:2005-02-08 +X-EVOLUTION-SPOUSE:spouse +NOTE:This is a note! +CATEGORIES:Birthday,Business +X-EVOLUTION-BLOG-URL:weblog +CALURI:calendar +FBURL:freebusy +X-EVOLUTION-VIDEO-URL:video chat +X-MOZILLA-HTML:TRUE +ADR;TYPE=WORK:PO-BOX2;;Address2;City2;State2;zip2;country2 +LABEL;TYPE=WORK:Address2\nCity2\, State2\nzip2\nPO-BOX2\ncountry2 +ADR;TYPE=HOME:PO-BOX1;;Address1;City1;State1;zip1;country1 +LABEL;TYPE=HOME:Address1\nCity1\, State1\nzip1\nPO-BOX1\ncountry1 +ADR;TYPE=OTHER:PO-BOX3;;Address3;City3;State3;zip3;country3 +LABEL;TYPE=OTHER:Address3\nCity3\, State3\nzip3\nPO-BOX3\ncountry3 +PHOTO;ENCODING=b;TYPE=PNG:iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAIAAAADnC86AAAAC + XBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1QIaEQILc0Ox6gAAAB10RVh0Q29tbWVudABDc + mVhdGVkIHdpdGggVGhlIEdJTVDvZCVuAAAB7ElEQVRYw+2XTasxYRjH/8dwGpq8xEaajZeJU + BZoykL2ysbCTrGUfAZr2UtJKTtJ8QGUrWKhKOELjMKUtybO4q7ZnM7E88zT6am5Vnd3v7l+m + 7muf/fH8/nEb5QOv1SaWBNrYk2sif+pWJKkbrebyWRcLpfBYKBpmuO4QqEwmUze6PJ8s5bLZ + TgcJt/SNO12u10uF0VR5CaXy4mi+EofvGu12+0AvF5vr9e7Xq/kXhCEWq3GMAyARCJxuVzUF + N/v91AoBCAajR4Oh+/AdDq1WCwAKpWKmuJmswnAaDRuNpufmFarBUCv1+92O9XEPM8DKBaLC + owkSSzLAqhWq+qIRVHU6XQARqORMlkqlQAkk0ll7NVxWq/Xj8cDQCQSUSYJsFqt1Jnj/X5PD + g6HQ5kkgMz/t5uLjC8AQRCUSQLI/N+KfT4f+bnm87kySQC/36+OmGGYWCwGYDAYKGCPx2M4H + AJIpVKq7epGowHAZDJtt9ufmHa7TRaIAvP2ArndboFAAEA8Hj8ej9+B2WxmtVoBlMtllUNis + VjYbDYAHMf1+305JPb7fb1eN5vNAHieP5/PKouJOxgMyrHo8XhYlpVjMZvNnk4n9WNRjqlOp + 5NOp51OJ0VRn5+fHo8nn8+Px+PXm3xoz1RNrIk18Z/WF7ZpjC1N/OYqAAAAAElFTkSuQmCC +EMAIL;TYPE=WORK;X-EVOLUTION-UI-SLOT=1:workemail +EMAIL;TYPE=HOME;X-EVOLUTION-UI-SLOT=2:homeemail +EMAIL;TYPE=OTHER;X-EVOLUTION-UI-SLOT=3:otheremail +EMAIL;TYPE=OTHER;X-EVOLUTION-UI-SLOT=4:otheremail2 +TEL;TYPE="X-EVOLUTION-COMPANY";X-EVOLUTION-UI-SLOT=1:company phone +TEL;TYPE=HOME;TYPE=FAX;X-EVOLUTION-UI-SLOT=2:homefax +TEL;TYPE=FAX;X-EVOLUTION-UI-SLOT=3:other fax +TEL;TYPE=PAGER;X-EVOLUTION-UI-SLOT=4:pager +TEL;TYPE=ISDN;X-EVOLUTION-UI-SLOT=5:ISDN +TEL;TYPE=VOICE;X-EVOLUTION-UI-SLOT=6:other phone +TEL;TYPE="X-EVOLUTION-RADIO";X-EVOLUTION-UI-SLOT=7:radio +TEL;TYPE="X-EVOLUTION-TELEX";X-EVOLUTION-UI-SLOT=8:telex +X-JABBER;TYPE=HOME;X-EVOLUTION-UI-SLOT=3:jabber +X-YAHOO;TYPE=HOME;X-EVOLUTION-UI-SLOT=2:yahoo +X-MSN;TYPE=HOME;X-EVOLUTION-UI-SLOT=1:msn +X-GROUPWISE;TYPE=HOME;X-EVOLUTION-UI-SLOT=4:groupwise +END:VCARD \ No newline at end of file Added: plugins/ldap-sync/tests/vcards/evo2-special.vcf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/vcards/evo2-special.vcf Sat Apr 11 20:28:01 2009 (r5573) @@ -0,0 +1,26 @@ +BEGIN:VCARD +VERSION:3.0 +FN:Titleö Firstä Middleü Lastß Suffixö +N:Lastß;Firstä;Middleü;Titleö;Suffixö +ORG:organization;department;office +REV:2005-02-26T10:41:24Z +ROLE:profession +TITLE:title +UID:pas-id-421A5F6100000014 +URL:homepage +X-EVOLUTION-FILE-AS:Lastß\, Firstä +X-EVOLUTION-MANAGER:manager +X-EVOLUTION-ASSISTANT:assistant +NICKNAME:nicknameü +BDAY:2005-02-10 +X-EVOLUTION-ANNIVERSARY:2005-02-08 +X-EVOLUTION-SPOUSE:spouse +NOTE:This is a multiline note with special chars\n!"§$%&/()=?`'*+~'#-_:.\; + \,^°@€¹²³¼½½¬{[[]}\\¸¨þø→←→€ł@æßðjđŋĸjħł + <-tab +X-EVOLUTION-BLOG-URL: +CALURI: +FBURL: +X-EVOLUTION-VIDEO-URL: +X-MOZILLA-HTML:FALSE +END:VCARD \ No newline at end of file Added: plugins/ldap-sync/tests/vcards/evo2-umlaute.vcf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/vcards/evo2-umlaute.vcf Sat Apr 11 20:28:01 2009 (r5573) @@ -0,0 +1,54 @@ +BEGIN:VCARD +VERSION:3.0 +FN:Titleö Firstä Middleü Lastß Suffixö +N:Lastß;Firstä;Middleü;Titleö;Suffixö +ORG:organization;department;office +REV:2005-02-26T10:41:24Z +ROLE:profession +TITLE:title +UID:pas-id-421A5F6100000014 +URL:homepage +X-EVOLUTION-FILE-AS:Lastß\, Firstä +X-EVOLUTION-MANAGER:manager +X-EVOLUTION-ASSISTANT:assistant +NICKNAME:nicknameü +BDAY:2005-02-10 +X-EVOLUTION-ANNIVERSARY:2005-02-08 +X-EVOLUTION-SPOUSE:spouse +NOTE:This is a multiline note with special chars\nNote how there are multip + le\nl\ni\nn\ne\ns\nand special chars: öüööüöäüßßß asd +CATEGORIES:Birthday,Business +X-EVOLUTION-BLOG-URL:weblog +CALURI:calendar +FBURL:freebusy +X-EVOLUTION-VIDEO-URL:video chat +X-MOZILLA-HTML:TRUE +ADR;TYPE=WORK:PO-BOX2;Multiline street\nmultiline cityäüööüä;Address2 + ;City2;State2;zip2;country2 +LABEL;TYPE=WORK:Address2\nMultiline street\nmultiline cityäüööüä\nCit + y2\, State2\nzip2\nPO-BOX2\ncountry2 +ADR;TYPE=HOME:PO-BOX1;Multiline street\nmultiline city\nöüä;Address1;Cit + y1;State1;zip1;country1 +LABEL;TYPE=HOME:Address1\nMultiline street\nmultiline city\nöüä\nCity1\, + State1\nzip1\nPO-BOX1\ncountry1 +ADR;TYPE=OTHER:PO-BOX3;Multiline street\nmultiline cityä\nöü;Address3;Ci + ty3;State3;zip3;country3 +LABEL;TYPE=OTHER:Address3\nMultiline street\nmultiline cityä\nöü\nCity3\ + , State3\nzip3\nPO-BOX3\ncountry3 +EMAIL;TYPE=WORK;X-EVOLUTION-UI-SLOT=1:workemailö +EMAIL;TYPE=HOME;X-EVOLUTION-UI-SLOT=2:homeemailü +EMAIL;TYPE=OTHER;X-EVOLUTION-UI-SLOT=3:otheremailü +EMAIL;TYPE=OTHER;X-EVOLUTION-UI-SLOT=4:otheremail2ä +TEL;TYPE="X-EVOLUTION-COMPANY";X-EVOLUTION-UI-SLOT=1:company phoneöä +TEL;TYPE=HOME;TYPE=FAX;X-EVOLUTION-UI-SLOT=2:homefaxöä +TEL;TYPE=FAX;X-EVOLUTION-UI-SLOT=3:other fax +TEL;TYPE=PAGER;X-EVOLUTION-UI-SLOT=4:pagerß +TEL;TYPE=ISDN;X-EVOLUTION-UI-SLOT=5:ISDNä +TEL;TYPE=VOICE;X-EVOLUTION-UI-SLOT=6:other phoneö +TEL;TYPE="X-EVOLUTION-RADIO";X-EVOLUTION-UI-SLOT=7:radioü +TEL;TYPE="X-EVOLUTION-TELEX";X-EVOLUTION-UI-SLOT=8:telexä +X-JABBER;TYPE=HOME;X-EVOLUTION-UI-SLOT=3:jabberüä +X-YAHOO;TYPE=HOME;X-EVOLUTION-UI-SLOT=2:yahooä +X-MSN;TYPE=HOME;X-EVOLUTION-UI-SLOT=1:msnöä +X-GROUPWISE;TYPE=HOME;X-EVOLUTION-UI-SLOT=4:groupwiseä +END:VCARD \ No newline at end of file Added: plugins/ldap-sync/tests/vcards/kdepim-full1-2.1.vcf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/ldap-sync/tests/vcards/kdepim-full1-2.1.vcf Sat Apr 11 20:28:01 2009 (r5573) @@ -0,0 +1,75 @@ +BEGIN:VCARD +ADR;CHARSET=UTF-8;ENCODING=8BIT;TYPE=work:pobox2;;Street1 work;locale2;regi + on2;postalcode2;Germany +ADR;CHARSET=UTF-8;ENCODING=8BIT;TYPE=home;TYPE=pref:pobox1;;HomeAddress1;lo + cal1;region1;postalcode1;Germany +BDAY:2005-02-26T00:00:00Z +EMAIL;CHARSET=UTF-8;ENCODING=8BIT;TYPE=PREF:email1 +EMAIL;CHARSET=UTF-8;ENCODING=8BIT:em...@te... +FN;CHARSET=UTF-8;ENCODING=8BIT:givenname familynames +GEO:52.500000;13.366667 +KEY;ENCODING=b;TYPE=PGP:mQGiBECXtzARBAC99Ll8ePW6FCzq8KUBwEYzo+J/u4EmkgCxgWm + Vzsvj2Uu7/OhwFaGJcv+fBSF+XtGhZeUk+Pcl4x0tMY5H07/k6ObF8+0O164J+Jg5bMlk2I6X1n + UhmAA4aIZCALHwcNZCq9b7HMKr3Sh1eMas2MQ2hL7mTrkfrcxqSNmTA1l/BwCgo+yOOozD6kohz + nRr+8jiYimho30EAJDN9YKkTh3kM1jrc9Q11N7zEnQUXtPC4GqQmW7BXgEmSBErEduk3N9NqnzG + xFruQrpXWisExv4z/t67uBou++m64J/Ad+T6wC19h72U15UVch/4bU7YqACjdlocUBfmnV3njko + Dhl6wmg7fxdCOJfkCXw+VKD9iiqXiSlqFh3IjA/4hdl3npIPKa0EeDnHDSUIbtZAd74i3Lzz1fJ + h5vip5N3alqSynJPmzPCWE7dMzOB/iPb+G50X046QT2OEypN9L5Trd5KJonlg+crN/aUZSjCmCC + foaBiISdox753MkVOipWH15F27KOqPHBNLrCnrYVCLMNpN/4aSbrn7AXzjbELQlQXJtaW4gQmF1 + ZXIgPGFybWluLmJhdWVyQGRlc3Njb24uY29tPoheBBMRAgAeBQJAl7cwAhsDBgsJCAcDAgMVAgM + DFgIBAh4BAheAAAoJEKvc+7/ZPVGpDNQAmwaN2121JO3i3AcRT5ns8KeQU2x2AJ9w5i2jQ5gZ4m + 3jVJPFohsL03i2hbQgQXJtaW4gQmF1ZXIgPGF6cmFlbEBkZXNzY29uLmNvbT6IXgQTEQIAHgUCQ + Je5JQIbAwYLCQgHAwIDFQIDAxYCAQIeAQIXgAAKCRCr3Pu/2T1RqfVrAJ9ANz3hB4TqVahybg8i + XJUfmOtjbACfSLJBPGBI84P/RIEe7FKCDC05ZT65AQ0EQJe3MBAEALFujyLPriDAyh0+u8KXoBf + SSrnyrDnjvhG0gGsyqSfE06JvKDK6q0ZUlRAj/1cbHS+Rb8t6mUN8HquVjPkWG6eNhcGNnRxjc+ + 7OqCiVhN7rt4c2HibVQWLy/8y04/Uqj2F9TwaiiuixIJiVA0tdqdgPxFFSCS6aRJhJ6EBw+rbXA + AMFBACtsn+fb3aQlaFiBurznAHmv/j2X3k2WXtaubPkNKEWf7HyLos0F5vSw0/hh0/YBabdpaK8 + LNNuP3Q0ABPjUzyK7cH5fxHPb8BWKIKvB5aX... [truncated message content] |