1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _CONNECTIVITY_EVOAB_EVOLUTION_API_HXX_ 29 #define _CONNECTIVITY_EVOAB_EVOLUTION_API_HXX_ 30 #include <glib-object.h> 31 32 // Initializes the API below, returns false if not available 33 bool EApiInit(); 34 35 G_BEGIN_DECLS 36 37 // This header defined all the API methods as 38 // function pointers instead of real functions 39 // this will all evaporate as it is compiled generating 40 // no symbol lookups or relocations, but giving code 41 // clarity. 42 43 // We attempt to define a minimum API that we use: 44 45 // e-contact.h 46 #ifdef DECLARE_FN_POINTERS 47 #define EAPI_EXTERN 48 #else 49 #define EAPI_EXTERN extern 50 #endif 51 52 53 typedef void EContact; 54 #define E_CONTACT(a) ((EContact *)(a)) 55 #define E_TYPE_CONTACT (e_contact_get_type()) 56 typedef int EContactField; 57 58 EAPI_EXTERN const char *(*e_contact_field_name) ( EContactField field_id); 59 EAPI_EXTERN gpointer (*e_contact_get) (EContact *contact, EContactField field_id); 60 EAPI_EXTERN gconstpointer (*e_contact_get_const) (EContact *contact, EContactField field_id); 61 // e-source.h 62 typedef void ESource; 63 #define E_SOURCE(a) ((ESource *)(a)) 64 EAPI_EXTERN const char *(*e_source_peek_name) (ESource *source); 65 EAPI_EXTERN const gchar *(*e_source_get_property) (ESource *source, 66 const gchar *property); 67 68 EAPI_EXTERN GType (*e_contact_get_type) (void); 69 EAPI_EXTERN EContactField (*e_contact_field_id) (const char *field_name); 70 71 // e-source-list.h 72 typedef void ESourceList; 73 EAPI_EXTERN GSList *(*e_source_list_peek_groups) (ESourceList *list); 74 75 // e-source-group.h 76 typedef void ESourceGroup; 77 #define E_SOURCE_GROUP(a) ((ESourceGroup *)(a)) 78 79 EAPI_EXTERN GSList *(*e_source_group_peek_sources) (ESourceGroup *group); 80 EAPI_EXTERN const char *(*e_source_group_peek_base_uri) (ESourceGroup *group); 81 // e-book.h 82 typedef enum { 83 E_BOOK_QUERY_IS, 84 E_BOOK_QUERY_CONTAINS, 85 E_BOOK_QUERY_BEGINS_WITH, 86 E_BOOK_QUERY_ENDS_WITH, 87 } EBookQueryTest; 88 89 typedef void EBook; 90 typedef void EBookQuery; 91 92 EAPI_EXTERN EBook *(*e_book_new) (ESource *source, 93 GError **error); 94 95 EAPI_EXTERN gboolean (*e_book_open) (EBook *book, 96 gboolean only_if_exists, 97 GError **error); 98 99 EAPI_EXTERN const char *(*e_book_get_uri) (EBook *book); 100 EAPI_EXTERN ESource *(*e_book_get_source)(EBook *book); 101 102 EAPI_EXTERN gboolean (*e_book_get_addressbooks) (ESourceList **addressbook_sources, 103 GError **error); 104 105 EAPI_EXTERN gboolean (*e_book_get_contacts) (EBook *book, 106 EBookQuery *query, 107 GList **contacts, 108 GError **error); 109 110 EAPI_EXTERN gboolean (*e_book_authenticate_user) (EBook *book, 111 const char *user, 112 const char *passwd, 113 const char *auth_method, 114 GError **error); 115 116 // e-book-query.h 117 EAPI_EXTERN EBookQuery* (*e_book_query_field_exists) (EContactField field); 118 EAPI_EXTERN EBookQuery* (*e_book_query_field_test) (EContactField field, 119 EBookQueryTest test, 120 const char *value); 121 EAPI_EXTERN EBookQuery* (*e_book_query_and) (int nqs, EBookQuery **qs, gboolean unref); 122 EAPI_EXTERN EBookQuery* (*e_book_query_or) (int nqs, EBookQuery **qs, gboolean unref); 123 EAPI_EXTERN EBookQuery* (*e_book_query_not) (EBookQuery *q, gboolean unref); 124 EAPI_EXTERN EBookQuery* (*e_book_query_ref) (EBookQuery *q); 125 EAPI_EXTERN void (*e_book_query_unref) (EBookQuery *q); 126 EAPI_EXTERN char* (*e_book_query_to_string) (EBookQuery *q); 127 EAPI_EXTERN EBookQuery* (*e_book_query_from_string) (const char *query_string); 128 129 typedef struct { 130 char *address_format; /* the two letter country code that 131 determines the format/meaning of the 132 following fields */ 133 char *po; 134 char *ext; 135 char *street; 136 char *locality; 137 char *region; 138 char *code; 139 char *country; 140 } EContactAddress; 141 G_END_DECLS 142 #endif 143 144