Commit ab6f19f1 authored by Mickaël Turnel's avatar Mickaël Turnel
Browse files

Add options to enable/disable advanced IM and database storage

parent f3825f58
......@@ -40,9 +40,11 @@ include(cmake/Tools.cmake)
option(ENABLE_SHARED "Build shared library." YES)
option(ENABLE_STATIC "Build static library." YES)
option(ENABLE_ADVANCED_IM "Enable advanced instant messaging such as group chat." 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_CXX_WRAPPER "Build the C++ wrapper for Liblinphone." YES)
option(ENABLE_DB_STORAGE "Enable database storage." YES)
option(ENABLE_SWIFT_WRAPPER "Build the swift wrapper for Liblinphone." OFF)
option(ENABLE_JAZZY_DOC "Build the jazzy doc for swift module of Liblinphone." OFF)
option(ENABLE_DAEMON "Enable the linphone daemon interface." YES)
......@@ -136,15 +138,22 @@ else()
find_package(Belr REQUIRED)
endif()
find_package(LibXsd REQUIRED)
if(ENABLE_ADVANCED_IM)
find_package(LibXsd REQUIRED)
set(HAVE_ADVANCED_IM 1)
endif()
find_package(Sqlite3 REQUIRED)
find_package(XML2 REQUIRED)
#APPLE platform does not use dlopen for soci backend
if (APPLE)
find_package(Soci REQUIRED COMPONENTS sqlite3)
else()
find_package(Soci REQUIRED)
if (ENABLE_DB_STORAGE)
#APPLE platform does not use dlopen for soci backend
if (APPLE)
find_package(Soci REQUIRED COMPONENTS sqlite3)
else()
find_package(Soci REQUIRED)
endif()
set(HAVE_DB_STORAGE 1)
endif()
find_package(ZLIB)
......
......@@ -47,4 +47,6 @@
#cmakedefine HAVE_LIBUDEV_H 0
#cmakedefine HAVE_LIME
#cmakedefine HAVE_LIME_X3DH
#cmakedefine HAVE_ADVANCED_IM
#cmakedefine HAVE_DB_STORAGE
#cmakedefine ENABLE_UPDATE_CHECK 1
......@@ -42,8 +42,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "call/call-p.h"
#include "chat/chat-message/chat-message-p.h"
#include "chat/chat-room/chat-room.h"
#ifdef HAVE_ADVANCED_IM
#include "chat/chat-room/client-group-chat-room-p.h"
#include "chat/chat-room/server-group-chat-room-p.h"
#endif
#include "conference/participant.h"
#include "conference/session/call-session-p.h"
#include "conference/session/call-session.h"
......@@ -100,6 +102,7 @@ static void call_received(SalCallOp *h) {
LinphoneAddress *toAddr = linphone_address_new(h->getTo().c_str());
if (_linphone_core_is_conference_creation(lc, toAddr)) {
#ifdef HAVE_ADVANCED_IM
linphone_address_unref(toAddr);
linphone_address_unref(fromAddr);
if (sal_address_has_param(h->getRemoteContactAddress(), "text")) {
......@@ -132,9 +135,14 @@ static void call_received(SalCallOp *h) {
}
// TODO: handle media conference creation if the "text" feature tag is not present
return;
#else
ms_warning("Advanced IM such as group chat is disabled!");
return;
#endif
}
if (sal_address_has_param(h->getRemoteContactAddress(), "text")) {
#ifdef HAVE_ADVANCED_IM
linphone_address_unref(toAddr);
linphone_address_unref(fromAddr);
if (linphone_core_conference_server_enabled(lc)) {
......@@ -173,6 +181,10 @@ static void call_received(SalCallOp *h) {
L_GET_PRIVATE(static_pointer_cast<ClientGroupChatRoom>(chatRoom))->confirmJoining(h);
}
return;
#else
ms_warning("Advanced IM such as group chat is disabled!");
return;
#endif
} else {
// TODO: handle media conference joining if the "text" feature tag is not present
}
......@@ -824,6 +836,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
}
} else {
if (linphone_core_conference_server_enabled(lc)) {
#ifdef HAVE_ADVANCED_IM
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(
ConferenceId(IdentityAddress(op->getTo()), IdentityAddress(op->getTo()))
);
......@@ -853,6 +866,9 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
}
}
}
#else
ms_warning("Advanced IM such as group chat is disabled!");
#endif
}
}
}
......
......@@ -39,8 +39,10 @@
#include "call/call.h"
#include "chat/chat-room/chat-room-params.h"
#include "chat/chat-room/basic-chat-room.h"
#ifdef HAVE_ADVANCED_IM
#include "chat/chat-room/client-group-chat-room.h"
#include "chat/chat-room/client-group-to-basic-chat-room.h"
#endif
#include "chat/chat-room/real-time-text-chat-room-p.h"
#include "chat/chat-room/real-time-text-chat-room.h"
#include "content/content-type.h"
......
......@@ -239,7 +239,12 @@ LinphoneParticipantDeviceIdentity *linphone_factory_create_participant_device_id
const LinphoneAddress *address,
const char *name
) {
#ifdef HAVE_ADVANCED_IM
return linphone_participant_device_identity_new(address, name);
#else
ms_warning("Advanced IM such as group chat is disabled");
return NULL;
#endif
}
LinphoneAuthInfo *linphone_factory_create_auth_info(const LinphoneFactory *factory, const char *username, const char *userid, const char *passwd, const char *ha1, const char *realm, const char *domain) {
......@@ -482,4 +487,28 @@ LinphoneAccountCreatorCbs *linphone_factory_create_account_creator_cbs(LinphoneF
LinphoneXmlRpcRequestCbs *linphone_factory_create_xml_rpc_request_cbs(LinphoneFactory *factory) {
return linphone_xml_rpc_request_cbs_new();
}
\ No newline at end of file
}
bool_t linphone_factory_is_chatroom_backend_available(LinphoneFactory *factory, LinphoneChatRoomBackend chatroom_backend) {
#ifdef HAVE_ADVANCED_IM
return TRUE;
#else
return (chatroom_backend != LinphoneChatRoomBackendFlexisipChat);
#endif
}
bool_t linphone_factory_is_database_storage_available(LinphoneFactory *factory) {
#ifdef HAVE_DB_STORAGE
return TRUE;
#else
return FALSE;
#endif
}
bool_t linphone_factory_is_imdn_available(LinphoneFactory *factory) {
#ifdef HAVE_ADVANCED_IM
return TRUE;
#else
return FALSE;
#endif
}
......@@ -34,6 +34,7 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneImNotifPolicy, belle_sip_object_t,
);
static void load_im_notif_policy_from_config(LinphoneImNotifPolicy *policy) {
#ifdef HAVE_ADVANCED_IM
bctbx_list_t *default_list = bctbx_list_append(NULL, (void *)"all");
bctbx_list_t *values = lp_config_get_string_list(policy->lc->config, "sip", "im_notif_policy", default_list);
bctbx_list_t *elem;
......@@ -72,9 +73,18 @@ static void load_im_notif_policy_from_config(LinphoneImNotifPolicy *policy) {
bctbx_list_free_with_data(values, ms_free);
}
bctbx_list_free(default_list);
#else
policy->send_is_composing = FALSE;
policy->recv_is_composing = FALSE;
policy->send_imdn_delivered = FALSE;
policy->recv_imdn_delivered = FALSE;
policy->send_imdn_displayed = FALSE;
policy->recv_imdn_displayed = FALSE;
#endif
}
static void save_im_notif_policy_to_config(LinphoneImNotifPolicy *policy) {
#ifdef HAVE_ADVANCED_IM
bctbx_list_t *values = NULL;
if ((policy->send_is_composing == TRUE)
&& (policy->recv_is_composing == TRUE)
......@@ -106,6 +116,7 @@ static void save_im_notif_policy_to_config(LinphoneImNotifPolicy *policy) {
}
lp_config_set_string_list(policy->lc->config, "sip", "im_notif_policy", values);
if (values != NULL) bctbx_list_free(values);
#endif
}
LinphoneImNotifPolicy * linphone_im_notif_policy_ref(LinphoneImNotifPolicy *policy) {
......@@ -137,6 +148,7 @@ void linphone_im_notif_policy_clear(LinphoneImNotifPolicy *policy) {
}
void linphone_im_notif_policy_enable_all(LinphoneImNotifPolicy *policy) {
#ifdef HAVE_ADVANCED_IM
policy->send_is_composing = TRUE;
policy->recv_is_composing = TRUE;
policy->send_imdn_delivered = TRUE;
......@@ -144,6 +156,9 @@ void linphone_im_notif_policy_enable_all(LinphoneImNotifPolicy *policy) {
policy->send_imdn_displayed = TRUE;
policy->recv_imdn_displayed = TRUE;
save_im_notif_policy_to_config(policy);
#else
ms_warning("Cannot enable im policy because ENABLE_ADVANCED_IM is OFF");
#endif
}
bool_t linphone_im_notif_policy_get_send_is_composing(const LinphoneImNotifPolicy *policy) {
......
......@@ -58,6 +58,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "bctoolbox/charconv.h"
#ifdef HAVE_ADVANCED_IM
#include "chat/chat-room/client-group-chat-room-p.h"
#include "chat/chat-room/client-group-to-basic-chat-room.h"
#include "chat/chat-room/server-group-chat-room-p.h"
......@@ -65,6 +66,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "conference/handlers/remote-conference-event-handler.h"
#include "conference/handlers/remote-conference-event-handler-p.h"
#include "conference/handlers/remote-conference-list-event-handler.h"
#endif
#include "content/content-manager.h"
#include "content/content-type.h"
#include "core/core-p.h"
......@@ -2249,6 +2251,7 @@ static void linphone_core_internal_notify_received(LinphoneCore *lc, LinphoneEve
linphone_friend_list_notify_presence_received(list, lev, body);
}
} else if (strcmp(notified_event, "conference") == 0) {
#ifdef HAVE_ADVANCED_IM
const LinphoneAddress *resource = linphone_event_get_resource(lev);
char *resourceAddrStr = linphone_address_as_string_uri_only(resource);
const char *factoryUri = linphone_proxy_config_get_conference_factory_uri(linphone_core_get_default_proxy_config(lc));
......@@ -2285,10 +2288,14 @@ static void linphone_core_internal_notify_received(LinphoneCore *lc, LinphoneEve
}
} else
L_GET_PRIVATE(cgcr)->notifyReceived(linphone_content_get_string_buffer(body));
#else
ms_message("Advanced IM such as group chat is disabled!");
#endif
}
}
static void _linphone_core_conference_subscribe_received(LinphoneCore *lc, LinphoneEvent *lev, const LinphoneContent *body) {
#ifdef HAVE_ADVANCED_IM
if (body && linphone_event_get_custom_header(lev, "Content-Disposition") && strcasecmp(linphone_event_get_custom_header(lev, "Content-Disposition"), "recipient-list") == 0) {
// List subscription
L_GET_PRIVATE_FROM_C_OBJECT(lc)->localListEventHandler->subscribeReceived(lev, body);
......@@ -2304,6 +2311,9 @@ static void _linphone_core_conference_subscribe_received(LinphoneCore *lc, Linph
L_GET_PRIVATE(static_pointer_cast<ServerGroupChatRoom>(chatRoom))->subscribeReceived(lev);
else
linphone_event_deny_subscription(lev, LinphoneReasonDeclined);
#else
ms_warning("Advanced IM such as group chat is disabled!");
#endif
}
static void linphone_core_internal_subscribe_received(LinphoneCore *lc, LinphoneEvent *lev, const char *subscribe_event, const LinphoneContent *body) {
......@@ -2313,6 +2323,7 @@ static void linphone_core_internal_subscribe_received(LinphoneCore *lc, Linphone
}
static void _linphone_core_conference_subscription_state_changed (LinphoneCore *lc, LinphoneEvent *lev, LinphoneSubscriptionState state) {
#ifdef HAVE_ADVANCED_IM
if (!linphone_core_conference_server_enabled(lc)) {
RemoteConferenceEventHandlerPrivate *thiz = static_cast<RemoteConferenceEventHandlerPrivate *>(linphone_event_get_user_data(lev));
if (state == LinphoneSubscriptionError)
......@@ -2328,6 +2339,9 @@ static void _linphone_core_conference_subscription_state_changed (LinphoneCore *
));
if (chatRoom)
L_GET_PRIVATE(static_pointer_cast<ServerGroupChatRoom>(chatRoom))->subscriptionStateChanged(lev, state);
#else
ms_warning("Advanced IM such as group chat is disabled!");
#endif
}
static void linphone_core_internal_subscription_state_changed(LinphoneCore *lc, LinphoneEvent *lev, LinphoneSubscriptionState state) {
......
......@@ -558,6 +558,28 @@ LINPHONE_PUBLIC LinphoneAccountCreatorCbs *linphone_factory_create_account_creat
*/
LINPHONE_PUBLIC LinphoneXmlRpcRequestCbs *linphone_factory_create_xml_rpc_request_cbs(LinphoneFactory *factory);
/**
* Indicates if the given LinphoneChatRoomBackend is available
* @param[in] factory the #LinphoneFactory
* @param[in] chatroom_backend the #LinphoneChatRoomBackend
* @return TRUE if the chatroom backend is available, FALSE otherwise
*/
LINPHONE_PUBLIC bool_t linphone_factory_is_chatroom_backend_available(LinphoneFactory *factory, LinphoneChatRoomBackend chatroom_backend);
/**
* Indicates if the storage in database is available
* @param[in] factory the #LinphoneFactory
* @return TRUE if the database storage is available, FALSE otherwise
*/
LINPHONE_PUBLIC bool_t linphone_factory_is_database_storage_available(LinphoneFactory *factory);
/**
* Indicates if IMDN are available
* @param[in] factory the #LinphoneFactory
* @return TRUE if IDMN are available
*/
LINPHONE_PUBLIC bool_t linphone_factory_is_imdn_available(LinphoneFactory *factory);
/**
* @}
*/
......
......@@ -27,8 +27,10 @@ set(LIBS
${ORTP_LIBRARIES}
${XML2_LIBRARIES}
${BELR_LIBRARIES}
${LIBXSD_LIBRARIES}
)
if(ENABLE_ADVANCED_IM)
list(APPEND LIBS ${LIBXSD_LIBRARIES})
endif()
if(APPLE)
list(APPEND LIBS "-framework CFNetwork")
endif()
......@@ -44,10 +46,12 @@ endif()
if(ZLIB_FOUND)
list(APPEND LIBS ${ZLIB_LIBRARIES})
endif()
if(SOCI_FOUND)
list(APPEND LIBS ${SOCI_LIBRARIES})
if(APPLE)
list(APPEND LIBS ${SOCI_sqlite3_PLUGIN})
if (ENABLE_DB_STORAGE)
if(SOCI_FOUND)
list(APPEND LIBS ${SOCI_LIBRARIES})
if(APPLE)
list(APPEND LIBS ${SOCI_sqlite3_PLUGIN})
endif()
endif()
endif()
if(SQLITE3_FOUND)
......@@ -105,19 +109,11 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
chat/chat-room/abstract-chat-room.h
chat/chat-room/basic-chat-room-p.h
chat/chat-room/basic-chat-room.h
chat/chat-room/basic-to-client-group-chat-room.h
chat/chat-room/chat-room-listener.h
chat/chat-room/chat-room-p.h
chat/chat-room/chat-room.h
chat/chat-room/client-group-chat-room-p.h
chat/chat-room/client-group-chat-room.h
chat/chat-room/client-group-to-basic-chat-room.h
chat/chat-room/proxy-chat-room-p.h
chat/chat-room/proxy-chat-room.h
chat/chat-room/real-time-text-chat-room-p.h
chat/chat-room/real-time-text-chat-room.h
chat/chat-room/server-group-chat-room-p.h
chat/chat-room/server-group-chat-room.h
chat/cpim/cpim.h
chat/cpim/header/cpim-core-headers.h
chat/cpim/header/cpim-generic-header.h
......@@ -139,12 +135,6 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
conference/conference-listener.h
conference/conference-p.h
conference/conference.h
conference/handlers/local-conference-event-handler-p.h
conference/handlers/local-conference-event-handler.h
conference/handlers/local-conference-list-event-handler.h
conference/handlers/remote-conference-event-handler-p.h
conference/handlers/remote-conference-event-handler.h
conference/handlers/remote-conference-list-event-handler.h
conference/local-conference-p.h
conference/local-conference.h
conference/params/call-session-params-p.h
......@@ -182,7 +172,6 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
core/platform-helpers/platform-helpers.h
db/abstract/abstract-db-p.h
db/abstract/abstract-db.h
db/internal/db-transaction.h
db/internal/statements.h
db/main-db-chat-message-key.h
db/main-db-event-key.h
......@@ -190,7 +179,6 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
db/main-db-key.h
db/main-db-p.h
db/main-db.h
db/session/db-session.h
dial-plan/dial-plan.h
enums.h
event-log/conference/conference-call-event.h
......@@ -230,15 +218,41 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
utils/general-internal.h
utils/payload-type-handler.h
variant/variant.h
xml/conference-info.h
xml/imdn.h
xml/is-composing.h
xml/linphone-imdn.h
xml/resource-lists.h
xml/rlmi.h
xml/xml.h
)
if(ENABLE_ADVANCED_IM)
list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
chat/chat-room/basic-to-client-group-chat-room.h
chat/chat-room/client-group-chat-room-p.h
chat/chat-room/client-group-chat-room.h
chat/chat-room/client-group-to-basic-chat-room.h
chat/chat-room/proxy-chat-room-p.h
chat/chat-room/proxy-chat-room.h
chat/chat-room/server-group-chat-room-p.h
chat/chat-room/server-group-chat-room.h
conference/handlers/local-conference-event-handler-p.h
conference/handlers/local-conference-event-handler.h
conference/handlers/local-conference-list-event-handler.h
conference/handlers/remote-conference-event-handler-p.h
conference/handlers/remote-conference-event-handler.h
conference/handlers/remote-conference-list-event-handler.h
xml/conference-info.h
xml/imdn.h
xml/is-composing.h
xml/linphone-imdn.h
xml/resource-lists.h
xml/rlmi.h
xml/xml.h
)
endif()
if(ENABLE_DB_STORAGE)
list(APPEND LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
db/internal/db-transaction.h
db/session/db-session.h
)
endif()
set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
address/address.cpp
address/identity-address.cpp
......@@ -277,13 +291,8 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
chat/chat-message/notification-message.cpp
chat/chat-room/abstract-chat-room.cpp
chat/chat-room/basic-chat-room.cpp
chat/chat-room/basic-to-client-group-chat-room.cpp
chat/chat-room/chat-room.cpp
chat/chat-room/client-group-chat-room.cpp
chat/chat-room/client-group-to-basic-chat-room.cpp
chat/chat-room/proxy-chat-room.cpp
chat/chat-room/real-time-text-chat-room.cpp
chat/chat-room/server-group-chat-room.cpp
chat/chat-room/chat-room-params.cpp
chat/cpim/header/cpim-core-headers.cpp
chat/cpim/header/cpim-generic-header.cpp
......@@ -299,10 +308,6 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
chat/notification/is-composing.cpp
conference/conference-id.cpp
conference/conference.cpp
conference/handlers/local-conference-event-handler.cpp
conference/handlers/local-conference-list-event-handler.cpp
conference/handlers/remote-conference-event-handler.cpp
conference/handlers/remote-conference-list-event-handler.cpp
conference/local-conference.cpp
conference/params/call-session-params.cpp
conference/params/media-session-params.cpp
......@@ -332,7 +337,6 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
db/main-db-event-key.cpp
db/main-db-key.cpp
db/main-db.cpp
db/session/db-session.cpp
dial-plan/dial-plan.cpp
event-log/conference/conference-call-event.cpp
event-log/conference/conference-chat-message-event.cpp
......@@ -368,15 +372,33 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
utils/payload-type-handler.cpp
utils/utils.cpp
variant/variant.cpp
xml/conference-info.cpp
xml/imdn.cpp
xml/is-composing.cpp
xml/linphone-imdn.cpp
xml/resource-lists.cpp
xml/rlmi.cpp
xml/xml.cpp
)
if(ENABLE_ADVANCED_IM)
list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES
chat/chat-room/basic-to-client-group-chat-room.cpp
chat/chat-room/client-group-chat-room.cpp
chat/chat-room/client-group-to-basic-chat-room.cpp
chat/chat-room/proxy-chat-room.cpp
chat/chat-room/server-group-chat-room.cpp
conference/handlers/local-conference-event-handler.cpp
conference/handlers/local-conference-list-event-handler.cpp
conference/handlers/remote-conference-event-handler.cpp
conference/handlers/remote-conference-list-event-handler.cpp
xml/conference-info.cpp
xml/imdn.cpp
xml/is-composing.cpp
xml/linphone-imdn.cpp
xml/resource-lists.cpp
xml/rlmi.cpp
xml/xml.cpp
)
endif()
if (ENABLE_DB_STORAGE)
list(APPEND LINPHONE_CXX_OBJECTS_SOURCE_FILES db/session/db-session.cpp)
endif()
set(LINPHONE_OBJC_SOURCE_FILES)
if (APPLE)
list(APPEND LINPHONE_OBJC_SOURCE_FILES core/paths/paths-apple.mm)
......@@ -484,7 +506,9 @@ if(ENABLE_SHARED)
endif()
if(WIN32)
# Export Xerces and Soci symbols.
target_compile_definitions(linphone PRIVATE "-DDLL_EXPORT" "-DSOCI_DLL")
if(ENABLE_DB_STORAGE)
target_compile_definitions(linphone PRIVATE "-DDLL_EXPORT" "-DSOCI_DLL")
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set_target_properties(linphone PROPERTIES PREFIX "lib")
endif()
......
......@@ -31,8 +31,10 @@
#include "call/call.h"
#include "chat/chat-message/chat-message-p.h"
#include "chat/chat-room/real-time-text-chat-room-p.h"
#ifdef HAVE_ADVANCED_IM
#include "chat/chat-room/client-group-chat-room-p.h"
#include "chat/chat-room/server-group-chat-room-p.h"
#endif
#include "conference/participant.h"
#include "core/core-p.h"
#include "event-log/event-log.h"
......@@ -383,6 +385,7 @@ const bctbx_list_t *linphone_chat_room_get_composing_addresses (LinphoneChatRoom
}
void linphone_chat_room_set_conference_address (LinphoneChatRoom *cr, const LinphoneAddress *confAddr) {
#ifdef HAVE_ADVANCED_IM
char *addrStr = confAddr ? linphone_address_as_string(confAddr) : nullptr;
LinphonePrivate::ServerGroupChatRoomPrivate *sgcr = dynamic_cast<LinphonePrivate::ServerGroupChatRoomPrivate *>(L_GET_PRIVATE_FROM_C_OBJECT(cr));
if (sgcr) {
......@@ -391,24 +394,35 @@ void linphone_chat_room_set_conference_address (LinphoneChatRoom *cr, const Linp
}
if (addrStr)
bctbx_free(addrStr);
#else
lWarning() << "Advanced IM such as group chat is disabled!";
#endif
}
void linphone_chat_room_set_participant_devices (LinphoneChatRoom *cr, const LinphoneAddress *partAddr, const bctbx_list_t *deviceIdentities) {
#ifdef HAVE_ADVANCED_IM
char *addrStr = linphone_address_as_string(partAddr);
list<LinphonePrivate::ParticipantDeviceIdentity> lDevicesIdentities = L_GET_RESOLVED_CPP_LIST_FROM_C_LIST(deviceIdentities, ParticipantDeviceIdentity);
LinphonePrivate::ServerGroupChatRoomPrivate *sgcr = dynamic_cast<LinphonePrivate::ServerGroupChatRoomPrivate *>(L_GET_PRIVATE_FROM_C_OBJECT(cr));
if (sgcr)
sgcr->setParticipantDevices(LinphonePrivate::IdentityAddress(addrStr), lDevicesIdentities);
bctbx_free(addrStr);
#else
lWarning() << "Advanced IM such as group chat is disabled!";
#endif
}
void linphone_chat_room_notify_participant_device_registration(LinphoneChatRoom *cr, const LinphoneAddress *participant_device){
#ifdef HAVE_ADVANCED_IM
char *addrStr = linphone_address_as_string(participant_device);
list<LinphonePrivate::IdentityAddress> lIdentAddr;
LinphonePrivate::ServerGroupChatRoomPrivate *sgcr = dynamic_cast<LinphonePrivate::ServerGroupChatRoomPrivate *>(L_GET_PRIVATE_FROM_C_OBJECT(cr));
if (sgcr)
sgcr->notifyParticipantDeviceRegistration(LinphonePrivate::IdentityAddress(addrStr));
bctbx_free(addrStr);
#else
lWarning() << "Advanced IM such as group chat is disabled!";
#endif
}
// =============================================================================
......@@ -554,6 +568,7 @@ void linphone_chat_room_set_user_data (LinphoneChatRoom *cr, void *ud) {
// =============================================================================
LinphoneChatRoom *_linphone_server_group_chat_room_new (LinphoneCore *core, LinphonePrivate::SalCallOp *op) {
#ifdef HAVE_ADVANCED_IM
LinphoneChatRoom *cr = L_INIT(ChatRoom);
L_SET_CPP_PTR_FROM_C_OBJECT(cr, make_shared<LinphonePrivate::ServerGroupChatRoom>(
L_GET_CPP_PTR_FROM_C_OBJECT(core),
......@@ -562,4 +577,8 @@ LinphoneChatRoom *_linphone_server_group_chat_room_new (LinphoneCore *core, Linp
L_GET_PRIVATE_FROM_C_OBJECT(cr)->setState(LinphonePrivate::ChatRoom::State::Instantiated);
L_GET_PRIVATE_FROM_C_OBJECT(cr, ServerGroupChatRoom)->confirmCreation();
return cr;
#else
lWarning() << "Advanced IM such as group chat is disabled!";
return NULL;
#endif
}
......@@ -17,18 +17,27 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_ADVANCED_IM
#include "chat/chat-room/server-group-chat-room-p.h"
#endif
#include "c-wrapper/c-wrapper.h"
// =============================================================================
#ifdef HAVE_ADVANCED_IM
L_DECLARE_C_CLONABLE_OBJECT_IMPL(ParticipantDeviceIdentity);
#endif
using namespace std;
// =============================================================================
LinphoneParticipantDeviceIdentity *linphone_participant_device_identity_new (const LinphoneAddress *address, const char *name) {
#ifdef HAVE_ADVANCED_IM
LinphonePrivate::ParticipantDeviceIdentity *cppPtr = new LinphonePrivate::ParticipantDeviceIdentity(
*L_GET_CPP_PTR_FROM_C_OBJECT(address),
L_C_TO_STRING(name)
......@@ -37,17 +46,30 @@ LinphoneParticipantDeviceIdentity *linphone_participant_device_identity_new (con
L_SET_CPP_PTR_FROM_C_OBJECT(object, cppPtr);
return object;
#else
return NULL;
#endif
}
LinphoneParticipantDeviceIdentity *linphone_participant_device_identity_clone (const LinphoneParticipantDeviceIdentity *deviceIdentity) {
#ifdef HAVE_ADVANCED_IM
return reinterpret_cast<LinphoneParticipantDeviceIdentity *>(belle_sip_object_clone(BELLE_SIP_OBJECT(deviceIdentity)));
#else
return NULL;
#endif
}