...
 
Commits (381)
......@@ -43,10 +43,13 @@ 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_CXX_WRAPPER "Build the C++ wrapper for Liblinphone." 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)
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_LIME_X3DH "Enable LIMEv2 and X3DH encryption protocol." YES)
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)
......@@ -136,7 +139,13 @@ find_package(LibXsd REQUIRED)
find_package(Sqlite3 REQUIRED)
find_package(XML2 REQUIRED)
find_package(Soci)
#APPLE platform does not use dlopen for soci backend
if (APPLE)
find_package(Soci REQUIRED COMPONENTS sqlite3)
else()
find_package(Soci REQUIRED)
endif()
find_package(ZLIB)
if(ENABLE_TUNNEL)
......@@ -162,6 +171,14 @@ endif()
if(ENABLE_ASSISTANT)
set(BUILD_WIZARD 1)
endif()
if(ENABLE_LIME AND ENABLE_LIME_X3DH)
message(WARNING "Lime V1 and V2 cannot be used simultaneously! Using Lime V2 only instead.")
set(ENABLE_LIME FALSE)
endif()
if(ENABLE_LIME_X3DH)
find_package(Lime REQUIRED)
set(HAVE_LIME_X3DH TRUE)
endif()
if(ENABLE_LIME)
#bzrtp is only required for LIME
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
......@@ -171,7 +188,7 @@ if(ENABLE_LIME)
endif()
set(HAVE_LIME 1)
endif()
if(ENABLE_CXX_WRAPPER OR ENABLE_CSHARP_WRAPPER OR ENABLE_JAVA_WRAPPER OR ENABLE_DOC)
if(ENABLE_CXX_WRAPPER OR ENABLE_CSHARP_WRAPPER OR ENABLE_JAVA_WRAPPER OR ENABLE_SWIFT_WRAPPER OR ENABLE_DOC)
find_package(PythonInterp REQUIRED)
check_python_module(pystache)
check_python_module(six)
......@@ -179,6 +196,7 @@ if(ENABLE_CXX_WRAPPER OR ENABLE_CSHARP_WRAPPER OR ENABLE_JAVA_WRAPPER OR ENABLE_
check_python_module(sphinx)
check_python_module(javasphinx)
check_python_module(sphinx_csharp)
#check_python_module(swift_domain)
endif()
endif()
......@@ -197,7 +215,7 @@ if(NOT WIN32)
endif()
if(ANDROID)
find_package(CpuFeatures REQUIRED)
find_package(Support REQUIRED)
find_package(Support)
endif()
set(LINPHONE_LDFLAGS "${BELLESIP_LDFLAGS} ${MEDIASTREAMER2_LDFLAGS}")
......@@ -270,6 +288,7 @@ set(STRICT_OPTIONS_OBJC )
if(MSVC)
list(APPEND STRICT_OPTIONS_CPP "/wd4995") # Disable "name was marked as #pragma deprecated" warnings
list(APPEND STRICT_OPTIONS_CPP "/wd4996") # Disable deprecated function warnings
list(APPEND STRICT_OPTIONS_CPP "/wd4800") # Disable warning for cast from bool_t to bool
if(ENABLE_STRICT)
list(APPEND STRICT_OPTIONS_CPP "/WX")
endif()
......@@ -377,6 +396,9 @@ endif()
if(ENABLE_CSHARP_WRAPPER)
add_subdirectory(wrappers/csharp)
endif()
if(ENABLE_SWIFT_WRAPPER)
add_subdirectory(wrappers/swift)
endif()
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
......
......@@ -11,6 +11,8 @@ Group changes to describe their impact on the project, as follows:
Security to invite users to upgrade in case of vulnerabilities.
## [Incomming]
- Implementation of bodyless subscription
- Parsing of Display name in presence NOTIFY
### Added
- Avoid some SIP DNS lookups by keeping SRV target names
......@@ -15,19 +15,19 @@ This library is used by Linphone. It's source code is available at *linphone-des
* **BcToolbox[2]:** portability layer
* **BelleSIP[3]:** SIP stack
* **Mediastreamer2[4]:** multimedia engine
* **Belcard[5]:** VCard support
* **Belcard[5]:** VCard4 support
* **libxml2**
* **zlib**
* **libsqlite3:** user data storage (disablable)
* **gettext** and **libintl**: internationalization support (disablable)
* **python interpreter** and **pystache**, **six** python module (needed for C++ wrapper and API documentaiton)
* **libsqlite3:** user data storage (can be disabled)
* **gettext** and **libintl**: internationalization support (can be disabled)
* **python interpreter** and **pystache**, **six** python module (needed for C++/C#/Java wrappers and API documentation)
* **doxygen** and **dot** (needed for C++ wrapper and API documentation)
## Optional dependencies
* **Bzrtp[6]**: zrtp stack used for Linphone Instant Messaging Encryption.
* For API documentatino generation: **sphinx**, **javasphinx**, **sphinx_csharp** python modules are needed.
* **Bzrtp[6]**: zrtp stack used to secure calls and for LIME (Linphone Instant Messaging Encryption).
* For API documentation generation: **sphinx**, **javasphinx**, **sphinx_csharp** python modules are needed.
## Build instructions
......@@ -47,9 +47,9 @@ This library is used by Linphone. It's source code is available at *linphone-des
* **`ENABLE_STRICT=NO`** : build without strict compilation flags (-Wall -Werror)
* **`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_VCARD=NO`** : disable VCard4 support
* **`ENABLE_TOOLS=NO`** : do not build tool binaries
* **`ENABLE_LIME=YES`** : disable Linphone Instant Messaging Encryption
* **`ENABLE_LIME=NO`** : disable Linphone Instant Messaging Encryption
## Note for packagers
......
......@@ -76,6 +76,11 @@ install -p -m 0644 build/rpm/lp-autoanswer.service $RPM_BUILD_ROOT/lib/systemd/s
install -p -m 0644 build/rpm/lp-autoanswer.conf $RPM_BUILD_ROOT/etc/sysconfig
mv $RPM_BUILD_ROOT/etc/sysconfig/lp-autoanswer.conf $RPM_BUILD_ROOT/etc/sysconfig/lp-autoanswer
# Dirty workaround to give exec rights for all shared libraries. Debian packaging needs this
# TODO : set CMAKE_INSTALL_SO_NO_EXE for a cleaner workaround
chmod +x `find %{buildroot} *.so.*`
%check
#%{ctest_name} -V %{?_smp_mflags}
......
......@@ -37,7 +37,12 @@ find_path(LIBXSD_INCLUDE_DIRS
if(LIBXSD_INCLUDE_DIRS)
list(APPEND LIBXSD_INCLUDE_DIRS ${XercesC_INCLUDE_DIRS})
endif()
set(LIBXSD_LIBRARIES ${XercesC_LIBRARIES})
if (APPLE AND NOT IOS)
set(LIBXSD_LIBRARIES ${XercesC_LIBRARIES} "-framework CoreServices")
else()
set(LIBXSD_LIBRARIES ${XercesC_LIBRARIES})
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibXsd
......
......@@ -23,7 +23,12 @@
#
### Global Configuration Section
#
if(ANDROID)
SET(_SOCI_ALL_PLUGINS sqlite3)
else()
SET(_SOCI_ALL_PLUGINS mysql sqlite3)
endif()
SET(_SOCI_REQUIRED_VARS SOCI_INCLUDE_DIRS SOCI_LIBRARIES)
SET(_SOCI_VERSION "_4_0")
......@@ -39,7 +44,7 @@ MARK_AS_ADVANCED(SOCI_INCLUDE_DIRS)
#
FIND_LIBRARY(SOCI_LIBRARIES
NAMES soci_core soci_core${_SOCI_VERSION}
PATH_SUFFIXES lib lib64)
PATH_SUFFIXES Frameworks lib lib64)
MARK_AS_ADVANCED(SOCI_LIBRARIES)
GET_FILENAME_COMPONENT(SOCI_LIBRARY_DIR ${SOCI_LIBRARIES} PATH)
......@@ -56,7 +61,7 @@ IF(SOCI_INCLUDE_DIRS AND SOCI_LIBRARIES)
FIND_LIBRARY(
SOCI_${plugin}_PLUGIN
NAMES soci_${plugin} soci_${plugin}${_SOCI_VERSION}
PATH_SUFFIXES lib lib64)
PATH_SUFFIXES Frameworks lib lib64)
MARK_AS_ADVANCED(SOCI_${plugin}_PLUGIN)
IF(SOCI_${plugin}_PLUGIN)
......
......@@ -46,4 +46,5 @@
#cmakedefine HAVE_CU_CURSES 1
#cmakedefine HAVE_LIBUDEV_H 0
#cmakedefine HAVE_LIME
#cmakedefine HAVE_LIME_X3DH
#cmakedefine ENABLE_UPDATE_CHECK 1
This diff is collapsed.
......@@ -33,7 +33,9 @@ struct _LinphoneAccountCreatorService {
LinphoneAccountCreatorRequestFunc account_creator_service_destructor_cb; /**< Destructor */
LinphoneAccountCreatorRequestFunc create_account_request_cb; /**< Request to create account */
LinphoneAccountCreatorRequestFunc delete_account_request_cb; /**< Request to delete account */
LinphoneAccountCreatorRequestFunc is_account_exist_request_cb; /**< Request to know if account exist */
LinphoneAccountCreatorRequestFunc confirmation_key_request_cb; /**< Request to get the confirmation key */
LinphoneAccountCreatorRequestFunc activate_account_request_cb; /**< Request to activate account */
LinphoneAccountCreatorRequestFunc is_account_activated_request_cb; /**< Request to know if account is activated */
......@@ -54,10 +56,12 @@ struct _LinphoneAccountCreatorCbs {
void *user_data;
LinphoneAccountCreatorCbsStatusCb create_account_response_cb; /**< Response of create_account request */
LinphoneAccountCreatorCbsStatusCb delete_account_response_cb; /**< Response of delete_account request */
LinphoneAccountCreatorCbsStatusCb is_account_exist_response_cb; /**< Response of is_account_exist request */
LinphoneAccountCreatorCbsStatusCb activate_account_response_cb; /**< Response of activate_account request */
LinphoneAccountCreatorCbsStatusCb is_account_activated_response_cb; /**< Response of is_account_activated request */
LinphoneAccountCreatorCbsStatusCb confirmation_key_response_cb; /**< Response of get_confirmation_key request */
LinphoneAccountCreatorCbsStatusCb link_account_response_cb; /**< Response of link_account request */
LinphoneAccountCreatorCbsStatusCb activate_alias_response_cb; /**< Response of activation alias */
......@@ -77,7 +81,9 @@ struct _LinphoneAccountCreator {
/* AccountCreator */
LinphoneAccountCreatorService *service; /**< Account creator service */
LinphoneAccountCreatorCbs *cbs; /**< Account creator cbs */
LinphoneAccountCreatorCbs *cbs; /**< Account creator cbs, deprecated, use a list of Cbs instead */
bctbx_list_t *callbacks;
LinphoneAccountCreatorCbs *currentCbs;
LinphoneXmlRpcSession *xmlrpc_session; /**< XML-RPC session */
LinphoneProxyConfig *proxy_cfg; /**< Default proxy config */
......@@ -96,8 +102,11 @@ struct _LinphoneAccountCreator {
char *language; /**< User language */
char *activation_code; /**< Account validation code */
char *domain; /**< Domain */
char *algorithm; /**< Digest authentication algorithm */
LinphoneTransportType transport; /**< Transport used */
bool_t set_as_default; /**< Set proxy config as the default one */
/* Deprecated */
char *route;
};
......
This diff is collapsed.
......@@ -24,41 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#endif
void sal_enable_log(){
sal_set_log_level(ORTP_MESSAGE);
}
void sal_disable_log() {
sal_set_log_level(ORTP_ERROR);
}
void sal_set_log_level(OrtpLogLevel level) {
belle_sip_log_level belle_sip_level = BELLE_SIP_LOG_MESSAGE;
if ((level&ORTP_FATAL) != 0) {
belle_sip_level = BELLE_SIP_LOG_FATAL;
}
if ((level&ORTP_ERROR) != 0) {
belle_sip_level = BELLE_SIP_LOG_ERROR;
}
if ((level&ORTP_WARNING) != 0) {
belle_sip_level = BELLE_SIP_LOG_WARNING;
}
if ((level&ORTP_MESSAGE) != 0) {
belle_sip_level = BELLE_SIP_LOG_MESSAGE;
}
if (((level&ORTP_DEBUG) != 0) || ((level&ORTP_TRACE) != 0)) {
belle_sip_level = BELLE_SIP_LOG_DEBUG;
}
belle_sip_set_log_level(belle_sip_level);
}
static BctbxLogFunc _belle_sip_log_handler = bctbx_logv_out;
void sal_set_log_handler(BctbxLogFunc log_handler) {
_belle_sip_log_handler = log_handler;
belle_sip_set_log_handler(log_handler);
}
SalAuthInfo* sal_auth_info_create(belle_sip_auth_event_t* event) {
SalAuthInfo* auth_info = sal_auth_info_new();
auth_info->realm = ms_strdup(belle_sip_auth_event_get_realm(event));
......
......@@ -188,6 +188,11 @@ const char *linphone_call_log_get_call_id(const LinphoneCallLog *cl){
return cl->call_id;
}
void linphone_call_log_set_call_id(LinphoneCallLog *cl, const char *call_id) {
if (cl->call_id) bctbx_free(cl->call_id);
cl->call_id = call_id ? bctbx_strdup(call_id) : NULL;
}
LinphoneCallDir linphone_call_log_get_dir(const LinphoneCallLog *cl){
return cl->dir;
}
......
......@@ -57,14 +57,21 @@ using namespace LinphonePrivate;
static void register_failure(SalOp *op);
bool_t check_core_state(LinphoneCore *lc, SalOp *op) {
if (linphone_core_get_global_state(lc) != LinphoneGlobalOn) {
ms_warning("Linphone core global state is not on. Please check if the core is started.");
op->replyMessage(SalReasonServiceUnavailable);
op->release();
return FALSE;
}
return TRUE;
}
static void call_received(SalCallOp *h) {
LinphoneCore *lc = reinterpret_cast<LinphoneCore *>(h->getSal()->getUserPointer());
if (linphone_core_get_global_state(lc) != LinphoneGlobalOn) {
h->decline(SalReasonServiceUnavailable);
h->release();
if (!check_core_state(lc, h))
return;
}
/* Look if this INVITE is for a call that has already been notified but broken because of network failure */
if (L_GET_PRIVATE_FROM_C_OBJECT(lc)->inviteReplacesABrokenCall(h))
......@@ -79,10 +86,13 @@ static void call_received(SalCallOp *h) {
if (pAssertedIdAddr) {
ms_message("Using P-Asserted-Identity [%s] instead of from [%s] for op [%p]", pAssertedId, h->getFrom().c_str(), h);
fromAddr = pAssertedIdAddr;
} else
} else{
ms_warning("Unsupported P-Asserted-Identity header for op [%p] ", h);
} else
}
} else{
ms_warning("No P-Asserted-Identity header found so cannot use it for op [%p] instead of from", h);
}
}
if (!fromAddr)
......@@ -93,8 +103,8 @@ static void call_received(SalCallOp *h) {
linphone_address_unref(toAddr);
linphone_address_unref(fromAddr);
if (sal_address_has_param(h->getRemoteContactAddress(), "text")) {
const char *oneToOneChatRoomStr = sal_custom_header_find(h->getRecvCustomHeaders(), "One-To-One-Chat-Room");
if (oneToOneChatRoomStr && (strcmp(oneToOneChatRoomStr, "true") == 0)) {
string oneToOneChatRoom = L_C_TO_STRING(sal_custom_header_find(h->getRecvCustomHeaders(), "One-To-One-Chat-Room"));
if (oneToOneChatRoom == "true") {
bool_t oneToOneChatRoomEnabled = linphone_config_get_bool(linphone_core_get_config(lc), "misc", "enable_one_to_one_chat_room", TRUE);
if (!oneToOneChatRoomEnabled) {
h->decline(SalReasonNotAcceptable);
......@@ -147,10 +157,15 @@ static void call_received(SalCallOp *h) {
chatRoom->deleteFromDb();
chatRoom.reset();
}
if (!chatRoom)
if (!chatRoom) {
string endToEndEncrypted = L_C_TO_STRING(sal_custom_header_find(h->getRecvCustomHeaders(), "End-To-End-Encrypted"));
chatRoom = L_GET_PRIVATE_FROM_C_OBJECT(lc)->createClientGroupChatRoom(
h->getSubject(), h->getRemoteContact(), h->getRemoteBody(), false
h->getSubject(),
ConferenceId(IdentityAddress(h->getRemoteContact()), IdentityAddress(h->getTo())),
h->getRemoteBody(),
endToEndEncrypted == "true"
);
}
const char *oneToOneChatRoomStr = sal_custom_header_find(h->getRecvCustomHeaders(), "One-To-One-Chat-Room");
if (oneToOneChatRoomStr && (strcmp(oneToOneChatRoomStr, "true") == 0))
......@@ -432,15 +447,13 @@ static void call_refer_received(SalOp *op, const SalAddress *referTo) {
static void message_received(SalOp *op, const SalMessage *msg){
LinphoneCore *lc=(LinphoneCore *)op->getSal()->getUserPointer();
if (linphone_core_get_global_state(lc) != LinphoneGlobalOn) {
static_cast<SalMessageOp *>(op)->reply(SalReasonServiceUnavailable);
if (!check_core_state(lc, op))
return;
}
LinphoneCall *call=(LinphoneCall*)op->getUserPointer();
LinphoneReason reason = lc->chat_deny_code;
if (reason == LinphoneReasonNone) {
linphone_core_message_received(lc, op, msg);
reason = linphone_core_message_received(lc, op, msg);
}
auto messageOp = dynamic_cast<SalMessageOpInterface *>(op);
messageOp->reply(linphone_reason_to_sal(reason));
......@@ -469,10 +482,8 @@ static void notify_presence(SalOp *op, SalSubscribeStatus ss, SalPresenceModel *
static void subscribe_presence_received(SalPresenceOp *op, const char *from){
LinphoneCore *lc=(LinphoneCore *)op->getSal()->getUserPointer();
if (linphone_core_get_global_state(lc) != LinphoneGlobalOn) {
op->decline(SalReasonServiceUnavailable);
if (!check_core_state(lc, op))
return;
}
linphone_subscription_new(lc,op,from);
}
......@@ -530,31 +541,31 @@ static bool_t fill_auth_info(LinphoneCore *lc, SalAuthInfo* sai) {
* Compare algorithm of server(sai) with algorithm of client(ai), if they are not correspondant,
* exit. The default algorithm is MD5 if it's NULL.
*/
if (sai->algorithm && ai->algorithm) {
if (strcasecmp(ai->algorithm, sai->algorithm))
return TRUE;
if (sai->algorithm && linphone_auth_info_get_algorithm(ai)) {
if (strcasecmp(linphone_auth_info_get_algorithm(ai), sai->algorithm))
return TRUE;
} else if (
(ai->algorithm && strcasecmp(ai->algorithm, "MD5")) ||
(linphone_auth_info_get_algorithm(ai) && strcasecmp(linphone_auth_info_get_algorithm(ai), "MD5")) ||
(sai->algorithm && strcasecmp(sai->algorithm, "MD5"))
)
return TRUE;
sai->userid = ms_strdup(ai->userid ? ai->userid : ai->username);
sai->password = ai->passwd?ms_strdup(ai->passwd) : NULL;
sai->ha1 = ai->ha1 ? ms_strdup(ai->ha1) : NULL;
sai->userid = ms_strdup(linphone_auth_info_get_userid(ai) ? linphone_auth_info_get_userid(ai) : linphone_auth_info_get_username(ai));
sai->password = linphone_auth_info_get_passwd(ai)?ms_strdup(linphone_auth_info_get_passwd(ai)) : NULL;
sai->ha1 = linphone_auth_info_get_ha1(ai) ? ms_strdup(linphone_auth_info_get_ha1(ai)) : NULL;
} else if (sai->mode == SalAuthModeTls) {
if (ai->tls_cert && ai->tls_key) {
sal_certificates_chain_parse(sai, ai->tls_cert, SAL_CERTIFICATE_RAW_FORMAT_PEM);
sal_signing_key_parse(sai, ai->tls_key, "");
} else if (ai->tls_cert_path && ai->tls_key_path) {
sal_certificates_chain_parse_file(sai, ai->tls_cert_path, SAL_CERTIFICATE_RAW_FORMAT_PEM);
sal_signing_key_parse_file(sai, ai->tls_key_path, "");
if (linphone_auth_info_get_tls_cert(ai) && linphone_auth_info_get_tls_key(ai)) {
sal_certificates_chain_parse(sai, linphone_auth_info_get_tls_cert(ai), SAL_CERTIFICATE_RAW_FORMAT_PEM);
sal_signing_key_parse(sai, linphone_auth_info_get_tls_key(ai), "");
} else if (linphone_auth_info_get_tls_cert_path(ai) && linphone_auth_info_get_tls_key_path(ai)) {
sal_certificates_chain_parse_file(sai, linphone_auth_info_get_tls_cert_path(ai), SAL_CERTIFICATE_RAW_FORMAT_PEM);
sal_signing_key_parse_file(sai, linphone_auth_info_get_tls_key_path(ai), "");
} else {
fill_auth_info_with_client_certificate(lc, sai);
}
}
if (sai->realm && !ai->realm){
if (sai->realm && !linphone_auth_info_get_realm(ai)){
/*if realm was not known, then set it so that ha1 may eventually be calculated and clear text password dropped*/
linphone_auth_info_set_realm(ai, sai->realm);
linphone_core_write_auth_info(lc, ai);
......@@ -690,10 +701,8 @@ static void subscribe_received(SalSubscribeOp *op, const char *eventname, const
LinphoneEvent *lev=(LinphoneEvent*)op->getUserPointer();
LinphoneCore *lc=(LinphoneCore *)op->getSal()->getUserPointer();
if (linphone_core_get_global_state(lc) != LinphoneGlobalOn) {
op->decline(SalReasonServiceUnavailable);
if (!check_core_state(lc, op))
return;
}
if (lev==NULL) {
lev=linphone_event_new_with_op(lc,op,LinphoneSubscriptionIncoming,eventname);
......@@ -823,7 +832,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
Address fromAddr(op->getFrom());
shared_ptr<Participant> participant = chatRoom->findParticipant(fromAddr);
if (!participant || !participant->isAdmin()) {
static_cast<SalReferOp *>(op)->reply(SalReasonDeclined);
static_cast<SalReferOp *>(op)->reply(SalReasonForbidden);
return;
}
if (addr.hasParam("admin")) {
......@@ -835,28 +844,15 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
return;
}
} else {
participant = L_GET_PRIVATE(static_pointer_cast<ServerGroupChatRoom>(chatRoom))->findFilteredParticipant(addr);
participant = L_GET_PRIVATE(static_pointer_cast<ServerGroupChatRoom>(chatRoom))->findAuthorizedParticipant(addr);
if (!participant) {
list<IdentityAddress> identAddresses;
identAddresses.push_back(addr);
L_GET_PRIVATE(static_pointer_cast<ServerGroupChatRoom>(chatRoom))->checkCompatibleParticipants(
IdentityAddress(op->getRemoteContact()),
identAddresses
);
static_cast<SalReferOp *>(op)->reply(SalReasonNone);
bool ret = static_pointer_cast<ServerGroupChatRoom>(chatRoom)->addParticipant(
IdentityAddress(addr), nullptr, false);
static_cast<SalReferOp *>(op)->reply(ret ? SalReasonNone : SalReasonNotAcceptable);
return;
}
}
}
} else {
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(
ConferenceId(addr, IdentityAddress(op->getTo()))
);
if (!chatRoom)
chatRoom = L_GET_PRIVATE_FROM_C_OBJECT(lc)->createClientGroupChatRoom("", addr.asString(), Content(), false);
chatRoom->join();
static_cast<SalReferOp *>(op)->reply(SalReasonNone);
return;
}
}
}
......
......@@ -19,6 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "linphone/core.h"
#include "private.h"
#include "linphone/api/c-auth-info.h"
LinphoneCardDavContext* linphone_carddav_context_new(LinphoneFriendList *lfl) {
LinphoneCardDavContext *carddav_context = NULL;
......@@ -471,9 +475,9 @@ static void process_auth_requested_from_carddav_request(void *data, belle_sip_au
const char *domain = belle_generic_uri_get_host(uri);
if (cdc->auth_info) {
belle_sip_auth_event_set_username(event, cdc->auth_info->username);
belle_sip_auth_event_set_passwd(event, cdc->auth_info->passwd);
belle_sip_auth_event_set_ha1(event, cdc->auth_info->ha1);
belle_sip_auth_event_set_username(event, linphone_auth_info_get_username(cdc->auth_info));
belle_sip_auth_event_set_passwd(event, linphone_auth_info_get_passwd(cdc->auth_info));
belle_sip_auth_event_set_ha1(event, linphone_auth_info_get_ha1(cdc->auth_info));
} else {
LinphoneCore *lc = cdc->friend_list->lc;
const bctbx_list_t *auth_infos = linphone_core_get_auth_info_list(lc);
......@@ -481,11 +485,11 @@ static void process_auth_requested_from_carddav_request(void *data, belle_sip_au
ms_debug("Looking for auth info for domain %s and realm %s", domain, realm);
while (auth_infos) {
LinphoneAuthInfo *auth_info = (LinphoneAuthInfo *)auth_infos->data;
if (auth_info->domain && strcmp(domain, auth_info->domain) == 0) {
if (!auth_info->realm || strcmp(realm, auth_info->realm) == 0) {
belle_sip_auth_event_set_username(event, auth_info->username);
belle_sip_auth_event_set_passwd(event, auth_info->passwd);
belle_sip_auth_event_set_ha1(event, auth_info->ha1);
if (linphone_auth_info_get_domain(auth_info) && strcmp(domain, linphone_auth_info_get_domain(auth_info)) == 0) {
if (!linphone_auth_info_get_realm(auth_info) || strcmp(realm, linphone_auth_info_get_realm(auth_info)) == 0) {
belle_sip_auth_event_set_username(event, linphone_auth_info_get_username(auth_info));
belle_sip_auth_event_set_passwd(event, linphone_auth_info_get_passwd(auth_info));
belle_sip_auth_event_set_ha1(event, linphone_auth_info_get_ha1(auth_info));
cdc->auth_info = linphone_auth_info_clone(auth_info);
break;
}
......
......@@ -37,6 +37,7 @@
#include "c-wrapper/c-wrapper.h"
#include "call/call.h"
#include "chat/chat-room/chat-room-params.h"
#include "chat/chat-room/basic-chat-room.h"
#include "chat/chat-room/client-group-chat-room.h"
#include "chat/chat-room/client-group-to-basic-chat-room.h"
......@@ -44,6 +45,7 @@
#include "chat/chat-room/real-time-text-chat-room.h"
#include "content/content-type.h"
#include "core/core-p.h"
#include "linphone/api/c-chat-room-params.h"
using namespace std;
......@@ -80,8 +82,8 @@ LinphoneChatRoom *_linphone_core_create_chat_room_from_call(LinphoneCall *call){
return cr;
}
LinphoneChatRoom *linphone_core_get_chat_room (LinphoneCore *lc, const LinphoneAddress *addr) {
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getOrCreateBasicChatRoom(*L_GET_CPP_PTR_FROM_C_OBJECT(addr)));
LinphoneChatRoom *linphone_core_get_chat_room (LinphoneCore *lc, const LinphoneAddress *peerAddr) {
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getOrCreateBasicChatRoom(*L_GET_CPP_PTR_FROM_C_OBJECT(peerAddr)));
}
LinphoneChatRoom *linphone_core_get_chat_room_2 (
......@@ -95,8 +97,46 @@ LinphoneChatRoom *linphone_core_get_chat_room_2 (
)));
}
LinphoneChatRoom *linphone_core_create_client_group_chat_room (LinphoneCore *lc, const char *subject, bool_t fallback) {
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->createClientGroupChatRoom(L_C_TO_STRING(subject), !!fallback));
//Deprecated
LinphoneChatRoom *linphone_core_create_client_group_chat_room(LinphoneCore *lc, const char *subject, bool_t fallback) {
return linphone_core_create_client_group_chat_room_2(lc, subject, fallback, FALSE);
}
//Deprecated
LinphoneChatRoom *linphone_core_create_client_group_chat_room_2(LinphoneCore *lc, const char *subject, bool_t fallback, bool_t encrypted) {
return L_GET_C_BACK_PTR(L_GET_PRIVATE_FROM_C_OBJECT(lc)->createClientGroupChatRoom(L_C_TO_STRING(subject), !!fallback, !!encrypted));
}
LinphoneChatRoom *linphone_core_create_chat_room(LinphoneCore *lc, const LinphoneChatRoomParams *params, const LinphoneAddress *localAddr, const char *subject, const bctbx_list_t *participants) {
return L_GET_C_BACK_PTR(L_GET_PRIVATE_FROM_C_OBJECT(lc)->createChatRoom(LinphonePrivate::ChatRoomParams::toCpp(params)->clone()->toSharedPtr(), LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(localAddr)), L_C_TO_STRING(subject), L_GET_CPP_LIST_FROM_C_LIST_2(participants, LinphoneAddress *, LinphonePrivate::IdentityAddress, [] (LinphoneAddress *addr) {
return LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(addr));
})));
}
LinphoneChatRoom *linphone_core_create_chat_room_2(LinphoneCore *lc, const LinphoneChatRoomParams *params, const char *subject, const bctbx_list_t *participants) {
return L_GET_C_BACK_PTR(L_GET_PRIVATE_FROM_C_OBJECT(lc)->createChatRoom(LinphonePrivate::ChatRoomParams::toCpp(params)->clone()->toSharedPtr(), L_C_TO_STRING(subject), L_GET_CPP_LIST_FROM_C_LIST_2(participants, LinphoneAddress *, LinphonePrivate::IdentityAddress, [] (LinphoneAddress *addr) {
return LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(addr));
})));
}
LinphoneChatRoom *linphone_core_create_chat_room_3(LinphoneCore *lc, const char *subject, const bctbx_list_t *participants) {
return L_GET_C_BACK_PTR(L_GET_PRIVATE_FROM_C_OBJECT(lc)->createChatRoom(L_C_TO_STRING(subject), L_GET_CPP_LIST_FROM_C_LIST_2(participants, LinphoneAddress *, LinphonePrivate::IdentityAddress, [] (LinphoneAddress *addr) {
return LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(addr));
})));
}
LinphoneChatRoom *linphone_core_create_chat_room_4(LinphoneCore *lc, const LinphoneChatRoomParams *params, const LinphoneAddress *localAddr, const LinphoneAddress *participant) {
return L_GET_C_BACK_PTR(L_GET_PRIVATE_FROM_C_OBJECT(lc)->createChatRoom(LinphonePrivate::ChatRoomParams::toCpp(params)->clone()->toSharedPtr(), LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(localAddr)), LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(participant))));
}
LinphoneChatRoom *linphone_core_create_chat_room_5(LinphoneCore *lc, const LinphoneAddress *participant) {
return L_GET_C_BACK_PTR(L_GET_PRIVATE_FROM_C_OBJECT(lc)->createChatRoom(LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(participant))));
}
LinphoneChatRoomParams *linphone_core_create_default_chat_room_params(LinphoneCore *lc) {
auto params = LinphonePrivate::ChatRoomParams::getDefaults(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getSharedFromThis());
params->ref();
return params->toC();
}
LinphoneChatRoom *_linphone_core_create_server_group_chat_room (LinphoneCore *lc, LinphonePrivate::SalCallOp *op) {
......@@ -129,14 +169,31 @@ LinphoneChatRoom *linphone_core_find_one_to_one_chat_room (
) {
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findOneToOneChatRoom(
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(local_addr)),
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(participant_addr))
));
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(participant_addr)),
false, false)
);
}
LinphoneChatRoom *linphone_core_find_one_to_one_chat_room_2 (
const LinphoneCore *lc,
const LinphoneAddress *local_addr,
const LinphoneAddress *participant_addr,
bool_t encrypted
) {
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findOneToOneChatRoom(
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(local_addr)),
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(participant_addr)),
false, !!encrypted)
);
}
int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op, const SalMessage *sal_msg) {
LinphoneReason linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op, const SalMessage *sal_msg) {
LinphoneReason reason = LinphoneReasonNotAcceptable;
std::string peerAddress;
std::string localAddress;
const char *session_mode = sal_custom_header_find(op->getRecvCustomHeaders(), "Session-mode");
if (linphone_core_conference_server_enabled(lc)) {
localAddress = peerAddress = op->getTo();
} else {
......@@ -152,9 +209,18 @@ int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op,
if (chatRoom)
reason = L_GET_PRIVATE(chatRoom)->onSipMessageReceived(op, sal_msg);
else if (!linphone_core_conference_server_enabled(lc)) {
chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getOrCreateBasicChatRoom(conferenceId);
if (chatRoom)
reason = L_GET_PRIVATE(chatRoom)->onSipMessageReceived(op, sal_msg);
/* Client mode but check that it is really for basic chatroom before creating it.*/
if (session_mode && strcasecmp(session_mode, "true") == 0) {
lError() << "Message is received in the context of a client chatroom for which we have no context.";
reason = LinphoneReasonNotAcceptable;
} else {
chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getOrCreateBasicChatRoom(conferenceId);
if (chatRoom)
reason = L_GET_PRIVATE(chatRoom)->onSipMessageReceived(op, sal_msg);
}
} else {
/* Server mode but chatroom not found. */
reason = LinphoneReasonNotFound;
}
return reason;
}
......
......@@ -39,6 +39,7 @@ static void error_info_clone(LinphoneErrorInfo *ei, const LinphoneErrorInfo *oth
ei->warnings = bctbx_strdup(other->warnings);
ei->full_string = bctbx_strdup(other->full_string);
ei->protocol_code = other->protocol_code;
ei->retry_after = other->retry_after;
}
BELLE_SIP_INSTANCIATE_VPTR(LinphoneErrorInfo, belle_sip_object_t,
......@@ -137,6 +138,23 @@ static const error_code_reason_map_t error_code_reason_map[] = {
{ 603, LinphoneReasonDeclined }
};
static const error_code_reason_map_t retry_after_code_reason_map[] = {
{ 404, LinphoneReasonNotFound },
{ 480, LinphoneReasonTemporarilyUnavailable },
{ 486, LinphoneReasonBusy },
{ 503, LinphoneReasonIOError },
{ 600, LinphoneReasonDoNotDisturb },
{ 603, LinphoneReasonDeclined }
};
bool_t linphone_error_code_is_retry_after(int err) {
size_t i;
for (i = 0; i < (sizeof(retry_after_code_reason_map) / sizeof(retry_after_code_reason_map[0])); i++) {
if (retry_after_code_reason_map[i].error_code == err) return true;
}
return false;
}
LinphoneReason linphone_error_code_to_reason(int err) {
size_t i;
for (i = 0; i < (sizeof(error_code_reason_map) / sizeof(error_code_reason_map[0])); i++) {
......@@ -160,6 +178,7 @@ static void linphone_error_info_reset(LinphoneErrorInfo *ei){
STRING_RESET(ei->full_string);
STRING_RESET(ei->warnings);
ei->protocol_code = 0;
ei->retry_after = 0;
if (ei->sub_ei) {
linphone_error_info_unref(ei->sub_ei);
ei->sub_ei = NULL;
......@@ -172,6 +191,7 @@ void linphone_error_info_from_sal(LinphoneErrorInfo *ei, const SalErrorInfo *sei
ei->full_string = bctbx_strdup(sei->full_string);
ei->warnings = bctbx_strdup(sei->warnings);
ei->protocol_code = sei->protocol_code;
ei->retry_after = sei->retry_after;
ei->protocol = bctbx_strdup(sei->protocol);
}
......@@ -220,6 +240,7 @@ void linphone_error_info_fields_to_sal(const LinphoneErrorInfo* ei, SalErrorInfo
sei->full_string = bctbx_strdup(ei->full_string);
sei->warnings = bctbx_strdup(ei->warnings);
sei->protocol_code = ei->protocol_code;
sei->retry_after = ei->retry_after;
sei->protocol = bctbx_strdup(ei->protocol);
}
......@@ -242,6 +263,9 @@ void linphone_error_info_set(LinphoneErrorInfo *ei, const char *protocol, Linpho
ei->warnings = bctbx_strdup(warning);
}
int linphone_error_info_get_retry_after(const LinphoneErrorInfo *ei){
return ei->retry_after;
}
LinphoneReason linphone_error_info_get_reason(const LinphoneErrorInfo *ei) {
return ei->reason;
......@@ -272,6 +296,10 @@ LinphoneErrorInfo * linphone_error_info_get_sub_error_info(const LinphoneErrorIn
return ei->sub_ei;
}
void linphone_error_info_set_retry_after(LinphoneErrorInfo *ei, int retry_after){
ei->retry_after = retry_after;
}
void linphone_error_info_set_reason(LinphoneErrorInfo *ei, LinphoneReason reason){
ei->reason = reason;
}
......
......@@ -86,7 +86,7 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneEventCbs, belle_sip_object_t,
FALSE
);
static LinphoneEventCbs *linphone_event_cbs_new(void) {
LinphoneEventCbs *linphone_event_cbs_new(void) {
return belle_sip_object_new(LinphoneEventCbs);
}
......@@ -227,6 +227,13 @@ LinphoneEvent *linphone_core_create_subscribe(LinphoneCore *lc, const LinphoneAd
return lev;
}
LinphoneEvent *linphone_core_create_subscribe_2(LinphoneCore *lc, const LinphoneAddress *resource, LinphoneProxyConfig *cfg, const char *event, int expires){
LinphoneEvent *lev=linphone_event_new(lc, LinphoneSubscriptionOutgoing, event, expires);
linphone_configure_op_with_proxy(lc,lev->op,resource,NULL,TRUE,cfg);
lev->op->setManualRefresherMode(!lp_config_get_int(lc->config,"sip","refresh_generic_subscribe",1));
return lev;
}
LinphoneEvent *linphone_core_create_notify(LinphoneCore *lc, const LinphoneAddress *resource, const char *event){
LinphoneEvent *lev=linphone_event_new(lc, LinphoneSubscriptionIncoming, event, -1);
linphone_configure_op(lc,lev->op,resource,NULL,TRUE);
......@@ -331,36 +338,26 @@ LinphoneStatus linphone_event_notify(LinphoneEvent *lev, const LinphoneContent *
return subscribeOp->notify(body_handler);
}
static LinphoneEvent *_linphone_core_create_publish(LinphoneCore *core, LinphoneProxyConfig *cfg, const LinphoneAddress *resource, const char *event, int expires){
LinphoneEvent *_linphone_core_create_publish(LinphoneCore *core, LinphoneProxyConfig *cfg, const LinphoneAddress *resource, const char *event, int expires){
LinphoneCore *lc = core;
LinphoneEvent *lev;
if (!lc && cfg) {
if (cfg->lc)
lc = cfg->lc;
else {
ms_error("Cannot create publish from proxy config [%p] not attached to any core",cfg);
return NULL;
}
}
if (!resource && cfg)
resource = linphone_proxy_config_get_identity_address(cfg);
lev = linphone_event_new_with_op(lc, new SalPublishOp(lc->sal), LinphoneSubscriptionInvalidDir, event);
lev->expires = expires;
if (!cfg) cfg = linphone_core_lookup_known_proxy(lc, resource);
linphone_configure_op_with_proxy(lc,lev->op,resource,NULL, !!lp_config_get_int(lc->config,"sip","publish_msg_with_contact",0),cfg);
lev->op->setManualRefresherMode(!lp_config_get_int(lc->config,"sip","refresh_generic_publish",1));
return lev;
}
LinphoneEvent *linphone_core_create_publish(LinphoneCore *lc, const LinphoneAddress *resource, const char *event, int expires){
return _linphone_core_create_publish(lc, NULL, resource, event, expires);
}
LinphoneEvent *linphone_proxy_config_create_publish(LinphoneProxyConfig *cfg, const char *event, int expires) {
return _linphone_core_create_publish(NULL, cfg,NULL, event, expires);
}
LinphoneEvent *linphone_core_create_one_shot_publish(LinphoneCore *lc, const LinphoneAddress *resource, const char *event){
LinphoneEvent *lev = linphone_core_create_publish(lc, resource, event, -1);
lev->oneshot = TRUE;
......@@ -490,6 +487,8 @@ static void linphone_event_destroy(LinphoneEvent *lev){
if (lev->from_address) linphone_address_unref(lev->from_address);
if (lev->remote_contact_address) linphone_address_unref(lev->remote_contact_address);
linphone_event_cbs_unref(lev->callbacks);
bctbx_list_free_with_data(lev->callbacks_list, (bctbx_list_free_func)linphone_event_cbs_unref);
lev->callbacks_list = nullptr;
ms_free(lev->name);
}
......@@ -567,16 +566,48 @@ static belle_sip_error_code _linphone_event_marshall(belle_sip_object_t *obj, ch
return err;
}
void _linphone_event_notify_notify_response(const LinphoneEvent *lev) {
void _linphone_event_notify_notify_response(LinphoneEvent *lev) {
LinphoneEventCbsNotifyResponseCb cb = linphone_event_cbs_get_notify_response(lev->callbacks);
if (cb)
cb(lev);
bctbx_list_t *callbacksCopy = bctbx_list_copy(linphone_event_get_callbacks_list(lev));
for (bctbx_list_t *it = callbacksCopy; it; it = bctbx_list_next(it)) {
linphone_event_set_current_callbacks(lev, reinterpret_cast<LinphoneEventCbs *>(bctbx_list_get_data(it)));
LinphoneEventCbsNotifyResponseCb callback = linphone_event_cbs_get_notify_response(linphone_event_get_current_callbacks(lev));
if (callback) {
callback(lev);
}
}
linphone_event_set_current_callbacks(lev, nullptr);
bctbx_list_free(callbacksCopy);
}
LinphoneEventCbs *linphone_event_get_callbacks(const LinphoneEvent *ev) {
return ev->callbacks;
}
void linphone_event_add_callbacks(LinphoneEvent *ev, LinphoneEventCbs *cbs) {
ev->callbacks_list = bctbx_list_append(ev->callbacks_list, linphone_event_cbs_ref(cbs));
}
void linphone_event_remove_callbacks(LinphoneEvent *ev, LinphoneEventCbs *cbs) {
ev->callbacks_list = bctbx_list_remove(ev->callbacks_list, cbs);
linphone_event_cbs_unref(cbs);
}
LinphoneEventCbs *linphone_event_get_current_callbacks(const LinphoneEvent *ev) {
return ev->currentCbs;
}
void linphone_event_set_current_callbacks(LinphoneEvent *ev, LinphoneEventCbs *cbs) {
ev->currentCbs = cbs;
}
const bctbx_list_t *linphone_event_get_callbacks_list(const LinphoneEvent *ev) {
return ev->callbacks_list;
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneEvent);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneEvent, belle_sip_object_t,
......
......@@ -234,10 +234,22 @@ LinphoneAddress *linphone_factory_create_address(const LinphoneFactory *factory,
return linphone_address_new(addr);
}
LinphoneParticipantDeviceIdentity *linphone_factory_create_participant_device_identity(
const LinphoneFactory *factory,
const LinphoneAddress *address,
const char *name
) {
return linphone_participant_device_identity_new(address, name);
}
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) {
return linphone_auth_info_new(username, userid, passwd, ha1, realm, domain);
}
LinphoneAuthInfo *linphone_factory_create_auth_info_2(const LinphoneFactory *factory, const char *username, const char *userid, const char *passwd, const char *ha1, const char *realm, const char *domain, const char *algorithm) {
return linphone_auth_info_new_for_algorithm(username, userid, passwd, ha1, realm, domain, algorithm);
}
LinphoneCallCbs * linphone_factory_create_call_cbs(const LinphoneFactory *factory) {
return _linphone_call_cbs_new();
}
......@@ -246,6 +258,10 @@ LinphoneChatRoomCbs * linphone_factory_create_chat_room_cbs(const LinphoneFactor
return _linphone_chat_room_cbs_new();
}
LinphoneChatMessageCbs * linphone_factory_create_chat_message_cbs(const LinphoneFactory *factory) {
return linphone_chat_message_cbs_new();
}
LinphoneVcard *linphone_factory_create_vcard(LinphoneFactory *factory) {
return _linphone_vcard_new();
}
......@@ -443,3 +459,27 @@ void linphone_factory_enable_log_collection(LinphoneFactory *factory, LinphoneLo
LinphoneTunnelConfig *linphone_factory_create_tunnel_config(LinphoneFactory *factory) {
return linphone_tunnel_config_new();
}
LinphoneLoggingServiceCbs *linphone_factory_create_logging_service_cbs(LinphoneFactory *factory) {
return linphone_logging_service_cbs_new();
}
LinphonePlayerCbs *linphone_factory_create_player_cbs(LinphoneFactory *factory) {
return linphone_player_cbs_new();
}
LinphoneEventCbs *linphone_factory_create_event_cbs(LinphoneFactory *factory) {
return linphone_event_cbs_new();
}
LinphoneFriendListCbs *linphone_factory_create_friend_list_cbs(LinphoneFactory *factory) {
return linphone_friend_list_cbs_new();
}
LinphoneAccountCreatorCbs *linphone_factory_create_account_creator_cbs(LinphoneFactory *factory) {
return linphone_account_creator_cbs_new();
}
LinphoneXmlRpcRequestCbs *linphone_factory_create_xml_rpc_request_cbs(LinphoneFactory *factory) {
return linphone_xml_rpc_request_cbs_new();
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -20,7 +20,7 @@
#
################################################################################
if(ENABLE_DOC OR ENABLE_CXX_WRAPPER OR ENABLE_CSHARP_WRAPPER OR ENABLE_JAVA_WRAPPER)
if(ENABLE_DOC OR ENABLE_CXX_WRAPPER OR ENABLE_CSHARP_WRAPPER OR ENABLE_JAVA_WRAPPER OR ENABLE_SWIFT_WRAPPER)
find_package(Doxygen REQUIRED)
if(DOXYGEN_FOUND)
set(top_srcdir "${PROJECT_SOURCE_DIR}")
......
......@@ -31,7 +31,7 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx_csharp.csharp', 'javasphinx']
extensions = ['sphinx_csharp.csharp', 'javasphinx']#, 'swift_domain']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
......
......@@ -171,7 +171,8 @@ class LangInfo:
'C' : 'C',
'Cpp' : 'C++',
'Java' : 'Java',
'CSharp': 'C#'
'CSharp': 'C#',
'Swift' : 'Swift'
}
......@@ -237,7 +238,10 @@ class SphinxPart(object):
class EnumPart(SphinxPart):
def __init__(self, enum, lang, langs, namespace=None):
SphinxPart.__init__(self, lang, langs)
self.name = enum.name.translate(self.lang.nameTranslator)
if lang.langCode == 'Swift' and type(enum.parent) is abstractapi.Class :
self.name = enum.name.translate(self.lang.nameTranslator,recursive=True, topAncestor=namespace)
else:
self.name = enum.name.translate(self.lang.nameTranslator)
self.fullName = enum.name.translate(self.lang.nameTranslator, recursive=True)
self.briefDesc = enum.briefDescription.translate(self.docTranslator)
self.enumerators = [self._translate_enumerator(enumerator) for enumerator in enum.enumerators]
......@@ -315,7 +319,7 @@ class EnumPage(SphinxPage):
filename = SphinxPage._classname_to_filename(enum.name)
SphinxPage.__init__(self, lang, langs, filename)
namespace = enum.find_first_ancestor_by_type(abstractapi.Namespace)
self.namespace = namespace.name.translate(lang.nameTranslator) if lang.langCode != 'C' else None
self.namespace = namespace.name.translate(lang.nameTranslator) if lang.langCode not in ['C', 'Swift'] else None
self.enum = EnumPart(enum, lang, langs, namespace=namespace)
......@@ -368,15 +372,19 @@ class ClassPage(SphinxPage):
propertyAttr['ref_label'] += (property_.getter.name.to_snake_case(fullName=True) if property_.getter is not None else property_.setter.name.to_snake_case(fullName=True))
translatedProperties.append(propertyAttr)
return translatedProperties
def _translate_methods(self, methods):
translatedMethods = []
for method in methods:
translatedMethods.append(self._translate_method(method))
return translatedMethods
def _translate_method(self, method):
namespace = method.find_first_ancestor_by_type(abstractapi.Class,abstractapi.Interface)
if self.lang.langCode == 'Swift':
namespace = method.find_first_ancestor_by_type(abstractapi.Namespace)
else:
namespace = method.find_first_ancestor_by_type(abstractapi.Class,abstractapi.Interface)
methAttr = {
'prototype' : method.translate_as_prototype(self.lang.langTranslator, namespace=namespace),
'briefDoc' : method.briefDescription.translate(self.docTranslator),
......@@ -385,7 +393,7 @@ class ClassPage(SphinxPage):
}
reference = metadoc.FunctionReference(None)
reference.relatedObject = method
methAttr['link'] = reference.translate(self.lang.docTranslator, namespace=method.find_first_ancestor_by_type(abstractapi.Class, abstractapi.Interface))
methAttr['link'] = reference.translate(self.lang.docTranslator, namespace=namespace)
return methAttr
@property
......@@ -449,9 +457,10 @@ class DocGenerator:
LangInfo('C'),
LangInfo('Cpp'),
LangInfo('Java'),
LangInfo('CSharp')
LangInfo('CSharp')#,
#LangInfo('Swift')
]
def generate(self, outputdir):
for lang in self.languages:
directory = os.path.join(args.outputdir, lang.directory)
......