diff --git a/cmake/LinphoneConfig.cmake.in b/cmake/LinphoneConfig.cmake.in index 264b8331a..b15649794 100644 --- a/cmake/LinphoneConfig.cmake.in +++ b/cmake/LinphoneConfig.cmake.in @@ -45,7 +45,17 @@ if(@ENABLE_SHARED@) set(LINPHONE_LIBRARIES ${LINPHONE_TARGETNAME}) else() set(LINPHONE_TARGETNAME linphone-static) - bc_set_libraries_from_static_target(LINPHONE_LIBRARIES ${LINPHONE_TARGETNAME}) + if(TARGET ${LINPHONE_TARGETNAME}) + if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) + set(LINPHONE_LIBRARIES ${LINPHONE_TARGETNAME}) + else() + get_target_property(LINPHONE_LIBRARIES ${LINPHONE_TARGETNAME} LOCATION) + endif() + get_target_property(LINPHONE_LINK_LIBRARIES ${LINPHONE_TARGETNAME} INTERFACE_LINK_LIBRARIES) + if(LINPHONE_LINK_LIBRARIES) + list(APPEND LINPHONE_LIBRARIES ${LINPHONE_LINK_LIBRARIES}) + endif() + endif() endif() get_target_property(LINPHONE_INCLUDE_DIRS ${LINPHONE_TARGETNAME} INTERFACE_INCLUDE_DIRECTORIES) if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) diff --git a/coreapi/account_creator.c b/coreapi/account_creator.c index 7c048b17b..4be0e83d6 100644 --- a/coreapi/account_creator.c +++ b/coreapi/account_creator.c @@ -77,14 +77,16 @@ static char* _get_identity(const LinphoneAccountCreator *creator) { char *identity = NULL; if ((creator->username || creator->phone_number)) { //we must escape username - LinphoneProxyConfig* proxy = creator->proxy_cfg; + LinphoneProxyConfig* proxy = linphone_core_create_proxy_config(creator->core); LinphoneAddress* addr; addr = linphone_proxy_config_normalize_sip_uri(proxy, creator->username ? creator->username : creator->phone_number); - if (addr == NULL) return NULL; + if (addr == NULL) goto end; identity = linphone_address_as_string(addr); linphone_address_unref(addr); + end: + linphone_proxy_config_destroy(proxy); } return identity; } diff --git a/coreapi/friend.c b/coreapi/friend.c index c103f4035..b83764f93 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -1715,6 +1715,10 @@ void linphone_core_set_friends_database_path(LinphoneCore *lc, const char *path) } } +const char* linphone_core_get_friends_database_path(LinphoneCore *lc) { + return lc->friends_db_file; +} + void linphone_core_migrate_friends_from_rc_to_db(LinphoneCore *lc) { LpConfig *lpc = NULL; LinphoneFriend *lf = NULL; diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index 5055b0ff5..8417541fc 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -773,10 +773,12 @@ LinphoneFriend * linphone_friend_list_find_friend_by_uri(const LinphoneFriendLis } LinphoneFriend * linphone_friend_list_find_friend_by_ref_key(const LinphoneFriendList *list, const char *ref_key) { - bctbx_iterator_t* it = bctbx_map_cchar_find_key(list->friends_map, (void*)ref_key); - if (!bctbx_iterator_cchar_equals(it, bctbx_map_cchar_end(list->friends_map))) { - bctbx_pair_t *pair = bctbx_iterator_cchar_get_pair(it); - return (LinphoneFriend *)bctbx_pair_cchar_get_second(pair); + if(list) { + bctbx_iterator_t* it = bctbx_map_cchar_find_key(list->friends_map, (void*)ref_key); + if (!bctbx_iterator_cchar_equals(it, bctbx_map_cchar_end(list->friends_map))) { + bctbx_pair_t *pair = bctbx_iterator_cchar_get_pair(it); + return (LinphoneFriend *)bctbx_pair_cchar_get_second(pair); + } } return NULL; } @@ -1112,3 +1114,7 @@ void linphone_friend_list_enable_subscriptions(LinphoneFriendList *list, bool_t } } + +bool_t linphone_friend_list_subscriptions_enabled(LinphoneFriendList *list) { + return list->enable_subscriptions; +} diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 2d546440a..62b30e460 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4657,6 +4657,10 @@ void linphone_core_set_call_logs_database_path(LinphoneCore *lc, const char *pat } } +const char * linphone_core_get_call_logs_database_path(LinphoneCore *lc) { + return lc->logs_db_file; +} + const bctbx_list_t* linphone_core_get_call_logs(LinphoneCore *lc) { #ifdef SQLITE_STORAGE_ENABLED if (lc->logs_db) { diff --git a/include/linphone/call_params.h b/include/linphone/call_params.h index 3299b2242..918887fc8 100644 --- a/include/linphone/call_params.h +++ b/include/linphone/call_params.h @@ -196,6 +196,7 @@ LINPHONE_PUBLIC const char *linphone_call_params_get_session_name(const Linphone * @param[in] cp The call. * @return The selected payload type. NULL is returned if no audio payload type has been seleced * by the call. If a payload type is returned, it must be released with linphone_payload_type_unref() after use. + * @warning The returned object is allocated as a floating reference i.e. the reference counter is initialized to 0. **/ LINPHONE_PUBLIC LinphonePayloadType *linphone_call_params_get_used_audio_payload_type(const LinphoneCallParams *cp); @@ -204,6 +205,7 @@ LINPHONE_PUBLIC LinphonePayloadType *linphone_call_params_get_used_audio_payload * @param[in] cp The call. * @return The selected payload type. NULL is returned if no video payload type has been seleced * by the call. If a payload type is returned, it must be released with linphone_payload_type_unref() after use. + * @warning The returned object is allocated as a floating reference i.e. the reference counter is initialized to 0. **/ LINPHONE_PUBLIC LinphonePayloadType *linphone_call_params_get_used_video_payload_type(const LinphoneCallParams *cp); @@ -212,6 +214,7 @@ LINPHONE_PUBLIC LinphonePayloadType *linphone_call_params_get_used_video_payload * @param[in] cp The call. * @return The selected payload type. NULL is returned if no text payload type has been seleced * by the call. If a payload type is returned, it must be released with linphone_payload_type_unref() after use. + * @warning The returned object is allocated as a floating reference i.e. the reference counter is initialized to 0. **/ LINPHONE_PUBLIC LinphonePayloadType *linphone_call_params_get_used_text_payload_type(const LinphoneCallParams *cp); diff --git a/include/linphone/core.h b/include/linphone/core.h index 2ba7899e7..8d90636c0 100644 --- a/include/linphone/core.h +++ b/include/linphone/core.h @@ -721,6 +721,13 @@ LINPHONE_PUBLIC void linphone_core_set_log_collection_max_file_size(size_t size) */ LINPHONE_PUBLIC void linphone_core_set_log_collection_upload_server_url(LinphoneCore *core, const char *server_url); +/** + * Gets the url of the server where to upload the collected log files. + * @param[in] core LinphoneCore object + * @return The url of the server where to upload the collected log files. + */ +LINPHONE_PUBLIC const char * linphone_core_get_log_collection_upload_server_url(LinphoneCore *core); + /** * Upload the log collection to the configured server url. * @param[in] core LinphoneCore object @@ -1575,6 +1582,8 @@ LINPHONE_PUBLIC void linphone_core_set_dns_servers(LinphoneCore *lc, const bctbx * @param[in] lc The core. * @return \bctbx_list{LinphonePayloadType} A freshly allocated list of the available payload types. It must be released * with bctbx_list_free_with_data() calling linphone_payload_type_unref() on each element. + * @warning Each element of the returned list is freshly allocated as floating reference. That means their reference counter + * is initialized to 0. * @ingroup media_parameters */ LINPHONE_PUBLIC bctbx_list_t *linphone_core_get_audio_payload_types(LinphoneCore *lc); @@ -1621,6 +1630,8 @@ LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneStatus linphone_core_set_audio_codec * @param[in] lc The core. * @return \bctbx_list{LinphonePayloadType} A freshly allocated list of the available payload types. It must be released * with bctbx_list_free_with_data() calling linphone_payload_type_unref() on each element. + * @warning Each element of the returned list is freshly allocated as floating reference. That means their reference counter + * is initialized to 0. * @ingroup media_parameters */ LINPHONE_PUBLIC bctbx_list_t *linphone_core_get_video_payload_types(LinphoneCore *lc); @@ -1668,6 +1679,8 @@ LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneStatus linphone_core_set_video_codec * @param[in] lc The core. * @return \bctbx_list{LinphonePayloadType} A freshly allocated list of the available payload types. It must be released * with bctbx_list_free_with_data() calling linphone_payload_type_unref() on each element. + * @warning Each element of the returned list is freshly allocated as floating reference. That means their reference counter + * is initialized to 0. * @ingroup media_parameters */ LINPHONE_PUBLIC bctbx_list_t *linphone_core_get_text_payload_types(LinphoneCore *lc); @@ -1834,6 +1847,7 @@ LINPHONE_PUBLIC LINPHONE_DEPRECATED OrtpPayloadType *linphone_core_find_payload_ * @param channels number of channels, can be #LINPHONE_FIND_PAYLOAD_IGNORE_CHANNELS * @return Returns NULL if not found. If a #LinphonePayloadType is returned, it must be released with * linphone_payload_type_unref() after using it. + * @warning The returned payload type is allocated as a floating reference i.e. the reference counter is initialized to 0. */ LINPHONE_PUBLIC LinphonePayloadType *linphone_core_get_payload_type(LinphoneCore *lc, const char *type, int rate, int channels); @@ -3106,6 +3120,14 @@ LINPHONE_PUBLIC void linphone_core_remove_call_log(LinphoneCore *lc, LinphoneCal **/ LINPHONE_PUBLIC void linphone_core_set_call_logs_database_path(LinphoneCore *lc, const char *path); +/** + * Gets the database filename where call logs will be stored. + * @ingroup initializing + * @param lc the linphone core + * @return filesystem path +**/ +LINPHONE_PUBLIC const char * linphone_core_get_call_logs_database_path(LinphoneCore *lc); + /** * Migrates the call logs from the linphonerc to the database if not done yet * @ingroup initializing @@ -5054,6 +5076,14 @@ LINPHONE_PUBLIC LinphoneFriend *linphone_core_get_friend_by_ref_key(const Linpho **/ LINPHONE_PUBLIC void linphone_core_set_friends_database_path(LinphoneCore *lc, const char *path); +/** + * Gets the database filename where friends will be stored. + * @ingroup initializing + * @param lc the linphone core + * @return filesystem path +**/ +LINPHONE_PUBLIC const char* linphone_core_get_friends_database_path(LinphoneCore *lc); + /** * Migrates the friends from the linphonerc to the database if not done yet * @ingroup initializing diff --git a/include/linphone/friendlist.h b/include/linphone/friendlist.h index f8093db2d..1780e8723 100644 --- a/include/linphone/friendlist.h +++ b/include/linphone/friendlist.h @@ -333,6 +333,13 @@ LINPHONE_PUBLIC void linphone_friend_list_export_friends_as_vcard4_file(Linphone */ LINPHONE_PUBLIC void linphone_friend_list_enable_subscriptions(LinphoneFriendList *list, bool_t enabled); +/** + * Gets whether subscription to NOTIFYes of all friends list are enabled or not + * @param[in] list the LinphoneFriendList object + * @return Whether subscriptions are enabled or not + */ +LINPHONE_PUBLIC bool_t linphone_friend_list_subscriptions_enabled(LinphoneFriendList *list); + /** * @} */ diff --git a/tools/abstractapi.py b/tools/abstractapi.py index 868320285..f12be7080 100644 --- a/tools/abstractapi.py +++ b/tools/abstractapi.py @@ -593,6 +593,7 @@ class CParser(object): valueName = EnumValueName() valueName.from_camel_case(cEnumValue.name, namespace=name) aEnumValue = EnumValue(valueName) + aEnumValue.briefDescription = cEnumValue.briefDoc if cEnumValue.value is not None: try: aEnumValue.value_from_string(cEnumValue.value) diff --git a/tools/genapixml.py b/tools/genapixml.py index f2c1fd555..d52d92f09 100755 --- a/tools/genapixml.py +++ b/tools/genapixml.py @@ -336,13 +336,17 @@ class Project: if td.definition.startswith('struct '): for st in self.__structs: if st.associatedTypedef == td: - self.add(CClass(st)) + cclass = CClass(st) + cclass.briefDoc = td.briefDoc + self.add(cclass) break elif ('Linphone' + td.definition) == td.name: st = CStruct(td.name) st.associatedTypedef = td + cclass = CClass(st) + cclass.briefDoc = td.briefDoc self.add(st) - self.add(CClass(st)) + self.add(cclass) # Sort classes by length of name (longest first), so that methods are put in the right class self.classes.sort(key = lambda c: len(c.name), reverse = True) for e in self.__events: @@ -497,6 +501,7 @@ class Project: if deprecatedNode is not None: f.deprecated = True f.briefDescription = ''.join(node.find('./briefdescription').itertext()).strip() + f.briefDoc = metadoc.Description(node.find('./briefdescription')) f.detailedDescription = self.__cleanDescription(node.find('./detaileddescription')) return f else: @@ -508,6 +513,7 @@ class Project: if deprecatedNode is not None: td.deprecated = True td.briefDescription = ''.join(node.find('./briefdescription').itertext()).strip() + td.briefDoc = metadoc.Description(node.find('./briefdescription')) td.detailedDescription = self.__cleanDescription(node.find('./detaileddescription')) return td return None diff --git a/tools/metadoc.py b/tools/metadoc.py index 670341ca3..eb9786db8 100644 --- a/tools/metadoc.py +++ b/tools/metadoc.py @@ -56,6 +56,9 @@ class Description: class Translator: def translate(self, description): + if description is None: + return None + lines = [] for para in description.paragraphs: if para is not description.paragraphs[0]: diff --git a/wrappers/cpp/CMakeLists.txt b/wrappers/cpp/CMakeLists.txt index d397d96c0..cce3ee314 100644 --- a/wrappers/cpp/CMakeLists.txt +++ b/wrappers/cpp/CMakeLists.txt @@ -23,8 +23,8 @@ add_custom_command(OUTPUT include/linphone++/linphone.hh src/linphone++.cc COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/genwrapper.py" "${PROJECT_BINARY_DIR}/coreapi/help/doc/xml" DEPENDS ${PROJECT_SOURCE_DIR}/tools/genapixml.py - "${PROJECT_SOURCE_DIR}/tools/metadoc.py" - abstractapi.py + ${PROJECT_SOURCE_DIR}/tools/metadoc.py + ${PROJECT_SOURCE_DIR}/tools/abstractapi.py genwrapper.py class_header.mustache class_impl.mustache diff --git a/wrappers/cpp/class_header.mustache b/wrappers/cpp/class_header.mustache index e6c447914..6e4e94876 100644 --- a/wrappers/cpp/class_header.mustache +++ b/wrappers/cpp/class_header.mustache @@ -44,6 +44,13 @@ namespace linphone { {{/priorDeclarations}} {{#_class}} + {{#doc}} + /** + {{#lines}} + * {{{line}}} + {{/lines}} + */ + {{/doc}} class {{className}}{{#parentClassName}}: public {{{parentClassName}}}{{/parentClassName}} { {{#friendClasses}} friend class {{name}}; diff --git a/wrappers/cpp/enums_header.mustache b/wrappers/cpp/enums_header.mustache index 4480d04c1..1eff69b46 100644 --- a/wrappers/cpp/enums_header.mustache +++ b/wrappers/cpp/enums_header.mustache @@ -22,8 +22,23 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. namespace linphone { {{#enums}} + {{#doc}} + /** + {{#lines}} + * {{{line}}} + {{/lines}} + * + */ + {{/doc}} enum {{name}} { {{#values}} + {{#doc}} + /** + {{#lines}} + * {{{line}}} + {{/lines}} + */ + {{/doc}} {{name}}{{#value}} = {{{value}}}{{/value}}{{#notLast}},{{/notLast}} {{/values}} }; diff --git a/wrappers/cpp/genwrapper.py b/wrappers/cpp/genwrapper.py index 34ffd641d..c7b42f591 100755 --- a/wrappers/cpp/genwrapper.py +++ b/wrappers/cpp/genwrapper.py @@ -35,27 +35,28 @@ class CppTranslator(object): def __init__(self): self.ignore = [] self.ambigousTypes = ['LinphonePayloadType'] + self.docTranslator = metadoc.DoxygenCppTranslator() def is_ambigous_type(self, _type): return _type.name in self.ambigousTypes or (_type.name == 'list' and self.is_ambigous_type(_type.containedTypeDesc)) - @staticmethod - def translate_enum(enum): + def translate_enum(self, enum): enumDict = {} enumDict['name'] = enum.name.to_camel_case() + enumDict['doc'] = self.docTranslator.translate(enum.briefDescription) enumDict['values'] = [] i = 0 for enumValue in enum.values: - enumValDict = CppTranslator.translate_enum_value(enumValue) + enumValDict = self.translate_enum_value(enumValue) enumValDict['notLast'] = (i != len(enum.values)-1) enumDict['values'].append(enumValDict) i += 1 return enumDict - @staticmethod - def translate_enum_value(enumValue): + def translate_enum_value(self, enumValue): enumValueDict = {} enumValueDict['name'] = CppTranslator.translate_enum_value_name(enumValue.name) + enumValueDict['doc'] = self.docTranslator.translate(enumValue.briefDescription) if type(enumValue.value) is int: enumValueDict['value'] = str(enumValue.value) elif type(enumValue.value) is AbsApi.Flag: @@ -94,6 +95,8 @@ class CppTranslator(object): if _class.name.to_c() == 'LinphoneCore': classDict['friendClasses'].append({'name': 'Factory'}); + classDict['doc'] = self.docTranslator.translate(_class.briefDescription) + if islistenable: classDict['listenerClassName'] = CppTranslator.translate_class_name(_class.listenerInterface.name) classDict['cListenerName'] = _class.listenerInterface.name.to_c() @@ -241,8 +244,7 @@ class CppTranslator(object): methodDict['implPrototype'] = '{implReturn} {longname}({implParams}){const}'.format(**methodElems) methodDict['sourceCode' ] = self._generate_source_code(method, usedNamespace=namespace) - t = metadoc.DoxygenCppTranslator() - methodDict['doc'] = t.translate(method.briefDescription) if method.briefDescription is not None else None + methodDict['doc'] = self.docTranslator.translate(method.briefDescription) if method.briefDescription is not None else None return methodDict