summaryrefslogtreecommitdiffstats
path: root/debian/opensync/opensync-0.22/formats/vformats-xml/xmldoc.c
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2020-09-11 14:38:47 +0900
committerMichele Calgaro <[email protected]>2020-09-11 14:38:47 +0900
commit884c8093d63402a1ad0b502244b791e3c6782be3 (patch)
treea600d4ab0d431a2bdfe4c15b70df43c14fbd8dd0 /debian/opensync/opensync-0.22/formats/vformats-xml/xmldoc.c
parent14e1aa2006796f147f3f4811fb908a6b01e79253 (diff)
downloadextra-dependencies-884c8093d63402a1ad0b502244b791e3c6782be3.tar.gz
extra-dependencies-884c8093d63402a1ad0b502244b791e3c6782be3.zip
Added debian extra dependency packages.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'debian/opensync/opensync-0.22/formats/vformats-xml/xmldoc.c')
-rw-r--r--debian/opensync/opensync-0.22/formats/vformats-xml/xmldoc.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/debian/opensync/opensync-0.22/formats/vformats-xml/xmldoc.c b/debian/opensync/opensync-0.22/formats/vformats-xml/xmldoc.c
new file mode 100644
index 00000000..3bf998df
--- /dev/null
+++ b/debian/opensync/opensync-0.22/formats/vformats-xml/xmldoc.c
@@ -0,0 +1,76 @@
+/*
+ * xmldoc - serialised textual versions of the XML event formats, for external plugins
+ * Copyright (C) 2006 Andrew Baumann <[email protected]>
+ *
+ * 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 "xml-support.h"
+
+static osync_bool from_xml(void *conv_data, char *input, int inpsize, char **output, int *outpsize, osync_bool *free_input, OSyncError **error)
+{
+ *free_input = TRUE;
+ return osxml_marshall(input, inpsize, output, outpsize, error);
+}
+
+static osync_bool to_xml(void *conv_data, char *input, int inpsize, char **output, int *outpsize, osync_bool *free_input, OSyncError **error)
+{
+ *free_input = TRUE;
+ return osxml_demarshall(input, inpsize, output, outpsize, error);
+}
+
+static osync_bool copy_string(const char *input, int inpsize, char **output, int *outpsize)
+{
+ *output = strdup(input);
+ *outpsize = inpsize;
+ return TRUE;
+}
+
+static void destroy(char *input, size_t inpsize)
+{
+ free(input);
+}
+
+void get_info(OSyncEnv *env)
+{
+ osync_env_register_objtype(env, "event");
+ osync_env_register_objformat(env, "event", "xml-event-doc");
+ osync_env_format_set_destroy_func(env, "xml-event-doc", destroy);
+ osync_env_format_set_copy_func(env, "xml-event-doc", copy_string);
+ osync_env_register_converter(env, CONVERTER_CONV, "xml-event", "xml-event-doc", from_xml);
+ osync_env_register_converter(env, CONVERTER_CONV, "xml-event-doc", "xml-event", to_xml);
+
+ osync_env_register_objtype(env, "todo");
+ osync_env_register_objformat(env, "todo", "xml-todo-doc");
+ osync_env_format_set_destroy_func(env, "xml-todo-doc", destroy);
+ osync_env_format_set_copy_func(env, "xml-todo-doc", copy_string);
+ osync_env_register_converter(env, CONVERTER_CONV, "xml-todo", "xml-todo-doc", from_xml);
+ osync_env_register_converter(env, CONVERTER_CONV, "xml-todo-doc", "xml-todo", to_xml);
+
+ osync_env_register_objtype(env, "contact");
+ osync_env_register_objformat(env, "contact", "xml-contact-doc");
+ osync_env_format_set_destroy_func(env, "xml-contact-doc", destroy);
+ osync_env_format_set_copy_func(env, "xml-contact-doc", copy_string);
+ osync_env_register_converter(env, CONVERTER_CONV, "xml-contact", "xml-contact-doc", from_xml);
+ osync_env_register_converter(env, CONVERTER_CONV, "xml-contact-doc", "xml-contact", to_xml);
+
+ osync_env_register_objtype(env, "note");
+ osync_env_register_objformat(env, "note", "xml-note-doc");
+ osync_env_format_set_destroy_func(env, "xml-note-doc", destroy);
+ osync_env_format_set_copy_func(env, "xml-note-doc", copy_string);
+ osync_env_register_converter(env, CONVERTER_CONV, "xml-note", "xml-note-doc", from_xml);
+ osync_env_register_converter(env, CONVERTER_CONV, "xml-note-doc", "xml-note", to_xml);
+}