Commit 682af3c5 authored by Ronan's avatar Ronan Committed by Ghislain MARY

fix(core): sqlite3 is not optional now

parent 3942b47e
Pipeline #443 canceled with stage
in 0 seconds
......@@ -42,16 +42,16 @@ option(ENABLE_STATIC "Build static library." YES)
option(ENABLE_CONSOLE_UI "Turn on or off compilation of console interface." YES)
option(ENABLE_CSHARP_WRAPPER "Build the C# wrapper for Liblinphone." OFF)
option(ENABLE_JAVA_WRAPPER "Build the Java wrapper for Liblinphone." OFF)
option(ENABLE_CXX_WRAPPER "Build the C++ wrapper for Liblinphone." YES)
option(ENABLE_DAEMON "Enable the linphone daemon interface." YES)
option(ENABLE_DATE "Use build date in internal version number." NO)
option(ENABLE_DEBUG_LOGS "Turn on or off debug level logs." NO)
option(ENABLE_DOC "Enable API documentation generation." NO)
option(ENABLE_JAVA_WRAPPER "Build the Java wrapper for Liblinphone." OFF)
option(ENABLE_JAVADOC "Add a target to generate documentation for Java API" NO)
option(ENABLE_LDAP "Enable LDAP support." NO)
option(ENABLE_LIME "Enable Instant Messaging Encryption." YES)
option(ENABLE_RELATIVE_PREFIX "Find resources relatively to the installation directory." NO)
option(ENABLE_SQLITE_STORAGE "Turn on compilation sqlite storage, for messages, contacts, history" YES)
option(ENABLE_STRICT "Build with strict compile options." YES)
option(ENABLE_TOOLS "Turn on or off compilation of tools." YES)
option(ENABLE_TUNNEL "Turn on compilation of tunnel support." NO)
......@@ -61,7 +61,6 @@ option(ENABLE_UPDATE_CHECK "Enable update check." NO)
option(ENABLE_VCARD "Turn on compilation of vcard4 support." YES)
option(ENABLE_VIDEO "Build with video support." YES)
cmake_dependent_option(ENABLE_LIME "Enable Instant Messaging Encryption." YES "ENABLE_SQLITE_STORAGE" NO)
cmake_dependent_option(ENABLE_NOTIFY "Enable libnotify support." YES "ENABLE_GTK_UI;NOT APPLE" NO)
cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENABLE_GTK_UI" NO)
......@@ -132,10 +131,14 @@ else()
find_package(BcToolbox 0.0.3 REQUIRED OPTIONAL_COMPONENTS tester)
find_package(Belr REQUIRED)
endif()
find_package(XML2 REQUIRED)
find_package(LibXsd REQUIRED)
find_package(Sqlite3 REQUIRED)
find_package(XML2 REQUIRED)
find_package(Soci)
find_package(ZLIB)
if(ENABLE_TUNNEL)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${EP_tunnel_CONFIG_DIR}/TunnelConfig.cmake")
......@@ -147,9 +150,6 @@ if(ENABLE_TUNNEL)
set(ENABLE_TUNNEL OFF CACHE BOOL "Enable tunnel support." FORCE)
endif()
endif()
if(ENABLE_SQLITE_STORAGE)
find_package(Sqlite3 REQUIRED)
endif()
if(ENABLE_NOTIFY)
find_package(Notify)
if(NOTIFY_FOUND)
......@@ -234,17 +234,12 @@ if (ENABLE_VCARD)
endif()
list(APPEND LINPHONE_INCLUDE_DIRS ${XML2_INCLUDE_DIRS})
list(APPEND LINPHONE_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIRS})
if(ZLIB_FOUND)
list(APPEND LINPHONE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
set(HAVE_ZLIB 1)
endif()
if(SQLITE3_FOUND)
list(APPEND LINPHONE_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIRS})
if(ENABLE_SQLITE_STORAGE)
add_definitions("-DSQLITE_STORAGE_ENABLED")
endif()
endif()
if(INTL_FOUND)
set(HAVE_INTL 1)
list(APPEND LINPHONE_INCLUDE_DIRS ${INTL_INCLUDE_DIRS})
......
......@@ -33,7 +33,7 @@ This library is used by Linphone. It's source code is available at *linphone-des
## Build instructions
cmake . -DCMAKE_INSTALL_PREFIX=<prefix> -DCMAKE_PREFIX_PATH=<search_prefixes>
make
make install
......@@ -48,7 +48,6 @@ This library is used by Linphone. It's source code is available at *linphone-des
* **`ENABLE_DOC=YES`** : Make the reference documentation of liblinphone to generated
* **`ENABLE_UNIT_TESTS=NO`** : do not build testing binaries
* **`ENABLE_VCARD=NO`** : disable VCard support
* **`ENABLE_SQLITE_STORAGE=NO`** : disable SQlite user data storage (message, history, contacts list)
* **`ENABLE_TOOLS=NO`** : do not build tool binaries
* **`ENABLE_LIME=YES`** : disable Linphone Instant Messaging Encryption
......
This diff is collapsed.
AUTOMAKE_OPTIONS = subdir-objects
GITVERSION_FILE=liblinphone_gitversion.h
GITVERSION_FILE_TMP=liblinphone_gitversion.h.tmp
GITDESCRIBE=`cd $(top_srcdir) && git describe --always`
GIT_TAG=`cd $(top_srcdir) && git describe --abbrev=0`
GITREVISION=`cd $(top_srcdir) && git rev-parse HEAD`
## This command is used to check if the sources are cloned in a git repo.
## We can't only depend on the presence of the .git/ directory anymore,
## because of gits submodule handling.
## We now simply issue a git log on configure.ac and if the output is empty (error or file not tracked), then we are not in git.
GITLOG=`cd $(top_srcdir) && git log -1 --pretty=format:%H configure.ac`
ECHO=/bin/echo
SUBDIRS=.
EXTRA_DIST=linphonecore_jni.cc $(GITVERSION_FILE)
BUILT_SOURCES=$(GITVERSION_FILE)
CLEANFILES=$(GITVERSION_FILE)
## Process this file with automake to produce Makefile.in
lib_LTLIBRARIES=liblinphone.la
liblinphone_la_SOURCES=\
account_creator.c \
account_creator_service.c \
address.c \
authentication.c \
buffer.c \
callbacks.c \
carddav.h \
call_log.c \
call_params.c \
carddav.c \
chat.c \
chat_file_transfer.c \
conference.cc conference_private.h \
contactprovider.c contact_providers_priv.h \
dial_plan.c \
dict.c \
ec-calibrator.c \
echo-tester.c \
enum.c enum.h \
error_info.c \
event.c \
factory.c \
friend.c \
friendlist.c \
im_notif_policy.c \
info.c \
ldapprovider.c \
linphonecall.c \
linphonecore.c \
localplayer.c \
lpc2xml.c lpc2xml.h \
lime.c lime.h\
im_encryption_engine.c \
lpconfig.c \
lsd.c \
message_storage.c \
misc.c \
nat_policy.c \
offeranswer.c offeranswer.h\
payload_type.c \
player.c \
presence.c \
private.h \
proxy.c \
quality_reporting.c quality_reporting.h\
remote_provisioning.c \
ringtoneplayer.c \
sal.c \
siplogin.c \
sipsetup.c \
sqlite3_bctbx_vfs.c sqlite3_bctbx_vfs.h\
vcard_private.h \
vtables.c \
video_definition.c \
xml2lpc.c xml2lpc.h \
xml.c \
xmlrpc.c \
$(GITVERSION_FILE)
if BUILD_UPNP
liblinphone_la_SOURCES+=upnp.c upnp.h
endif
liblinphone_la_SOURCES+= bellesip_sal/sal_address_impl.c \
bellesip_sal/sal_impl.c bellesip_sal/sal_impl.h \
bellesip_sal/sal_op_impl.c \
bellesip_sal/sal_op_call.c \
bellesip_sal/sal_op_registration.c \
bellesip_sal/sal_sdp.c \
bellesip_sal/sal_op_message.c \
bellesip_sal/sal_op_presence.c \
bellesip_sal/sal_op_publish.c \
bellesip_sal/sal_op_call_transfer.c \
bellesip_sal/sal_op_info.c \
bellesip_sal/sal_op_events.c
liblinphone_la_SOURCES+=linphone_tunnel_config.c
if BUILD_TUNNEL
liblinphone_la_SOURCES+=linphone_tunnel.cc TunnelManager.cc TunnelManager.hh
else
liblinphone_la_SOURCES+=linphone_tunnel_stubs.c
endif
if BUILD_VCARD
liblinphone_la_SOURCES+=vcard.cc
else
liblinphone_la_SOURCES+=vcard_stubs.c
endif
liblinphone_la_LDFLAGS= -version-info $(LIBLINPHONE_SO_VERSION) -no-undefined
if HAVE_LD_OUTPUT_DEF
liblinphone_la_LDFLAGS += -Wl,--output-def,liblinphone-$(LIBLINPHONE_SO_CURRENT).def
defexecdir = $(libdir)
defexec_DATA = liblinphone-$(LIBLINPHONE_SO_CURRENT).def
CLEANFILES += $(defexec_DATA)
liblinphone-$(LIBLINPHONE_SO_CURRENT).def: liblinphone.la
if BUILD_WIN32
defexec_DATA += liblinphone-$(LIBLINPHONE_SO_CURRENT).lib
liblinphone-$(LIBLINPHONE_SO_CURRENT).lib: liblinphone-$(LIBLINPHONE_SO_CURRENT).def liblinphone.la
$(DLLTOOL) --dllname liblinphone-$(LIBLINPHONE_SO_CURRENT).dll --input-def liblinphone-$(LIBLINPHONE_SO_CURRENT).def --output-lib $@ liblinphone.la
endif
endif
liblinphone_la_LIBADD= \
$(MEDIASTREAMER_LIBS) \
$(ORTP_LIBS) \
$(SIPSTACK_LIBS) \
$(TUNNEL_LIBS) \
$(SQLITE3_LIBS) \
$(LIBXML2_LIBS) \
$(LDAP_LIBS) \
$(SASL_LIBS) \
$(BELCARD_LIBS) \
$(ZLIB_LIBS) \
$(BCTOOLBOX_LIBS)
AM_CPPFLAGS=\
-I$(top_srcdir) -I$(top_srcdir)/include -I$(builddir) \
$(ORTP_CFLAGS) \
$(MEDIASTREAMER_CFLAGS) \
$(LIBXML2_CFLAGS)
COMMON_CFLAGS=\
$(STRICT_OPTIONS) \
$(SIPSTACK_CFLAGS) \
-DENABLE_TRACE \
-DLOG_DOMAIN=\"LinphoneCore\" \
$(IPV6_CFLAGS) \
-DORTP_INET6 \
$(VIDEO_CFLAGS) \
$(TUNNEL_CFLAGS) \
$(SQLITE3_CFLAGS) \
$(LIBXML2_CFLAGS) \
$(LDAP_CFLAGS) \
$(SASL_CFLAGS) \
$(BELCARD_CFLAGS) \
$(ZLIB_CFLAGS) \
$(BCTOOLBOX_CFLAGS)
if BUILD_WIZARD
COMMON_CFLAGS+= -DBUILD_WIZARD
endif
COMMON_CFLAGS+= -DUSE_BELLESIP
AM_CFLAGS=$(COMMON_CFLAGS) $(STRICT_OPTIONS_CC)
AM_CXXFLAGS=$(COMMON_CFLAGS) $(STRICT_OPTIONS_CXX)
if BUILD_VCARD
AM_CXXFLAGS+=-std=c++11
endif
#Make sure that we are in linphone's git tree by doing git log $(top_srcdir)/configure.ac.
#if it is something known to git, then that will be ok to check the git describe number and make sure it is consistent with
#the PACKAGE_VERSION given in configure.ac
make_gitversion_h:
if test -n "$(GITLOG)" ; then \
if test "$(GITDESCRIBE)" != "" ; then \
if [ "$(GIT_TAG)" != "$(PACKAGE_VERSION)" ]; then \
$(ECHO) "*** PACKAGE_VERSION and git tag differ. Please put them identical."; \
exit 1; \
fi ; \
printf "#define LIBLINPHONE_GIT_VERSION \"$(GITDESCRIBE)\"\n" > $(builddir)/$(GITVERSION_FILE_TMP) ; \
elif test "$(GITREVISION)" != "" ; then \
printf "#define LIBLINPHONE_GIT_VERSION \"$(LINPHONE_VERSION)_$(GITREVISION)\"\n" > $(builddir)/$(GITVERSION_FILE_TMP) ; \
else \
printf "" > $(builddir)/$(GITVERSION_FILE_TMP) ; \
fi ; \
if ! test -f $(builddir)/$(GITVERSION_FILE) ; then \
cp -f $(builddir)/$(GITVERSION_FILE_TMP) $(builddir)/$(GITVERSION_FILE) ; \
fi ; \
if test "`cat $(builddir)/$(GITVERSION_FILE_TMP)`" != "`cat $(builddir)/$(GITVERSION_FILE)`" ; then \
cp -f $(builddir)/$(GITVERSION_FILE_TMP) $(builddir)/$(GITVERSION_FILE) ; \
fi ; \
rm -f $(builddir)/$(GITVERSION_FILE_TMP) ; \
else \
touch $(GITVERSION_FILE) ; \
fi
$(GITVERSION_FILE): make_gitversion_h
......@@ -23,17 +23,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <time.h>
#ifdef SQLITE_STORAGE_ENABLED
#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(__QNXNTO__)
#include <langinfo.h>
#include <iconv.h>
#include <string.h>
#endif
#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(__QNXNTO__)
#include <langinfo.h>
#include <iconv.h>
#include <string.h>
#endif // if !defined(_WIN32) && !defined(__ANDROID__) && !defined(__QNXNTO__)
#include "sqlite3.h"
#define MAX_PATH_SIZE 1024
#endif
#define MAX_PATH_SIZE 1024
#include "c-wrapper/c-wrapper.h"
......@@ -171,7 +167,7 @@ bctbx_list_t * linphone_core_read_call_logs_from_config_file(LinphoneCore *lc){
* Public functions *
******************************************************************************/
LinphoneCallLog *linphone_core_create_call_log(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, LinphoneCallDir dir,
LinphoneCallLog *linphone_core_create_call_log(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, LinphoneCallDir dir,
int duration, time_t start_time, time_t connected_time, LinphoneCallStatus status, bool_t video_enabled, float quality) {
LinphoneCallLog *log = linphone_call_log_new(dir, linphone_address_ref(from), linphone_address_ref(to));
......@@ -374,8 +370,6 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneCallLog, belle_sip_object_t,
* SQL storage related functions *
******************************************************************************/
#ifdef SQLITE_STORAGE_ENABLED
static void linphone_create_call_log_table(sqlite3* db) {
char* errmsg=NULL;
int ret;
......@@ -725,42 +719,3 @@ LinphoneCallLog * linphone_core_find_call_log_from_call_id(LinphoneCore *lc, con
return result;
}
#else
void linphone_core_call_log_storage_init(LinphoneCore *lc) {
}
void linphone_core_call_log_storage_close(LinphoneCore *lc) {
}
void linphone_core_store_call_log(LinphoneCore *lc, LinphoneCallLog *log) {
}
const bctbx_list_t *linphone_core_get_call_history(LinphoneCore *lc) {
return NULL;
}
void linphone_core_delete_call_history(LinphoneCore *lc) {
}
void linphone_core_delete_call_log(LinphoneCore *lc, LinphoneCallLog *log) {
}
int linphone_core_get_call_history_size(LinphoneCore *lc) {
return 0;
}
bctbx_list_t * linphone_core_get_call_history_for_address(LinphoneCore *lc, const LinphoneAddress *addr) {
return NULL;
}
LinphoneCallLog * linphone_core_get_last_outgoing_call_log(LinphoneCore *lc) {
return NULL;
}
LinphoneCallLog * linphone_core_find_call_log_from_call_id(LinphoneCore *lc, const char *call_id) {
return NULL;
}
#endif
......@@ -25,20 +25,13 @@
#include "linphone/core.h"
#include "linphone/lpconfig.h"
#ifdef SQLITE_STORAGE_ENABLED
#ifndef _WIN32
#if !defined(__ANDROID__) && !defined(__QNXNTO__)
#include <langinfo.h>
#include <iconv.h>
#include <string.h>
#endif
#else
#include <Windows.h>
#endif
#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(__QNXNTO__)
#include <langinfo.h>
#include <iconv.h>
#include <string.h>
#endif // if !defined(_WIN32) && !defined(__ANDROID__) && !defined(__QNXNTO__)
#define MAX_PATH_SIZE 1024
#include "sqlite3.h"
#endif
#include "c-wrapper/c-wrapper.h"
#include "core/core-p.h"
......@@ -778,16 +771,8 @@ void linphone_friend_update_subscribes(LinphoneFriend *fr, bool_t only_when_regi
}
void linphone_friend_save(LinphoneFriend *fr, LinphoneCore *lc) {
if (!lc) return;
#ifdef SQLITE_STORAGE_ENABLED
if (lc->friends_db_file) {
if (lc && lc->friends_db_file)
linphone_core_store_friend_in_db(lc, fr);
} else {
linphone_core_write_friends_config(lc);
}
#else
linphone_core_write_friends_config(lc);
#endif
}
void linphone_friend_apply(LinphoneFriend *fr, LinphoneCore *lc) {
......@@ -1072,50 +1057,6 @@ const char *__policy_enum_to_str(LinphoneSubscribePolicy pol){
return "wait";
}
void linphone_friend_write_to_config_file(LpConfig *config, LinphoneFriend *lf, int index){
char key[50];
char *tmp;
const char *refkey;
sprintf(key,"friend_%i",index);
if (lf==NULL){
lp_config_clean_section(config,key);
return;
}
if (lf->uri!=NULL){
tmp=linphone_address_as_string(lf->uri);
if (tmp==NULL) {
return;
}
lp_config_set_string(config,key,"url",tmp);
ms_free(tmp);
}
lp_config_set_string(config,key,"pol",__policy_enum_to_str(lf->pol));
lp_config_set_int(config,key,"subscribe",lf->subscribe);
lp_config_set_int(config, key, "presence_received", lf->presence_received);
refkey=linphone_friend_get_ref_key(lf);
if (refkey){
lp_config_set_string(config,key,"refkey",refkey);
}
}
void linphone_core_write_friends_config(LinphoneCore* lc) {
bctbx_list_t *elem;
int i;
int store_friends;
if (! linphone_core_ready(lc)) return; /*dont write config when reading it !*/
store_friends = lp_config_get_int(lc->config, "misc", "store_friends", 1);
if (store_friends) {
for (elem=linphone_core_get_default_friend_list(lc)->friends,i=0; elem!=NULL; elem=bctbx_list_next(elem),i++){
linphone_friend_write_to_config_file(lc->config,(LinphoneFriend*)bctbx_list_get_data(elem),i);
}
linphone_friend_write_to_config_file(lc->config,NULL,i); /* set the end */
}
}
LinphoneCore *linphone_friend_get_core(const LinphoneFriend *fr){
return fr->lc;
}
......@@ -1234,8 +1175,6 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneFriend, belle_sip_object_t,
* SQL storage related functions *
******************************************************************************/
#ifdef SQLITE_STORAGE_ENABLED
static void linphone_create_friends_table(sqlite3* db) {
char* errmsg = NULL;
int ret;
......@@ -1693,36 +1632,6 @@ bctbx_list_t* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc) {
return result;
}
#else
void linphone_core_friends_storage_init(LinphoneCore *lc) {
}
void linphone_core_friends_storage_close(LinphoneCore *lc) {
}
void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf) {
}
void linphone_core_store_friends_list_in_db(LinphoneCore *lc, LinphoneFriendList *list) {
}
void linphone_core_remove_friend_from_db(LinphoneCore *lc, LinphoneFriend *lf) {
}
void linphone_core_remove_friends_list_from_db(LinphoneCore *lc, LinphoneFriendList *list) {
}
bctbx_list_t* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list) {
return NULL;
}
bctbx_list_t* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc) {
return NULL;
}
#endif
void linphone_core_set_friends_database_path(LinphoneCore *lc, const char *path) {
if (!linphone_core_conference_server_enabled(lc))
L_GET_PRIVATE(lc->cppPtr)->mainDb->import(LinphonePrivate::MainDb::Sqlite3, path);
......
......@@ -648,11 +648,10 @@ static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFrie
bctbx_list_t *elem = bctbx_list_find(list->friends, lf);
if (elem == NULL) return LinphoneFriendListNonExistentFriend;
#ifdef SQLITE_STORAGE_ENABLED
if (lf && lf->lc && lf->lc->friends_db) {
linphone_core_remove_friend_from_db(lf->lc, lf);
}
#endif
if (remove_from_server) {
LinphoneVcard *lvc = linphone_friend_get_vcard(lf);
if (lvc && linphone_vcard_get_uid(lvc)) {
......@@ -666,9 +665,6 @@ static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFrie
}
}
}
if (!list->lc->friends_db_file) {
linphone_core_write_friends_config(list->lc);
}
list->friends = bctbx_list_erase_link(list->friends, elem);
if(lf->refkey) {
bctbx_iterator_t * it = bctbx_map_cchar_find_key(list->friends_map, lf->refkey);
......
......@@ -32,9 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "conference_private.h"
#include "logger/logger.h"
#ifdef SQLITE_STORAGE_ENABLED
#include "sqlite3_bctbx_vfs.h"
#endif
#include <math.h>
#include <sys/types.h>
......@@ -1868,34 +1866,15 @@ static void read_friends_from_rc(LinphoneCore *lc)
}
}
static void ui_config_read(LinphoneCore *lc)
{
#ifndef SQLITE_STORAGE_ENABLED
read_friends_from_rc(lc);
lc->call_logs = call_logs_read_from_config_file(lc);
#else
static void ui_config_read(LinphoneCore *lc) {
if (!lc->friends_db) {
read_friends_from_rc(lc);
}
if (!lc->logs_db) {
lc->call_logs = linphone_core_read_call_logs_from_config_file(lc);
}
#endif
}
/*
static void autoreplier_config_init(LinphoneCore *lc)
{
autoreplier_config_t *config=&lc->autoreplier_conf;
config->enabled=lp_config_get_int(lc->config,"autoreplier","enabled",0);
config->after_seconds=lp_config_get_int(lc->config,"autoreplier","after_seconds",6);
config->max_users=lp_config_get_int(lc->config,"autoreplier","max_users",1);
config->max_rec_time=lp_config_get_int(lc->config,"autoreplier","max_rec_time",60);
config->max_rec_msg=lp_config_get_int(lc->config,"autoreplier","max_rec_msg",10);
config->message=lp_config_get_string(lc->config,"autoreplier","message",NULL);
}
*/
bool_t linphone_core_tunnel_available(void){
#ifdef TUNNEL_ENABLED
return TRUE;
......@@ -2408,9 +2387,7 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
lc->ringtoneplayer = linphone_ringtoneplayer_new();
#ifdef SQLITE_STORAGE_ENABLED
sqlite3_bctbx_vfs_register(0);
#endif
lc->qrcode_rect.h = 0;
lc->qrcode_rect.w = 0;
......@@ -2771,9 +2748,7 @@ LinphoneFriendList *linphone_core_get_friend_list_by_name(const LinphoneCore *lc
void linphone_core_remove_friend_list(LinphoneCore *lc, LinphoneFriendList *list) {
bctbx_list_t *elem = bctbx_list_find(lc->friends_lists, list);
if (elem == NULL) return;
#ifdef SQLITE_STORAGE_ENABLED
linphone_core_remove_friends_list_from_db(lc, list);
#endif
linphone_core_notify_friend_list_removed(lc, list);
list->lc = NULL;
linphone_friend_list_unref(list);
......@@ -2785,9 +2760,7 @@ void linphone_core_add_friend_list(LinphoneCore *lc, LinphoneFriendList *list) {
list->lc = lc;
}
lc->friends_lists = bctbx_list_append(lc->friends_lists, linphone_friend_list_ref(list));
#ifdef SQLITE_STORAGE_ENABLED
linphone_core_store_friends_list_in_db(lc, list);
#endif
linphone_core_notify_friend_list_created(lc, list);
}
......@@ -4821,23 +4794,19 @@ const char * linphone_core_get_call_logs_database_path(LinphoneCore *lc) {
}
const bctbx_list_t* linphone_core_get_call_logs(LinphoneCore *lc) {
#ifdef SQLITE_STORAGE_ENABLED
if (lc->logs_db) {
linphone_core_get_call_history(lc);
}
#endif
return lc->call_logs;
}
void linphone_core_clear_call_logs(LinphoneCore *lc) {
bool_t call_logs_sqlite_db_found = FALSE;
lc->missed_calls=0;
#ifdef SQLITE_STORAGE_ENABLED
if (lc->logs_db) {
call_logs_sqlite_db_found = TRUE;
linphone_core_delete_call_history(lc);
}
#endif
if (!call_logs_sqlite_db_found) {
bctbx_list_for_each(lc->call_logs, (void (*)(void*))linphone_call_log_unref);
lc->call_logs = bctbx_list_free(lc->call_logs);
......@@ -4855,12 +4824,10 @@ void linphone_core_reset_missed_calls_count(LinphoneCore *lc) {
void linphone_core_remove_call_log(LinphoneCore *lc, LinphoneCallLog *cl) {
bool_t call_logs_sqlite_db_found = FALSE;
#ifdef SQLITE_STORAGE_ENABLED
if (lc->logs_db) {
call_logs_sqlite_db_found = TRUE;
linphone_core_delete_call_log(lc, cl);
}
#endif
lc->call_logs = bctbx_list_remove(lc->call_logs, cl);
if (!call_logs_sqlite_db_found) {
call_logs_write_to_config_file(lc);
......@@ -4874,10 +4841,6 @@ void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) {
size_t original_logs_count, migrated_logs_count;
int i;
#ifndef SQLITE_STORAGE_ENABLED
ms_warning("linphone has been compiled without sqlite, can't migrate call logs");
return;
#endif
if (!lc) {
return;
}
......@@ -6613,8 +6576,6 @@ void linphone_core_remove_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook
// TODO: Remove me later, code found in message_storage.c.
// =============================================================================
#ifdef SQLITE_STORAGE_ENABLED
int _linphone_sqlite3_open(const char *db_file, sqlite3 **db) {
char* errmsg = NULL;
int ret;
......@@ -6645,8 +6606,6 @@ int _linphone_sqlite3_open(const char *db_file, sqlite3 **db) {
return ret;
}
#endif
// =============================================================================
void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){
......@@ -6729,25 +6688,18 @@ const char *linphone_core_get_zrtp_secrets_file(LinphoneCore *lc){
}
void *linphone_core_get_zrtp_cache_db(LinphoneCore *lc){
#ifdef SQLITE_STORAGE_ENABLED
return (void *)lc->zrtp_cache_db;
#else /* SQLITE_STORAGE_ENABLED */
return NULL;
#endif /* SQLITE_STORAGE_ENABLED */
}
static void linphone_core_zrtp_cache_close(LinphoneCore *lc) {
#ifdef SQLITE_STORAGE_ENABLED
if (lc->zrtp_cache_db) {
sqlite3_close(lc->zrtp_cache_db);
lc->zrtp_cache_db = NULL;
}
#endif /* SQLITE_STORAGE_ENABLED */
}
void linphone_core_zrtp_cache_db_init(LinphoneCore *lc, const char *fileName) {
#ifdef SQLITE_STORAGE_ENABLED
int ret;
const char *errmsg;
const char *backupExtension = "_backup";
......@@ -6786,7 +6738,6 @@ void linphone_core_zrtp_cache_db_init(LinphoneCore *lc, const char *fileName) {
lc->zrtp_cache_db = db;
end:
if (backupName) bctbx_free(backupName);
#endif /* SQLITE_STORAGE_ENABLED */
}
void linphone_core_set_user_certificates_path (LinphoneCore *lc, const char *path) {
......@@ -7509,14 +7460,14 @@ void linphone_core_check_for_update(LinphoneCore *lc, const char *current_versio
if (strcmp(tag, "win32") == 0) platform = "windows";
else if (strcmp(tag, "apple") == 0) platform = "macosx";
else if (strcmp(tag, "linux") == 0) platform = "linux";
else if (strcmp(tag, "ios") == 0) mobilePlatform = "ios";
else if (strcmp(tag, "android") == 0) mobilePlatform = "android";
else if (strcmp(tag, "ios") == 0) mobilePlatform = "ios";
else if (strcmp(tag, "android") == 0) mobilePlatform = "android";
else if (strcmp(tag, "desktop") == 0) is_desktop = TRUE;
}
if (!is_desktop) {
platform = mobilePlatform;
}
if (platform == NULL) {
if (!is_desktop) {
platform = mobilePlatform;
}
if (platform == NULL) {
ms_warning("Update checking is not supported on this platform");
return;
}
......
......@@ -932,12 +932,11 @@ void linphone_core_report_call_log(LinphoneCore *lc, LinphoneCallLog *call_log){
return;
// End of workaround
#ifdef SQLITE_STORAGE_ENABLED
if (lc->logs_db) {
call_logs_sqlite_db_found = TRUE;
linphone_core_store_call_log(lc, call_log);
}
#endif
if (!call_logs_sqlite_db_found) {
lc->call_logs=bctbx_list_prepend(lc->call_logs,linphone_call_log_ref(call_log));