Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
liblinphone
Commits
279db600
Commit
279db600
authored
6 years ago
by
Benjamin REIS
Browse files
Options
Download
Patches
Plain Diff
Feature/get capability version from presence notify
parent
4cb8305f
master
compat/ios_app_5_3
deleteme
desktop_cmake_rework
feature/18-flexiapiclient-auth-token
feature/5.0
feature/51-vcard-provisioning-fix
feature/AEC3
feature/account_manager_services_devices_list
feature/add_display_name_to_address
feature/add_displayname_identity_address
feature/add_external_regevent_tests
feature/add_server_groupchat_tester
feature/added_event_log_deleted_callback
feature/address-refactoring
feature/allow-raw-mwi-notification
feature/allow_ipv6_dns_servers_to_be_disabled
feature/android_service_and_push_in_library
feature/android_vibrate_incoming_call_4.5
feature/audio-conference-package
feature/authenticated-remote-provisioning
feature/backward_compatibility_with_limev2_early_access
feature/basic_auth
feature/bctbx-vfs
feature/client_audio_mixer
feature/client_video_mixer
feature/conference-info-db
feature/conference_media_description
feature/cpp_threadsafe
feature/csharp_doc
feature/dependent_proxy
feature/encrypted_conference
feature/ephemeral_message
feature/ephemeral_message_based_4.3
feature/ephemeral_participant
feature/exhume_one_to_one_chat_rooms_squashed
feature/external_domain_tests
feature/fec
feature/fec_adaptation
feature/ics_update_improved
feature/keep-configuration-tester-51
feature/key_exchange_protocol_identification
feature/ldap_failover
feature/lime_status_by_uri
feature/linphone-account-integration
feature/load-static-ms2-plugins
feature/local-recorder
feature/media_encryption_settings_on_account
feature/medialess
feature/modify_tls_testers
feature/moving_rootca_update_script_from_jenkins_to_gitlab_ci
feature/new_ephemeral_message
feature/nix-flake
feature/provisioning_header_for_fam1.4
feature/python_wrapper
feature/python_wrapper_5.1
feature/python_wrapper_5.3
feature/remote_provisioning_headers
feature/reply
feature/rework_ephemeral
feature/rfc_9078
feature/screensharing_clean
feature/screensharing_packet_router
feature/screensharing_signalling
feature/sdk_android_audio_focus
feature/sdk_push_notif
feature/support_sfu
feature/swift_push_tests_5_1
feature/swift_push_unit_tests
feature/test-new-ccmp-deployment
feature/test_improvement
feature/test_make_framewor_on_macos
feature/timeline
feature/to-delete-compile-last-wrapper
feature/to_string
feature/unify_audio_video_chat_conf_api
feature/unitTestInCpp
feature/validation_account_sent_through_push
feature/vcard-contacts-list
feature/video_codec_call_params
feature/videoconf
feature/wrap-account-creator-core-functions
fix/4.4_LIME_restart_on_core_restart_provisioning
fix/ECC-for-desktop
fix/TLS_set_by_default
fix/addEvent_error
fix/add_debug_logs
fix/address_call_logs
fix/android_embedded_openh264
fix/android_metered_active_network_check
fix/android_window
fix/audio_codec_debug
fix/audio_lost
fix/audio_routes
fix/audio_toggle_conf
fix/audio_video_conference_factory_crash_master
fix/auth_info_finding
fix/avconf-crashes
fix/avoid_download_file_crash
fix/backport_50
fix/bad_stream_handling_backup
fix/bad_stream_handling_rebased_backup
fix/before-holidays
fix/broadcast_flexisip
fix/bugfixes-from-5.1
fix/bundle_mode_fix
fix/cal_recovery_in_paused_state_with_ice
fix/call_and_bluetooth
fix/call_history_after_core_stop
fix/call_recovery_in_multi_account_case
fix/call_repair
fix/call_resumed_with_video_4_5
fix/cancel_via_header
fix/chat
fix/chat_lesage_local_address_no_contact
fix/chat_room_state_created_message_sending
fix/chat_test
fix/chatroom_const_params
fix/check-tests
fix/cmake-builder-restore
fix/conf_addr_to_addr
fix/conf_memory_leaks
fix/conf_unschedule_video
fix/conference_called_after_joining_5_3
fix/conference_crash
fix/conference_leak
fix/conference_method_status
fix/conference_with_all_listeners
fix/conference_without_advanced_im
fix/conference_without_bundle_mode
fix/copy_message_id_content_operator
fix/crash
fix/crash_calllog
fix/crash_csrc_changed
fix/crash_decline_call
fix/crash_multipart_with_empty_plain_text_content
fix/crash_terminate
fix/crash_test_ios_of_dns
fix/crash_tests
fix/database
fix/db_friend_list_fix
fix/debug_test_to_remove
fix/default_options
fix/delete_sensitive_logs
fix/deprecated_methods
fix/didUpdatePushCredentials_debug_investigation
fix/doc_upload
fix/double_invite
fix/dtls_default_path
fix/empty_authinfo
fix/encode_filename_transfert
fix/encrypted_chat_subscription_failed
fix/enum_swift_wrapper
fix/error_feedback_flexiapi
fix/extra_audio_route_logs_master
fix/factory_c++_regressions
fix/fec-find-payload-type-number
fix/fix_call_transfert_final_notify
fix/fixes-from-5.0.10
fix/flexi_api
fix/flexiapi_enabling_core_init
fix/flexisip-tester-2.3
fix/flexisip_build
fix/flow-control-bad-effect-within-tones
fix/fold-and-trim-ics
fix/force_shared_lib_python_wrapper
fix/force_terminate_duplicated_call
fix/friend_lists
fix/fs_test_crash
fix/gcc_14
fix/group_chat
fix/h265-glitches
fix/ice-test-not-reliable
fix/identity-address-performance
fix/identity_address_without_gruu
fix/imdn_no_proxy
fix/import-from-legacy-db
fix/improved_chat_room_removal
fix/improved_custom_header_test
fix/int_to_size_t
fix/ios_foreground_push_incoming_received
fix/ios_reactions_notif
fix/ios_registerforpush_on_core_start_5_4
fix/ios_shared_core_reactions
fix/itc-misuse
fix/java_jni_wrapper
fix/jni_weak_global_ref_crash
fix/json_static
fix/jvm_cpp_wrapper_on_android
fix/lime_chat_room_left_notify
fix/lime_struct_brackets
fix/local-permission-detection
fix/log_file_updates
fix/longer-random-username-tests
fix/mac_freeze_camera
fix/made_conference_get_state_public
fix/magic_search_clone_crash
fix/mandatory_encryption
fix/master_push
fix/media_local_ip_refresh
fix/media_server_ip
fix/message_not_sent_rework
fix/mid-warnings
fix/no-longer-use-deprecated-findpythoninterp-cmake-module
fix/no_ldap_tester
fix/no_sound_because_the_sound_card_has_not_reset
fix/no_unregister_if_remote_push_allowed
fix/no_unregister_if_remote_push_allowed_5_0
fix/non_last_call_active
fix/notify-stats
fix/only_use_dns_from_active_network
fix/participant_removed
fix/participant_video_no_conf_event_pkg
fix/pause-player
fix/paused_by_remote_no_rtp_timeout_master
fix/pdb_5_3
fix/performance_improvements
fix/plugin_timeout
fix/prack_auth
fix/prack_retransmision_2
fix/prevent_notifying_same_presence_notify
fix/proxy_cfg_contact
fix/pulseaudio_crash
fix/push_and_accounts_integration
fix/push_config_changes_detection
fix/push_notif_background_task
fix/python_build_macos
fix/python_const_build_warning
fix/qt_crash
fix/quickfix_52
fix/recorder_desktop
fix/remote_address_without_admin_param
fix/remote_conference_handler_crash
fix/remote_media_changed_notify
fix/rename_linphone_for_wrapper_cs
fix/retry_action_update
fix/rewrite-tone-manager
fix/ring-category
fix/rtt_message
fix/screen_jul
fix/sdp_direction
fix/select-ip
fix/set_ptr_to_null_after_unref
fix/setlocale_utf8
fix/sip_address_table_creation_refused_utf8mb6_mariadb5.5
fix/slow-tests
fix/small_bug_fixes
fix/sound_lost_when_resuming_call_after_entering_background
fix/specfile
fix/split_call_suite
fix/squash_commits
fix/srtp_key_length
fix/startup_restart
fix/stream-deletion
fix/stream_allocation_no_label
fix/stream_append
fix/subject_not_changed
fix/switch_data_sync_to_short_service
fix/terminate_file_upload_background_task_with_core
fix/test
fix/test_flexiapi_backport
fix/test_video_file_stream
fix/tests_and_basic_chatrooms
fix/timestamp_windows
fix/toggle_video
fix/tone-indications
fix/tone-manager-crash
fix/tone_manager_leak
fix/transcient-video-stretching
fix/transfer_state
fix/tunnel_deadlock
fix/tunnel_tester
fix/unsubscribe_chatroom_on_account_unregister
fix/unsubscribe_upon_core_stop
fix/unwanted_ring_on_stop
fix/update-check
fix/update_calllog_remote_address
fix/utf8_conf
fix/utf8_uwp_path
fix/utf8_windows_paths
fix/uuid4-generation
fix/video_conf_fixes
fix/video_refused
fix/video_windows_store
fix/videoconf_double
fix/vp8-threads
fix/webrtc-ice
fix/win_crash_search
fix/window_build_dec24
fix/window_id_creation
fix/windows_cast
fix/workaround_for_sip_simple_messages_with_bad_to_header
fix/wrong_timestamp
fix/zrtp_call
hotfix/gh_issues_templates_syntax_error
hotfix/lime-db-path
improve/encrypted_chat_multipart_selection
release/4.2
release/4.3
release/4.3-ephemeral
release/4.4
release/4.5
release/5.0
release/5.1
release/5.2
release/5.3
release/5.4
smartwireless_sip_client
test/android_connectivity_issue
test/ansible
test/b2bua
test/call_no_routes
test/flexisip-release-candidate-2-4
test/flexisip_b2bua_h264
test/lime_double_digest_auth_challenge
tmp/pq
tmp/workaround_missing_tester_log_message_bug
tmp/zrtp_stats_make_visible
update/test_certificates
5.5.0-alpha
5.4.4
5.4.3
5.4.2
5.4.1
5.4.0
5.4.0-beta
5.4.0-alpha
5.3.107
5.3.106
5.3.105
5.3.104
5.3.103
5.3.102
5.3.101
5.3.100
5.3.99
5.3.97
5.3.96
5.3.95
5.3.94
5.3.93
5.3.92
5.3.91
5.3.90
5.3.89
5.3.88
5.3.87
5.3.86
5.3.85
5.3.84
5.3.83
5.3.81
5.3.79
5.3.78
5.3.77
5.3.76
5.3.75
5.3.74
5.3.73
5.3.72
5.3.71
5.3.70
5.3.69
5.3.68
5.3.67
5.3.66
5.3.65
5.3.64
5.3.63
5.3.62
5.3.61
5.3.60
5.3.59
5.3.58
5.3.57
5.3.56
5.3.55
5.3.54
5.3.53
5.3.52
5.3.51
5.3.50
5.3.49
5.3.48
5.3.46
5.3.45
5.3.44
5.3.43
5.3.42
5.3.41
5.3.40
5.3.39
5.3.38
5.3.37
5.3.36
5.3.35
5.3.34
5.3.33
5.3.32
5.3.30
5.3.29
5.3.28
5.3.27
5.3.26
5.3.25
5.3.24
5.3.23
5.3.22
5.3.21
5.3.19
5.3.18
5.3.17
5.3.16
5.3.15
5.3.14
5.3.13
5.3.12
5.3.11
5.3.10
5.3.9
5.3.8
5.3.7
5.3.6
5.3.5
5.3.4
5.3.3
5.3.2
5.3.1
5.3.0
5.3.0-beta
5.3.0-alpha
5.2.114
5.2.113
5.2.112
5.2.111
5.2.110
5.2.109
5.2.108
5.2.107
5.2.106
5.2.105
5.2.104
5.2.103
5.2.102
5.2.101
5.2.100
5.2.99
5.2.98
5.2.97
5.2.96
5.2.95
5.2.94
5.2.93
5.2.92
5.2.91
5.2.90
5.2.89
5.2.88
5.2.87
5.2.86
5.2.85
5.2.84
5.2.83
5.2.82
5.2.81
5.2.80
5.2.79
5.2.78
5.2.77
5.2.75
5.2.73
5.2.72
5.2.71
5.2.70
5.2.69
5.2.68
5.2.67
5.2.66
5.2.65
5.2.64
5.2.63
5.2.62
5.2.61
5.2.59
5.2.58
5.2.57
5.2.56
5.2.54
5.2.53
5.2.52
5.2.51
5.2.50
5.2.49
5.2.47
5.2.46
5.2.45
5.2.44
5.2.42
5.2.41
5.2.40
5.2.39
5.2.37
5.2.33
5.2.32
5.2.30
5.2.29
5.2.28
5.2.27
5.2.26
5.2.25
5.2.23
5.2.22
5.2.21
5.2.20
5.2.19
5.2.18
5.2.17
5.2.16
5.2.15
5.2.14
5.2.13
5.2.12
5.2.11
5.2.10
5.2.9
5.2.7
5.2.6
5.2.5
5.2.4
5.2.3
5.2.2
5.2.1
5.2.0
5.2.0-beta
5.2.0-alpha
5.1.73
5.1.72
5.1.71
5.1.70
5.1.68
5.1.67
5.1.66
5.1.65
5.1.64
5.1.63
5.1.62
5.1.61
5.1.59
5.1.58
5.1.57
5.1.56
5.1.55
5.1.54
5.1.53
5.1.52
5.1.51
5.1.50
5.1.49
5.1.48
5.1.46
5.1.45
5.1.44
5.1.43
5.1.42
5.1.41
5.1.38
5.1.37
5.1.36
5.1.35
5.1.34
5.1.33
5.1.32
5.1.31
5.1.30
5.1.28
5.1.24
5.1.23
5.1.22
5.1.21
5.1.20
5.1.19
5.1.17
5.1.16
5.1.15
5.1.14
5.1.13
5.1.12
5.1.11
5.1.10
5.1.9
5.1.8
5.1.7
5.1.6
5.1.5
5.1.4
5.1.3
5.1.2
5.1.1
5.1.0
5.1.0-beta
5.1.0-alpha
5.0.71
5.0.70
5.0.69
5.0.68
5.0.67
5.0.66
5.0.65
5.0.64
5.0.63
5.0.62
5.0.61
5.0.60
5.0.59
5.0.58
5.0.57
5.0.56
5.0.55
5.0.53
5.0.52
5.0.51
5.0.50
5.0.49
5.0.47
5.0.46
5.0.45
5.0.44
5.0.43
5.0.42
5.0.41
5.0.40
5.0.39
5.0.38
5.0.37
5.0.36
5.0.35
5.0.34
5.0.32
5.0.31
5.0.30
5.0.29
5.0.28
5.0.27
5.0.26
5.0.25
5.0.24
5.0.23
5.0.22
5.0.21
5.0.19
5.0.18
5.0.17
5.0.16
5.0.15
5.0.14
5.0.13
5.0.12
5.0.11
5.0.10
5.0.8
5.0.6
5.0.5
5.0.3
5.0.1
5.0.0
5.0.0-beta
5.0.0-alpha
4.5.26
4.5.25
4.5.24
4.5.23
4.5.22
4.5.21
4.5.20
4.5.19
4.5.18
4.5.17
4.5.16
4.5.15
4.5.14
4.5.13
4.5.11
4.5.10
4.5.7
4.5.6
4.5.5
4.5.4
4.5.3
4.5.2
4.5.1
4.5.0
4.5.0-beta
4.5.0-alpha
4.4.35
4.4.34
4.4.33
4.4.32
4.4.31
4.4.29
4.4.28
4.4.27
4.4.26
4.4.25
4.4.24
4.4.22
4.4.21
4.4.19
4.4.18
4.4.17
4.4.16
4.4.15
4.4.14
4.4.13
4.4.12
4.4.11
4.4.10
4.4.9
4.4.8
4.4.7
4.4.6
4.4.5
4.4.4
4.4.3
4.4.2
4.4.0
4.4.0-beta
4.4.0-alpha
4.3.3
4.3.2
4.3.1
4.3.0
4.3.0-beta
4.3.0-alpha
4.0.25
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
coreapi/friend.c
+83
-0
coreapi/friend.c
coreapi/presence.c
+109
-2
coreapi/presence.c
include/linphone/friend.h
+26
-0
include/linphone/friend.h
include/linphone/presence.h
+34
-0
include/linphone/presence.h
tester/presence_server_tester.c
+46
-3
tester/presence_server_tester.c
with
298 additions
and
5 deletions
coreapi/friend.c
+
83
−
0
View file @
279db600
...
...
@@ -1761,3 +1761,86 @@ int linphone_friend_get_capabilities(const LinphoneFriend *lf) {
bool_t
linphone_friend_has_capability
(
const
LinphoneFriend
*
lf
,
const
LinphoneFriendCapability
capability
)
{
return
static_cast
<
bool_t
>
(
linphone_friend_get_capabilities
(
lf
)
&
capability
);
}
bool_t
linphone_friend_has_capability_with_version
(
const
LinphoneFriend
*
lf
,
const
LinphoneFriendCapability
capability
,
float
version
)
{
const
LinphonePresenceModel
*
presence
=
NULL
;
const
bctbx_list_t
*
addrs
=
linphone_friend_get_addresses
(
lf
);
bctbx_list_t
*
phones
=
linphone_friend_get_phone_numbers
(
lf
);
bctbx_list_t
*
it
;
bool_t
result
=
FALSE
;
for
(
it
=
(
bctbx_list_t
*
)
addrs
;
it
!=
NULL
;
it
=
it
->
next
)
{
LinphoneAddress
*
addr
=
(
LinphoneAddress
*
)
it
->
data
;
char
*
uri
=
linphone_address_as_string_uri_only
(
addr
);
presence
=
linphone_friend_get_presence_model_for_uri_or_tel
(
lf
,
uri
);
ms_free
(
uri
);
if
(
!
presence
)
continue
;
if
(
linphone_presence_model_has_capability_with_version
(
presence
,
capability
,
version
))
result
=
TRUE
;
}
for
(
it
=
phones
;
it
!=
NULL
;
it
=
it
->
next
)
{
presence
=
linphone_friend_get_presence_model_for_uri_or_tel
(
lf
,
reinterpret_cast
<
const
char
*>
(
it
->
data
));
if
(
!
presence
)
continue
;
if
(
linphone_presence_model_has_capability_with_version
(
presence
,
capability
,
version
))
result
=
TRUE
;
}
bctbx_list_free
(
phones
);
return
result
;
}
bool_t
linphone_friend_has_capability_with_version_or_more
(
const
LinphoneFriend
*
lf
,
const
LinphoneFriendCapability
capability
,
float
version
)
{
const
LinphonePresenceModel
*
presence
=
NULL
;
const
bctbx_list_t
*
addrs
=
linphone_friend_get_addresses
(
lf
);
bctbx_list_t
*
phones
=
linphone_friend_get_phone_numbers
(
lf
);
bctbx_list_t
*
it
;
bool_t
result
=
FALSE
;
for
(
it
=
(
bctbx_list_t
*
)
addrs
;
it
!=
NULL
;
it
=
it
->
next
)
{
LinphoneAddress
*
addr
=
(
LinphoneAddress
*
)
it
->
data
;
char
*
uri
=
linphone_address_as_string_uri_only
(
addr
);
presence
=
linphone_friend_get_presence_model_for_uri_or_tel
(
lf
,
uri
);
ms_free
(
uri
);
if
(
!
presence
)
continue
;
if
(
linphone_presence_model_has_capability_with_version_or_more
(
presence
,
capability
,
version
))
result
=
TRUE
;
}
for
(
it
=
phones
;
it
!=
NULL
;
it
=
it
->
next
)
{
presence
=
linphone_friend_get_presence_model_for_uri_or_tel
(
lf
,
reinterpret_cast
<
const
char
*>
(
it
->
data
));
if
(
!
presence
)
continue
;
if
(
linphone_presence_model_has_capability_with_version_or_more
(
presence
,
capability
,
version
))
result
=
TRUE
;
}
bctbx_list_free
(
phones
);
return
result
;
}
float
linphone_friend_get_capability_version
(
const
LinphoneFriend
*
lf
,
const
LinphoneFriendCapability
capability
)
{
const
LinphonePresenceModel
*
presence
=
NULL
;
const
bctbx_list_t
*
addrs
=
linphone_friend_get_addresses
(
lf
);
bctbx_list_t
*
phones
=
linphone_friend_get_phone_numbers
(
lf
);
bctbx_list_t
*
it
;
float
version
=
-
1
.
0
;
for
(
it
=
(
bctbx_list_t
*
)
addrs
;
it
!=
NULL
;
it
=
it
->
next
)
{
LinphoneAddress
*
addr
=
(
LinphoneAddress
*
)
it
->
data
;
char
*
uri
=
linphone_address_as_string_uri_only
(
addr
);
presence
=
linphone_friend_get_presence_model_for_uri_or_tel
(
lf
,
uri
);
ms_free
(
uri
);
if
(
!
presence
)
continue
;
float
presence_version
=
linphone_presence_model_get_capability_version
(
presence
,
capability
);
if
(
presence_version
>
version
)
version
=
presence_version
;
}
for
(
it
=
phones
;
it
!=
NULL
;
it
=
it
->
next
)
{
presence
=
linphone_friend_get_presence_model_for_uri_or_tel
(
lf
,
reinterpret_cast
<
const
char
*>
(
it
->
data
));
if
(
!
presence
)
continue
;
float
presence_version
=
linphone_presence_model_get_capability_version
(
presence
,
capability
);
if
(
presence_version
>
version
)
version
=
presence_version
;
}
bctbx_list_free
(
phones
);
return
version
;
}
This diff is collapsed.
Click to expand it.
coreapi/presence.c
+
109
−
2
View file @
279db600
...
...
@@ -17,6 +17,10 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include
<cmath>
#include
<bctoolbox/map.h>
#include
"linphone/core.h"
#include
"linphone/lpconfig.h"
#include
"linphone/presence.h"
...
...
@@ -49,6 +53,7 @@ struct _LinphonePresenceService {
bctbx_list_t
*
notes
;
/**< A list of _LinphonePresenceNote structures. */
time_t
timestamp
;
bctbx_list_t
*
service_descriptions
;
bctbx_map_t
*
capabilities
;
};
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES
(
LinphonePresenceService
);
...
...
@@ -138,6 +143,7 @@ static LinphonePresenceService * presence_service_new(const char *id, LinphonePr
}
service
->
status
=
status
;
service
->
timestamp
=
time
(
NULL
);
service
->
capabilities
=
bctbx_mmap_cchar_new
();
return
service
;
}
...
...
@@ -150,6 +156,7 @@ static void presence_service_uninit(LinphonePresenceService *service) {
}
bctbx_list_for_each
(
service
->
notes
,
presence_note_unref
);
bctbx_list_free
(
service
->
notes
);
bctbx_mmap_cchar_delete_with_data
(
service
->
capabilities
,
bctbx_free
);
};
static
void
presence_service_unref
(
void
*
service
)
{
...
...
@@ -814,6 +821,54 @@ LinphoneStatus linphone_presence_service_set_service_descriptions(LinphonePresen
return
0
;
}
namespace
{
const
std
::
unordered_map
<
int
,
std
::
string
>
CapabilityToString
{
{
LinphoneFriendCapabilityGroupChat
,
"groupchat"
},
{
LinphoneFriendCapabilityLimeX3dh
,
"lime"
}
};
}
static
std
::
string
capability_to_string
(
const
LinphoneFriendCapability
capability
)
{
const
auto
&
it
=
CapabilityToString
.
find
(
static_cast
<
int
>
(
capability
));
return
(
it
==
CapabilityToString
.
cend
())
?
"none"
:
it
->
second
;
}
static
const
float
EPSILON
=
0
.
1
f
;
bool_t
linphone_presence_service_has_capability_with_version
(
const
LinphonePresenceService
*
service
,
const
LinphoneFriendCapability
capability
,
float
version
)
{
const
auto
&
it
=
bctbx_map_cchar_find_key
(
service
->
capabilities
,
capability_to_string
(
capability
).
c_str
());
if
(
!
bctbx_iterator_equals
(
it
,
bctbx_map_cchar_end
(
service
->
capabilities
)))
return
static_cast
<
bool_t
>
(
fabs
(
std
::
stof
(
std
::
string
((
const
char
*
)
bctbx_pair_cchar_get_second
(
bctbx_iterator_cchar_get_pair
(
it
))))
-
version
)
<
EPSILON
);
return
FALSE
;
}
bool_t
linphone_presence_service_has_capability_with_version_or_more
(
const
LinphonePresenceService
*
service
,
const
LinphoneFriendCapability
capability
,
float
version
)
{
const
auto
&
it
=
bctbx_map_cchar_find_key
(
service
->
capabilities
,
capability_to_string
(
capability
).
c_str
());
if
(
!
bctbx_iterator_equals
(
it
,
bctbx_map_cchar_end
(
service
->
capabilities
)))
return
static_cast
<
bool_t
>
(
std
::
stof
(
std
::
string
((
const
char
*
)
bctbx_pair_cchar_get_second
(
bctbx_iterator_cchar_get_pair
(
it
))))
>=
version
);
return
FALSE
;
}
float
linphone_presence_service_get_capability_version
(
const
LinphonePresenceService
*
service
,
const
LinphoneFriendCapability
capability
)
{
const
auto
&
it
=
bctbx_map_cchar_find_key
(
service
->
capabilities
,
capability_to_string
(
capability
).
c_str
());
if
(
!
bctbx_iterator_equals
(
it
,
bctbx_map_cchar_end
(
service
->
capabilities
)))
return
std
::
stof
(
std
::
string
((
const
char
*
)
bctbx_pair_cchar_get_second
(
bctbx_iterator_cchar_get_pair
(
it
))));
return
-
1
.
0
;
}
void
linphone_presence_service_add_capability
(
LinphonePresenceService
*
service
,
const
char
*
capability_name
,
const
char
*
version
)
{
const
bctbx_pair_cchar_t
*
pair
=
bctbx_pair_cchar_new
(
capability_name
,
(
void
*
)
version
);
bctbx_map_cchar_insert
(
service
->
capabilities
,
(
const
bctbx_pair_t
*
)
pair
);
}
unsigned
int
linphone_presence_service_get_nb_notes
(
const
LinphonePresenceService
*
service
)
{
return
(
unsigned
int
)
bctbx_list_size
(
service
->
notes
);
}
...
...
@@ -1157,13 +1212,13 @@ void * linphone_presence_model_get_user_data(const LinphonePresenceModel *model)
}
namespace
{
const
std
::
unordered_map
<
std
::
string
,
LinphoneFriendCapability
>
StringToCapability
{
const
std
::
unordered_map
<
std
::
string
,
LinphoneFriendCapability
>
StringToCapability
{
{
"groupchat"
,
LinphoneFriendCapabilityGroupChat
},
{
"lime"
,
LinphoneFriendCapabilityLimeX3dh
}
};
}
static
LinphoneFriendCapability
get_capability_from_string
(
const
std
::
string
&
capabilityName
)
{
auto
it
=
StringToCapability
.
find
(
capabilityName
);
const
auto
&
it
=
StringToCapability
.
find
(
capabilityName
);
return
(
it
==
StringToCapability
.
cend
())
?
LinphoneFriendCapabilityNone
:
it
->
second
;
}
int
linphone_presence_model_get_capabilities
(
const
LinphonePresenceModel
*
model
)
{
...
...
@@ -1189,6 +1244,52 @@ bool_t linphone_presence_model_has_capability(const LinphonePresenceModel *model
return
static_cast
<
bool_t
>
(
linphone_presence_model_get_capabilities
(
model
)
&
capability
);
}
bool_t
linphone_presence_model_has_capability_with_version
(
const
LinphonePresenceModel
*
model
,
const
LinphoneFriendCapability
capability
,
float
version
)
{
unsigned
int
nbServices
=
linphone_presence_model_get_nb_services
(
model
);
for
(
unsigned
int
i
=
0
;
i
<
nbServices
;
i
++
)
{
LinphonePresenceService
*
service
=
linphone_presence_model_get_nth_service
(
model
,
i
);
if
(
!
service
)
continue
;
if
(
linphone_presence_service_has_capability_with_version
(
service
,
capability
,
version
))
return
TRUE
;
}
return
FALSE
;
}
bool_t
linphone_presence_model_has_capability_with_version_or_more
(
const
LinphonePresenceModel
*
model
,
const
LinphoneFriendCapability
capability
,
float
version
)
{
unsigned
int
nbServices
=
linphone_presence_model_get_nb_services
(
model
);
for
(
unsigned
int
i
=
0
;
i
<
nbServices
;
i
++
)
{
LinphonePresenceService
*
service
=
linphone_presence_model_get_nth_service
(
model
,
i
);
if
(
!
service
)
continue
;
if
(
linphone_presence_service_has_capability_with_version_or_more
(
service
,
capability
,
version
))
return
TRUE
;
}
return
FALSE
;
}
float
linphone_presence_model_get_capability_version
(
const
LinphonePresenceModel
*
model
,
const
LinphoneFriendCapability
capability
)
{
float
version
=
-
1
.
0
;
unsigned
int
nbServices
=
linphone_presence_model_get_nb_services
(
model
);
for
(
unsigned
int
i
=
0
;
i
<
nbServices
;
i
++
)
{
LinphonePresenceService
*
service
=
linphone_presence_model_get_nth_service
(
model
,
i
);
if
(
!
service
)
continue
;
float
service_version
=
linphone_presence_service_get_capability_version
(
service
,
capability
);
if
(
service_version
>
version
)
version
=
service_version
;
}
return
version
;
}
LinphonePresenceService
*
linphone_presence_service_ref
(
LinphonePresenceService
*
service
)
{
return
(
LinphonePresenceService
*
)
belle_sip_object_ref
(
service
);
}
...
...
@@ -1353,11 +1454,17 @@ static int process_pidf_xml_presence_services(xmlparsing_context_t *xml_ctx, Lin
if
(
service_descriptions
&&
service_descriptions
->
nodesetval
)
{
for
(
int
j
=
1
;
j
<=
service_descriptions
->
nodesetval
->
nodeNr
;
j
++
)
{
char
*
service_id
=
nullptr
;
char
*
version
=
nullptr
;
linphone_xml_xpath_context_set_node
(
xml_ctx
,
xmlXPathNodeSetItem
(
service_descriptions
->
nodesetval
,
j
-
1
));
service_id
=
linphone_get_xml_text_content
(
xml_ctx
,
"./oma-pres:service-id"
);
if
(
service_id
)
{
version
=
linphone_get_xml_text_content
(
xml_ctx
,
"./oma-pres:version"
);
services
=
bctbx_list_append
(
services
,
ms_strdup
(
service_id
));
if
(
service
)
linphone_presence_service_add_capability
(
service
,
ms_strdup
(
service_id
),
ms_strdup
(
version
));
linphone_free_xml_text_content
(
service_id
);
linphone_free_xml_text_content
(
version
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
include/linphone/friend.h
+
26
−
0
View file @
279db600
...
...
@@ -353,6 +353,32 @@ LINPHONE_PUBLIC int linphone_friend_get_capabilities(const LinphoneFriend *lf);
*/
LINPHONE_PUBLIC
bool_t
linphone_friend_has_capability
(
const
LinphoneFriend
*
lf
,
const
LinphoneFriendCapability
capability
);
/**
* Returns whether or not a friend has a capbility with a given version.
* @param[in] lf #LinphoneFriend object
* @param[in] capability #LinphoneFriendCapability object
* @param[in] version the version to test
* @return whether or not a friend has a capbility with a given version or -1.0 if friend has not capability.
*/
LINPHONE_PUBLIC
bool_t
linphone_friend_has_capability_with_version
(
const
LinphoneFriend
*
lf
,
const
LinphoneFriendCapability
capability
,
float
version
);
/**
* Returns whether or not a friend has a capbility with a given version or more.
* @param[in] lf #LinphoneFriend object
* @param[in] capability #LinphoneFriendCapability object
* @param[in] version the version to test
* @return whether or not a friend has a capbility with a given version or more.
*/
LINPHONE_PUBLIC
bool_t
linphone_friend_has_capability_with_version_or_more
(
const
LinphoneFriend
*
lf
,
const
LinphoneFriendCapability
capability
,
float
version
);
/**
* Returns the version of a friend's capbility.
* @param[in] lf #LinphoneFriend object
* @param[in] capability #LinphoneFriendCapability object
* @return the version of a friend's capbility.
*/
LINPHONE_PUBLIC
float
linphone_friend_get_capability_version
(
const
LinphoneFriend
*
lf
,
const
LinphoneFriendCapability
capability
);
/**
* @}
*/
...
...
This diff is collapsed.
Click to expand it.
include/linphone/presence.h
+
34
−
0
View file @
279db600
...
...
@@ -670,6 +670,40 @@ LINPHONE_PUBLIC int linphone_presence_model_get_capabilities(const LinphonePrese
*/
LINPHONE_PUBLIC
bool_t
linphone_presence_model_has_capability
(
const
LinphonePresenceModel
*
model
,
const
LinphoneFriendCapability
capability
);
/**
* Returns whether or not the #LinphonePresenceModel object has a given capability with a certain version.
* @param[in] model The #LinphonePresenceModel object for which to set the contact.
* @param[in] capability The capability to test.
* @param[in] version The wanted version to test.
* @return whether or not the #LinphonePresenceModel object has a given capability with a certain version.
*/
LINPHONE_PUBLIC
bool_t
linphone_presence_model_has_capability_with_version
(
const
LinphonePresenceModel
*
model
,
const
LinphoneFriendCapability
capability
,
float
version
);
/**
* Returns whether or not the #LinphonePresenceModel object has a given capability with a certain version or more.
* @param[in] model The #LinphonePresenceModel object for which to set the contact.
* @param[in] capability The capability to test.
* @param[in] version The wanted version to test.
* @return whether or not the #LinphonePresenceModel object has a given capability with a certain version or more.
*/
LINPHONE_PUBLIC
bool_t
linphone_presence_model_has_capability_with_version_or_more
(
const
LinphonePresenceModel
*
model
,
const
LinphoneFriendCapability
capability
,
float
version
);
/**
* Returns the version of the capability of a #LinphonePresenceModel.
* @param[in] model The #LinphonePresenceModel object for which to set the contact.
* @param[in] capability The capability to test.
* @return the version of the capability of a #LinphonePresenceModel or -1.0 if the model has not the capability.
*/
LINPHONE_PUBLIC
float
linphone_presence_model_get_capability_version
(
const
LinphonePresenceModel
*
model
,
const
LinphoneFriendCapability
capability
);
/**
* Increase the reference count of the #LinphonePresenceService object.
* @param[in] service The #LinphonePresenceService object for which the reference count is to be increased.
...
...
This diff is collapsed.
Click to expand it.
tester/presence_server_tester.c
+
46
−
3
View file @
279db600
...
...
@@ -1864,11 +1864,13 @@ static void notify_friend_capabilities(void) {
LinphoneCoreManager
*
laure
=
linphone_core_manager_create
(
"laure_tcp_rc"
);
LinphoneCoreManager
*
chloe
=
linphone_core_manager_create
(
"chloe_rc"
);
LinphoneCoreManager
*
chloe2
=
linphone_core_manager_create
(
"chloe_rc"
);
LinphoneCoreManager
*
chloe3
=
linphone_core_manager_create
(
"chloe_rc"
);
linphone_core_set_linphone_specs
(
pauline
->
lc
,
"groupchat"
);
linphone_core_set_linphone_specs
(
pauline
->
lc
,
"groupchat
/1.1
"
);
linphone_core_set_linphone_specs
(
pauline2
->
lc
,
"lime"
);
linphone_core_set_linphone_specs
(
laure
->
lc
,
"groupchat"
);
linphone_core_set_linphone_specs
(
chloe
->
lc
,
"groupchat, lime"
);
linphone_core_set_linphone_specs
(
laure
->
lc
,
"groupchat/2.0"
);
linphone_core_set_linphone_specs
(
chloe
->
lc
,
"groupchat/2.1, lime/1.5"
);
linphone_core_set_linphone_specs
(
chloe3
->
lc
,
"groupchat/2.1, lime/1.7"
);
linphone_core_manager_start
(
marie
,
TRUE
);
linphone_core_manager_start
(
pauline
,
TRUE
);
...
...
@@ -1876,6 +1878,7 @@ static void notify_friend_capabilities(void) {
linphone_core_manager_start
(
laure
,
TRUE
);
linphone_core_manager_start
(
chloe
,
TRUE
);
linphone_core_manager_start
(
chloe2
,
TRUE
);
linphone_core_manager_start
(
chloe3
,
TRUE
);
LinphoneFriendList
*
mFriendList
=
linphone_core_get_default_friend_list
(
marie
->
lc
);
LinphoneFriend
*
mPaulineFriend
=
linphone_core_create_friend_with_address
(
marie
->
lc
,
get_identity
(
pauline
));
...
...
@@ -1913,6 +1916,7 @@ static void notify_friend_capabilities(void) {
lcs
=
bctbx_list_append
(
lcs
,
laure
->
lc
);
lcs
=
bctbx_list_append
(
lcs
,
chloe
->
lc
);
lcs
=
bctbx_list_append
(
lcs
,
chloe2
->
lc
);
lcs
=
bctbx_list_append
(
lcs
,
chloe3
->
lc
);
linphone_core_set_user_agent
(
marie
->
lc
,
"full-presence-support"
,
NULL
);
linphone_core_set_user_agent
(
marie
->
lc
,
"full-presence-support-bypass"
,
NULL
);
...
...
@@ -1981,80 +1985,116 @@ static void notify_friend_capabilities(void) {
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
mPaulineFriend
,
LinphoneFriendCapabilityGroupChat
));
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
mPaulineFriend
)
&
LinphoneFriendCapabilityLimeX3dh
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
mPaulineFriend
,
LinphoneFriendCapabilityLimeX3dh
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
mPaulineFriend
,
LinphoneFriendCapabilityGroupChat
,
1
.
1
f
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
mPaulineFriend
,
LinphoneFriendCapabilityLimeX3dh
,
1
.
0
f
));
BC_ASSERT_TRUE
(
linphone_friend_get_capability_version
(
mPaulineFriend
,
LinphoneFriendCapabilityGroupChat
)
-
1
.
1
f
<
0
.
1
f
);
BC_ASSERT_TRUE
(
linphone_friend_get_capability_version
(
mPaulineFriend
,
LinphoneFriendCapabilityLimeX3dh
)
-
1
.
0
f
<
0
.
1
f
);
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
mLaureFriend
)
&
LinphoneFriendCapabilityGroupChat
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
mLaureFriend
,
LinphoneFriendCapabilityGroupChat
));
BC_ASSERT_FALSE
(
linphone_friend_get_capabilities
(
mLaureFriend
)
&
LinphoneFriendCapabilityLimeX3dh
);
BC_ASSERT_FALSE
(
linphone_friend_has_capability
(
mLaureFriend
,
LinphoneFriendCapabilityLimeX3dh
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
mLaureFriend
,
LinphoneFriendCapabilityGroupChat
,
2
.
0
f
));
BC_ASSERT_FALSE
(
linphone_friend_has_capability_with_version
(
mLaureFriend
,
LinphoneFriendCapabilityLimeX3dh
,
1
.
0
f
));
BC_ASSERT_TRUE
(
linphone_friend_get_capability_version
(
mLaureFriend
,
LinphoneFriendCapabilityGroupChat
)
-
2
.
0
f
<
0
.
1
f
);
BC_ASSERT_TRUE
(
linphone_friend_get_capability_version
(
mLaureFriend
,
LinphoneFriendCapabilityLimeX3dh
)
-
(
-
1
.
0
f
)
<
0
.
1
f
);
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
mChloeFriend
)
&
LinphoneFriendCapabilityGroupChat
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
mChloeFriend
,
LinphoneFriendCapabilityGroupChat
));
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
mChloeFriend
)
&
LinphoneFriendCapabilityLimeX3dh
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
mChloeFriend
,
LinphoneFriendCapabilityLimeX3dh
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
mChloeFriend
,
LinphoneFriendCapabilityGroupChat
,
2
.
1
f
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
mChloeFriend
,
LinphoneFriendCapabilityLimeX3dh
,
1
.
7
f
));
BC_ASSERT_TRUE
(
linphone_friend_get_capability_version
(
mChloeFriend
,
LinphoneFriendCapabilityGroupChat
)
-
2
.
1
f
<
0
.
1
f
);
BC_ASSERT_TRUE
(
linphone_friend_get_capability_version
(
mChloeFriend
,
LinphoneFriendCapabilityLimeX3dh
)
-
1
.
7
f
<
0
.
1
f
);
// Pauline's received presence
BC_ASSERT_FALSE
(
linphone_friend_get_capabilities
(
p1MarieFriend
)
&
LinphoneFriendCapabilityGroupChat
);
BC_ASSERT_FALSE
(
linphone_friend_has_capability
(
p1MarieFriend
,
LinphoneFriendCapabilityGroupChat
));
BC_ASSERT_FALSE
(
linphone_friend_get_capabilities
(
p1MarieFriend
)
&
LinphoneFriendCapabilityLimeX3dh
);
BC_ASSERT_FALSE
(
linphone_friend_has_capability
(
p1MarieFriend
,
LinphoneFriendCapabilityLimeX3dh
));
BC_ASSERT_FALSE
(
linphone_friend_has_capability_with_version
(
p1MarieFriend
,
LinphoneFriendCapabilityGroupChat
,
1
.
0
f
));
BC_ASSERT_FALSE
(
linphone_friend_has_capability_with_version
(
p1MarieFriend
,
LinphoneFriendCapabilityLimeX3dh
,
1
.
0
f
));
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
p1LaureFriend
)
&
LinphoneFriendCapabilityGroupChat
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
p1LaureFriend
,
LinphoneFriendCapabilityGroupChat
));
BC_ASSERT_FALSE
(
linphone_friend_get_capabilities
(
p1LaureFriend
)
&
LinphoneFriendCapabilityLimeX3dh
);
BC_ASSERT_FALSE
(
linphone_friend_has_capability
(
p1LaureFriend
,
LinphoneFriendCapabilityLimeX3dh
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
p1LaureFriend
,
LinphoneFriendCapabilityGroupChat
,
2
.
0
f
));
BC_ASSERT_FALSE
(
linphone_friend_has_capability_with_version
(
p1LaureFriend
,
LinphoneFriendCapabilityLimeX3dh
,
1
.
0
f
));
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
p1ChloeFriend
)
&
LinphoneFriendCapabilityGroupChat
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
p1ChloeFriend
,
LinphoneFriendCapabilityGroupChat
));
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
p1ChloeFriend
)
&
LinphoneFriendCapabilityLimeX3dh
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
p1ChloeFriend
,
LinphoneFriendCapabilityLimeX3dh
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
p1ChloeFriend
,
LinphoneFriendCapabilityGroupChat
,
2
.
1
f
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
p1ChloeFriend
,
LinphoneFriendCapabilityLimeX3dh
,
1
.
7
f
));
// Pauline2's received presence
BC_ASSERT_FALSE
(
linphone_friend_get_capabilities
(
p2MarieFriend
)
&
LinphoneFriendCapabilityGroupChat
);
BC_ASSERT_FALSE
(
linphone_friend_has_capability
(
p2MarieFriend
,
LinphoneFriendCapabilityGroupChat
));
BC_ASSERT_FALSE
(
linphone_friend_get_capabilities
(
p2MarieFriend
)
&
LinphoneFriendCapabilityLimeX3dh
);
BC_ASSERT_FALSE
(
linphone_friend_has_capability
(
p2MarieFriend
,
LinphoneFriendCapabilityLimeX3dh
));
BC_ASSERT_FALSE
(
linphone_friend_has_capability_with_version
(
p2MarieFriend
,
LinphoneFriendCapabilityGroupChat
,
1
.
0
f
));
BC_ASSERT_FALSE
(
linphone_friend_has_capability_with_version
(
p2MarieFriend
,
LinphoneFriendCapabilityLimeX3dh
,
1
.
0
f
));
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
p2LaureFriend
)
&
LinphoneFriendCapabilityGroupChat
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
p2LaureFriend
,
LinphoneFriendCapabilityGroupChat
));
BC_ASSERT_FALSE
(
linphone_friend_get_capabilities
(
p2LaureFriend
)
&
LinphoneFriendCapabilityLimeX3dh
);
BC_ASSERT_FALSE
(
linphone_friend_has_capability
(
p2LaureFriend
,
LinphoneFriendCapabilityLimeX3dh
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
p2LaureFriend
,
LinphoneFriendCapabilityGroupChat
,
2
.
0
f
));
BC_ASSERT_FALSE
(
linphone_friend_has_capability_with_version
(
p2LaureFriend
,
LinphoneFriendCapabilityLimeX3dh
,
1
.
0
f
));
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
p2ChloeFriend
)
&
LinphoneFriendCapabilityGroupChat
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
p2ChloeFriend
,
LinphoneFriendCapabilityGroupChat
));
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
p2ChloeFriend
)
&
LinphoneFriendCapabilityLimeX3dh
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
p2ChloeFriend
,
LinphoneFriendCapabilityLimeX3dh
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
p2ChloeFriend
,
LinphoneFriendCapabilityGroupChat
,
2
.
1
f
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
p2ChloeFriend
,
LinphoneFriendCapabilityLimeX3dh
,
1
.
7
f
));
// Laure's received presence
BC_ASSERT_FALSE
(
linphone_friend_get_capabilities
(
lMarieFriend
)
&
LinphoneFriendCapabilityGroupChat
);
BC_ASSERT_FALSE
(
linphone_friend_has_capability
(
lMarieFriend
,
LinphoneFriendCapabilityGroupChat
));
BC_ASSERT_FALSE
(
linphone_friend_get_capabilities
(
lMarieFriend
)
&
LinphoneFriendCapabilityLimeX3dh
);
BC_ASSERT_FALSE
(
linphone_friend_has_capability
(
lMarieFriend
,
LinphoneFriendCapabilityLimeX3dh
));
BC_ASSERT_FALSE
(
linphone_friend_has_capability_with_version
(
lMarieFriend
,
LinphoneFriendCapabilityGroupChat
,
1
.
0
f
));
BC_ASSERT_FALSE
(
linphone_friend_has_capability_with_version
(
lMarieFriend
,
LinphoneFriendCapabilityLimeX3dh
,
1
.
0
f
));
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
lPaulineFriend
)
&
LinphoneFriendCapabilityGroupChat
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
lPaulineFriend
,
LinphoneFriendCapabilityGroupChat
));
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
lPaulineFriend
)
&
LinphoneFriendCapabilityLimeX3dh
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
lPaulineFriend
,
LinphoneFriendCapabilityLimeX3dh
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
lPaulineFriend
,
LinphoneFriendCapabilityGroupChat
,
1
.
1
f
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
lPaulineFriend
,
LinphoneFriendCapabilityLimeX3dh
,
1
.
0
f
));
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
lChloeFriend
)
&
LinphoneFriendCapabilityGroupChat
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
lChloeFriend
,
LinphoneFriendCapabilityGroupChat
));
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
lChloeFriend
)
&
LinphoneFriendCapabilityLimeX3dh
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
lChloeFriend
,
LinphoneFriendCapabilityLimeX3dh
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
lChloeFriend
,
LinphoneFriendCapabilityGroupChat
,
2
.
1
f
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
lChloeFriend
,
LinphoneFriendCapabilityLimeX3dh
,
1
.
7
f
));
// Chloe's received presence
BC_ASSERT_FALSE
(
linphone_friend_get_capabilities
(
cMarieFriend
)
&
LinphoneFriendCapabilityGroupChat
);
BC_ASSERT_FALSE
(
linphone_friend_has_capability
(
cMarieFriend
,
LinphoneFriendCapabilityGroupChat
));
BC_ASSERT_FALSE
(
linphone_friend_get_capabilities
(
cMarieFriend
)
&
LinphoneFriendCapabilityLimeX3dh
);
BC_ASSERT_FALSE
(
linphone_friend_has_capability
(
cMarieFriend
,
LinphoneFriendCapabilityLimeX3dh
));
BC_ASSERT_FALSE
(
linphone_friend_has_capability_with_version
(
cMarieFriend
,
LinphoneFriendCapabilityGroupChat
,
1
.
0
f
));
BC_ASSERT_FALSE
(
linphone_friend_has_capability_with_version
(
cMarieFriend
,
LinphoneFriendCapabilityLimeX3dh
,
1
.
0
f
));
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
cPaulineFriend
)
&
LinphoneFriendCapabilityGroupChat
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
cPaulineFriend
,
LinphoneFriendCapabilityGroupChat
));
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
cPaulineFriend
)
&
LinphoneFriendCapabilityLimeX3dh
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
cPaulineFriend
,
LinphoneFriendCapabilityLimeX3dh
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
cPaulineFriend
,
LinphoneFriendCapabilityGroupChat
,
1
.
1
f
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
cPaulineFriend
,
LinphoneFriendCapabilityLimeX3dh
,
1
.
0
f
));
BC_ASSERT_TRUE
(
linphone_friend_get_capabilities
(
cLaureFriend
)
&
LinphoneFriendCapabilityGroupChat
);
BC_ASSERT_TRUE
(
linphone_friend_has_capability
(
cLaureFriend
,
LinphoneFriendCapabilityGroupChat
));
BC_ASSERT_FALSE
(
linphone_friend_get_capabilities
(
cLaureFriend
)
&
LinphoneFriendCapabilityLimeX3dh
);
BC_ASSERT_FALSE
(
linphone_friend_has_capability
(
cLaureFriend
,
LinphoneFriendCapabilityLimeX3dh
));
BC_ASSERT_TRUE
(
linphone_friend_has_capability_with_version
(
cLaureFriend
,
LinphoneFriendCapabilityGroupChat
,
2
.
0
f
));
BC_ASSERT_FALSE
(
linphone_friend_has_capability_with_version
(
cLaureFriend
,
LinphoneFriendCapabilityLimeX3dh
,
1
.
0
f
));
linphone_friend_unref
(
mPaulineFriend
);
linphone_friend_unref
(
mLaureFriend
);
...
...
@@ -2094,6 +2134,9 @@ static void notify_friend_capabilities(void) {
linphone_core_manager_stop
(
chloe2
);
linphone_core_manager_destroy
(
chloe2
);
linphone_core_manager_stop
(
chloe3
);
linphone_core_manager_destroy
(
chloe3
);
bctbx_list_free
(
lcs
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets