From 3eeb0974eae0c4f85219a6239066bbfa201bcc82 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 17 Dec 2015 17:42:46 +0100 Subject: [PATCH] Fixed compilation when belcard is not found --- coreapi/Makefile.am | 4 +++ coreapi/friend.c | 8 +++++ coreapi/vcard_stubs.c | 71 +++++++++++++++++++++++++++++++++++++++++++ tester/vcard_tester.c | 4 +++ 4 files changed, 87 insertions(+) create mode 100644 coreapi/vcard_stubs.c diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index 6d9a1c179..6a918dd1e 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -114,8 +114,12 @@ else liblinphone_la_SOURCES+=linphone_tunnel_stubs.c linphone_tunnel.h endif +if BUILD_VCARD liblinphone_la_SOURCES+=vcard.cc vcard.h liblinphone_la_CXXFLAGS=-std=c++11 +else +liblinphone_la_SOURCES+=vcard_stubs.c vcard.h +endif liblinphone_la_LDFLAGS= -version-info $(LIBLINPHONE_SO_VERSION) -no-undefined diff --git a/coreapi/friend.c b/coreapi/friend.c index 0d14b73b6..77d6ca331 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -987,10 +987,18 @@ static int create_friend(void *data, int argc, char **argv, char **colName) { MSList **list = (MSList **)data; LinphoneFriend *lf = NULL; LinphoneVCard *vcard = NULL; + unsigned int storage_id = atoi(argv[0]); vcard = linphone_vcard_new_from_vcard4_buffer(argv[1]); lf = linphone_friend_new_from_vcard(vcard); + if (!lf) { + lf = linphone_friend_new(); + //TODO + } + //TODO + + lf->storage_id = storage_id; *list = ms_list_append(*list, linphone_friend_ref(lf)); linphone_friend_unref(lf); return 0; diff --git a/coreapi/vcard_stubs.c b/coreapi/vcard_stubs.c new file mode 100644 index 000000000..3bb7bed9e --- /dev/null +++ b/coreapi/vcard_stubs.c @@ -0,0 +1,71 @@ +/* +vcard_stubs.c +Copyright (C) 2015 Belledonne Communications SARL + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "vcard.h" + +struct _LinphoneVCard { +}; + +LinphoneVCard* linphone_vcard_new(void) { + return NULL; +} + +void linphone_vcard_free(LinphoneVCard *vCard) { + +} + +MSList* linphone_vcard_list_from_vcard4_file(const char *filename) { + return NULL; +} + +MSList* linphone_vcard_list_from_vcard4_buffer(const char *buffer) { + return NULL; +} + +LinphoneVCard* linphone_vcard_new_from_vcard4_buffer(const char *buffer) { + return NULL; +} + +const char * linphone_vcard_as_vcard4_string(LinphoneVCard *vCard) { + return NULL; +} + +void linphone_vcard_set_full_name(LinphoneVCard *vCard, const char *name) { + +} + +const char* linphone_vcard_get_full_name(const LinphoneVCard *vCard) { + return NULL; +} + +void linphone_vcard_add_sip_address(LinphoneVCard *vCard, const char *sip_address) { + +} + +void linphone_vcard_remove_sip_address(LinphoneVCard *vCard, const char *sip_address) { + +} + +void linphone_vcard_edit_main_sip_address(LinphoneVCard *vCard, const char *sip_address) { + +} + +MSList* linphone_vcard_get_sip_addresses(const LinphoneVCard *vCard) { + return NULL; +} \ No newline at end of file diff --git a/tester/vcard_tester.c b/tester/vcard_tester.c index 669868d3e..141c76c58 100644 --- a/tester/vcard_tester.c +++ b/tester/vcard_tester.c @@ -22,6 +22,7 @@ #include +#if BUILD_VCARD static char *create_filepath(const char *dir, const char *filename, const char *ext) { return ms_strdup_printf("%s/%s.%s", dir, filename, ext); } @@ -161,8 +162,10 @@ static void friends_sqlite_storage(void) { linphone_core_manager_destroy(manager); } #endif +#endif test_t vcard_tests[] = { +#if BUILD_VCARD { "Import / Export friends from vCards", linphone_vcard_import_export_friends_test }, { "Import a lot of friends from vCards", linphone_vcard_import_a_lot_of_friends_test }, #ifdef FRIENDS_SQL_STORAGE_ENABLED @@ -170,6 +173,7 @@ test_t vcard_tests[] = { { "Friends storage migration from rc to db", friends_migration }, { "Friends storage in sqlite database", friends_sqlite_storage }, #endif +#endif }; test_suite_t vcard_test_suite = {