Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
1cf7027e
Commit
1cf7027e
authored
Dec 19, 2017
by
Ghislain MARY
Browse files
Add fetch of participant devices, checking of their capabilities and improve group chat tests.
parent
5b31f56f
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
284 additions
and
87 deletions
+284
-87
coreapi/linphonecore.c
coreapi/linphonecore.c
+1
-1
include/linphone/api/c-callbacks.h
include/linphone/api/c-callbacks.h
+15
-0
include/linphone/api/c-chat-room-cbs.h
include/linphone/api/c-chat-room-cbs.h
+28
-0
include/linphone/api/c-chat-room.h
include/linphone/api/c-chat-room.h
+19
-1
include/linphone/api/c-types.h
include/linphone/api/c-types.h
+6
-0
src/c-wrapper/api/c-chat-room-cbs.cpp
src/c-wrapper/api/c-chat-room-cbs.cpp
+18
-0
src/c-wrapper/api/c-chat-room.cpp
src/c-wrapper/api/c-chat-room.cpp
+33
-2
src/chat/chat-room/client-group-to-basic-chat-room.cpp
src/chat/chat-room/client-group-to-basic-chat-room.cpp
+1
-1
src/chat/chat-room/proxy-chat-room.cpp
src/chat/chat-room/proxy-chat-room.cpp
+1
-1
src/chat/chat-room/server-group-chat-room-p.h
src/chat/chat-room/server-group-chat-room-p.h
+1
-0
src/chat/chat-room/server-group-chat-room-stub.cpp
src/chat/chat-room/server-group-chat-room-stub.cpp
+10
-0
tester/group_chat_tester.c
tester/group_chat_tester.c
+139
-79
tester/liblinphone_tester.h
tester/liblinphone_tester.h
+2
-0
tester/tester.c
tester/tester.c
+10
-2
No files found.
coreapi/linphonecore.c
View file @
1cf7027e
...
...
@@ -2143,7 +2143,7 @@ static void linphone_core_internal_notify_received(LinphoneCore *lc, LinphoneEve
if
(
chatRoom
)
{
shared_ptr
<
ClientGroupChatRoom
>
cgcr
;
if
(
chatRoom
->
getCapabilities
()
&
static_cast
<
int
>
(
ChatRoom
::
Capabilities
::
Proxy
)
)
if
(
chatRoom
->
getCapabilities
()
&
ChatRoom
::
Capabilities
::
Proxy
)
cgcr
=
static_pointer_cast
<
ClientGroupChatRoom
>
(
static_pointer_cast
<
ClientGroupToBasicChatRoom
>
(
chatRoom
)
->
getProxiedChatRoom
());
else
...
...
include/linphone/api/c-callbacks.h
View file @
1cf7027e
...
...
@@ -234,6 +234,21 @@ typedef void (*LinphoneChatRoomCbsParticipantDeviceRemovedCb) (LinphoneChatRoom
*/
typedef
void
(
*
LinphoneChatRoomCbsConferenceAddressGenerationCb
)
(
LinphoneChatRoom
*
cr
);
/**
* Callback used when a group chat room server is adding participant to fetch all device information from participant.
* @param[in] cr #LinphoneChatRoom object
* @param[in] participantAddr #LinphoneAddress object
*/
typedef
void
(
*
LinphoneChatRoomCbsParticipantDeviceFetchedCb
)
(
LinphoneChatRoom
*
cr
,
const
LinphoneAddress
*
participantAddr
);
/**
* Callback used when a group chat room server is checking participants capabilities.
* @param[in] cr #LinphoneChatRoom object
* @param[in] deviceAddr #LinphoneAddress object
* @param[in] participantsAddr \bctbx_list{LinphoneAddress}
*/
typedef
void
(
*
LinphoneChatRoomCbsParticipantsCapabilitiesCheckedCb
)
(
LinphoneChatRoom
*
cr
,
const
LinphoneAddress
*
deviceAddr
,
const
bctbx_list_t
*
participantsAddr
);
/**
* @}
**/
...
...
include/linphone/api/c-chat-room-cbs.h
View file @
1cf7027e
...
...
@@ -243,6 +243,34 @@ LINPHONE_PUBLIC LinphoneChatRoomCbsConferenceAddressGenerationCb linphone_chat_r
*/
LINPHONE_PUBLIC
void
linphone_chat_room_cbs_set_conference_address_generation
(
LinphoneChatRoomCbs
*
cbs
,
LinphoneChatRoomCbsConferenceAddressGenerationCb
cb
);
/**
* Get the participant device getting callback.
* @param[in] cbs LinphoneChatRoomCbs object
* @return The participant device getting callback
*/
LINPHONE_PUBLIC
LinphoneChatRoomCbsParticipantDeviceFetchedCb
linphone_chat_room_cbs_get_participant_device_fetched
(
const
LinphoneChatRoomCbs
*
cbs
);
/**
* Set the participant device getting callback.
* @param[in] cbs LinphoneChatRoomCbs object
* @param[in] cb The participant device getting callback to be used
*/
LINPHONE_PUBLIC
void
linphone_chat_room_cbs_set_participant_device_fetched
(
LinphoneChatRoomCbs
*
cbs
,
LinphoneChatRoomCbsParticipantDeviceFetchedCb
cb
);
/**
* Get the participants capabilities callback.
* @param[in] cbs LinphoneChatRoomCbs object
* @return The participants capabilities getting callback
*/
LINPHONE_PUBLIC
LinphoneChatRoomCbsParticipantsCapabilitiesCheckedCb
linphone_chat_room_cbs_get_participants_capabilities_checked
(
const
LinphoneChatRoomCbs
*
cbs
);
/**
* Set the participants capabilities callback.
* @param[in] cbs LinphoneChatRoomCbs object
* @param[in] cb The participants capabilities callback to be used
*/
LINPHONE_PUBLIC
void
linphone_chat_room_cbs_set_participants_capabilities_checked
(
LinphoneChatRoomCbs
*
cbs
,
LinphoneChatRoomCbsParticipantsCapabilitiesCheckedCb
cb
);
/**
* @}
*/
...
...
include/linphone/api/c-chat-room.h
View file @
1cf7027e
...
...
@@ -317,7 +317,7 @@ LINPHONE_PUBLIC LinphoneParticipant *linphone_chat_room_find_participant (const
* @param[in] cr A LinphoneChatRoom object
* @return The capabilities of the chat room
*/
LINPHONE_PUBLIC
LinphoneChatRoomCapabilities
linphone_chat_room_get_capabilities
(
const
LinphoneChatRoom
*
cr
);
LINPHONE_PUBLIC
LinphoneChatRoomCapabilities
Mask
linphone_chat_room_get_capabilities
(
const
LinphoneChatRoom
*
cr
);
/**
* Get the conference address of the chat room.
...
...
@@ -404,6 +404,24 @@ LINPHONE_PUBLIC const bctbx_list_t * linphone_chat_room_get_composing_addresses(
*/
LINPHONE_PUBLIC
void
linphone_chat_room_set_conference_address
(
LinphoneChatRoom
*
cr
,
const
LinphoneAddress
*
confAddr
);
/**
* Set the participant device. This function needs to be called from the
* LinphoneChatRoomCbsParticipantDeviceFetchedCb callback and only there.
* @param[in] cr A LinphoneChatRoom object
* @param[in] partAddr The participant address
* @param[in] partDevices \bctbx_list{LinphoneAddress} list of the participant devices to be used by the group chat room
*/
LINPHONE_PUBLIC
void
linphone_chat_room_set_participant_devices
(
LinphoneChatRoom
*
cr
,
const
LinphoneAddress
*
partAddr
,
const
bctbx_list_t
*
partDevices
);
/**
* Set the participant device. This function needs to be called from the
* LinphoneChatRoomCbsParticipantsCapabilitiesCheckedCb callback and only there.
* @param[in] cr A LinphoneChatRoom object
* @param[in] deviceAddr The device address
* @param[in] participantsCompatible \bctbx_list{LinphoneAddress}
*/
LINPHONE_PUBLIC
void
linphone_chat_room_add_compatible_participants
(
LinphoneChatRoom
*
cr
,
const
LinphoneAddress
*
deviceAddr
,
const
bctbx_list_t
*
participantsCompatible
);
/**
* Returns back pointer to #LinphoneCore object.
* @deprecated use linphone_chat_room_get_core()
...
...
include/linphone/api/c-types.h
View file @
1cf7027e
...
...
@@ -117,6 +117,12 @@ typedef struct _LinphoneChatMessageCbs LinphoneChatMessageCbs;
*/
typedef
struct
_LinphoneChatRoom
LinphoneChatRoom
;
/**
* A mask of LinphoneChatRoomCapabilities
* @ingroup chatroom
*/
typedef
int
LinphoneChatRoomCapabilitiesMask
;
/**
* An object to handle the callbacks for the handling a LinphoneChatRoom objects.
* @ingroup chatroom
...
...
src/c-wrapper/api/c-chat-room-cbs.cpp
View file @
1cf7027e
...
...
@@ -39,6 +39,8 @@ struct _LinphoneChatRoomCbs {
LinphoneChatRoomCbsChatMessageReceivedCb
chatMessageReceivedCb
;
LinphoneChatRoomCbsChatMessageSentCb
chatMessageSentCb
;
LinphoneChatRoomCbsConferenceAddressGenerationCb
conferenceAddressGenerationCb
;
LinphoneChatRoomCbsParticipantDeviceFetchedCb
participantDeviceFetchedCb
;
LinphoneChatRoomCbsParticipantsCapabilitiesCheckedCb
participantsCapabilitiesChecked
;
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT
(
LinphoneChatRoomCbs
);
...
...
@@ -178,3 +180,19 @@ LinphoneChatRoomCbsConferenceAddressGenerationCb linphone_chat_room_cbs_get_conf
void
linphone_chat_room_cbs_set_conference_address_generation
(
LinphoneChatRoomCbs
*
cbs
,
LinphoneChatRoomCbsConferenceAddressGenerationCb
cb
)
{
cbs
->
conferenceAddressGenerationCb
=
cb
;
}
LinphoneChatRoomCbsParticipantDeviceFetchedCb
linphone_chat_room_cbs_get_participant_device_fetched
(
const
LinphoneChatRoomCbs
*
cbs
)
{
return
cbs
->
participantDeviceFetchedCb
;
}
void
linphone_chat_room_cbs_set_participant_device_fetched
(
LinphoneChatRoomCbs
*
cbs
,
LinphoneChatRoomCbsParticipantDeviceFetchedCb
cb
)
{
cbs
->
participantDeviceFetchedCb
=
cb
;
}
LinphoneChatRoomCbsParticipantsCapabilitiesCheckedCb
linphone_chat_room_cbs_get_participants_capabilities_checked
(
const
LinphoneChatRoomCbs
*
cbs
)
{
return
cbs
->
participantsCapabilitiesChecked
;
}
void
linphone_chat_room_cbs_set_participants_capabilities_checked
(
LinphoneChatRoomCbs
*
cbs
,
LinphoneChatRoomCbsParticipantsCapabilitiesCheckedCb
cb
)
{
cbs
->
participantsCapabilitiesChecked
=
cb
;
}
src/c-wrapper/api/c-chat-room.cpp
View file @
1cf7027e
...
...
@@ -70,6 +70,13 @@ static void _linphone_chat_room_destructor (LinphoneChatRoom *cr) {
bctbx_list_free_with_data
(
cr
->
composingAddresses
,
(
bctbx_list_free_func
)
linphone_address_unref
);
}
static
list
<
LinphonePrivate
::
IdentityAddress
>
_get_identity_address_list_from_address_list
(
list
<
LinphonePrivate
::
Address
>
addressList
)
{
list
<
LinphonePrivate
::
IdentityAddress
>
lIdent
;
for
(
const
auto
&
addr
:
addressList
)
lIdent
.
push_back
(
LinphonePrivate
::
IdentityAddress
(
addr
));
return
lIdent
;
}
// =============================================================================
// Public functions.
// =============================================================================
...
...
@@ -265,8 +272,8 @@ LinphoneParticipant *linphone_chat_room_find_participant (const LinphoneChatRoom
));
}
LinphoneChatRoomCapabilities
linphone_chat_room_get_capabilities
(
const
LinphoneChatRoom
*
cr
)
{
return
(
LinphoneChatRoomCapabilities
)
L_GET_CPP_PTR_FROM_C_OBJECT
(
cr
)
->
getCapabilities
();
LinphoneChatRoomCapabilities
Mask
linphone_chat_room_get_capabilities
(
const
LinphoneChatRoom
*
cr
)
{
return
L_GET_CPP_PTR_FROM_C_OBJECT
(
cr
)
->
getCapabilities
();
}
const
LinphoneAddress
*
linphone_chat_room_get_conference_address
(
const
LinphoneChatRoom
*
cr
)
{
...
...
@@ -350,6 +357,30 @@ void linphone_chat_room_set_conference_address (LinphoneChatRoom *cr, const Linp
bctbx_free
(
addrStr
);
}
void
linphone_chat_room_set_participant_devices
(
LinphoneChatRoom
*
cr
,
const
LinphoneAddress
*
partAddr
,
const
bctbx_list_t
*
partDevices
)
{
char
*
addrStr
=
linphone_address_as_string
(
partAddr
);
list
<
LinphonePrivate
::
Address
>
lDevices
=
L_GET_RESOLVED_CPP_LIST_FROM_C_LIST
(
partDevices
,
Address
);
list
<
LinphonePrivate
::
IdentityAddress
>
lIdentAddr
;
for
(
const
auto
&
addr
:
lDevices
)
lIdentAddr
.
push_back
(
LinphonePrivate
::
IdentityAddress
(
addr
));
LinphonePrivate
::
ServerGroupChatRoomPrivate
*
sgcr
=
dynamic_cast
<
LinphonePrivate
::
ServerGroupChatRoomPrivate
*>
(
L_GET_PRIVATE_FROM_C_OBJECT
(
cr
));
if
(
sgcr
)
sgcr
->
setParticipantDevices
(
LinphonePrivate
::
IdentityAddress
(
addrStr
),
lIdentAddr
);
bctbx_free
(
addrStr
);
}
void
linphone_chat_room_add_compatible_participants
(
LinphoneChatRoom
*
cr
,
const
LinphoneAddress
*
deviceAddr
,
const
bctbx_list_t
*
participantsCompatible
)
{
list
<
LinphonePrivate
::
Address
>
lPartsComp
=
L_GET_RESOLVED_CPP_LIST_FROM_C_LIST
(
participantsCompatible
,
Address
);
LinphonePrivate
::
ServerGroupChatRoomPrivate
*
sgcr
=
dynamic_cast
<
LinphonePrivate
::
ServerGroupChatRoomPrivate
*>
(
L_GET_PRIVATE_FROM_C_OBJECT
(
cr
));
if
(
sgcr
)
{
char
*
deviceAddrStr
=
linphone_address_as_string_uri_only
(
deviceAddr
);
sgcr
->
addCompatibleParticipants
(
LinphonePrivate
::
IdentityAddress
(
deviceAddrStr
),
_get_identity_address_list_from_address_list
(
lPartsComp
)
);
bctbx_free
(
deviceAddrStr
);
}
}
// =============================================================================
// Reference and user data handling functions.
// =============================================================================
...
...
src/chat/chat-room/client-group-to-basic-chat-room.cpp
View file @
1cf7027e
...
...
@@ -46,7 +46,7 @@ public:
}
void
onCallSessionSetReleased
(
const
std
::
shared_ptr
<
const
CallSession
>
&
session
)
override
{
if
(
!
(
chatRoom
->
getCapabilities
()
&
static_cast
<
int
>
(
ChatRoom
::
Capabilities
::
Conference
))
)
if
(
!
(
chatRoom
->
getCapabilities
()
&
ChatRoom
::
Capabilities
::
Conference
))
return
;
static_pointer_cast
<
ClientGroupChatRoom
>
(
chatRoom
)
->
getPrivate
()
->
onCallSessionSetReleased
(
session
);
}
...
...
src/chat/chat-room/proxy-chat-room.cpp
View file @
1cf7027e
...
...
@@ -68,7 +68,7 @@ time_t ProxyChatRoom::getLastUpdateTime () const {
ProxyChatRoom
::
CapabilitiesMask
ProxyChatRoom
::
getCapabilities
()
const
{
L_D
();
return
d
->
chatRoom
->
getCapabilities
()
|
static_cast
<
int
>
(
ProxyChatRoom
::
Capabilities
::
Proxy
)
;
return
d
->
chatRoom
->
getCapabilities
()
|
ProxyChatRoom
::
Capabilities
::
Proxy
;
}
ProxyChatRoom
::
State
ProxyChatRoom
::
getState
()
const
{
...
...
src/chat/chat-room/server-group-chat-room-p.h
View file @
1cf7027e
...
...
@@ -46,6 +46,7 @@ public:
void
setConferenceAddress
(
const
IdentityAddress
&
conferenceAddress
);
void
setParticipantDevices
(
const
IdentityAddress
&
addr
,
const
std
::
list
<
IdentityAddress
>
&
devices
);
void
addCompatibleParticipants
(
const
IdentityAddress
&
deviceAddr
,
const
std
::
list
<
IdentityAddress
>
&
participantCompatible
);
LinphoneReason
onSipMessageReceived
(
SalOp
*
op
,
const
SalMessage
*
message
)
override
;
...
...
src/chat/chat-room/server-group-chat-room-stub.cpp
View file @
1cf7027e
...
...
@@ -64,6 +64,8 @@ void ServerGroupChatRoomPrivate::setConferenceAddress (const IdentityAddress &)
void
ServerGroupChatRoomPrivate
::
setParticipantDevices
(
const
IdentityAddress
&
addr
,
const
list
<
IdentityAddress
>
&
devices
)
{}
void
ServerGroupChatRoomPrivate
::
addCompatibleParticipants
(
const
IdentityAddress
&
deviceAddr
,
const
list
<
IdentityAddress
>
&
participantCompatible
)
{}
// -----------------------------------------------------------------------------
LinphoneReason
ServerGroupChatRoomPrivate
::
onSipMessageReceived
(
SalOp
*
,
const
SalMessage
*
)
{
...
...
@@ -82,6 +84,14 @@ bool ServerGroupChatRoomPrivate::isAdminLeft () const {
// -----------------------------------------------------------------------------
void
ServerGroupChatRoomPrivate
::
onChatRoomInsertRequested
(
const
shared_ptr
<
AbstractChatRoom
>
&
chatRoom
)
{}
void
ServerGroupChatRoomPrivate
::
onChatRoomInsertInDatabaseRequested
(
const
shared_ptr
<
AbstractChatRoom
>
&
chatRoom
)
{}
void
ServerGroupChatRoomPrivate
::
onChatRoomDeleteRequested
(
const
shared_ptr
<
AbstractChatRoom
>
&
chatRoom
)
{}
// -----------------------------------------------------------------------------
void
ServerGroupChatRoomPrivate
::
onCallSessionStateChanged
(
const
shared_ptr
<
const
CallSession
>
&
,
LinphoneCallState
,
...
...
tester/group_chat_tester.c
View file @
1cf7027e
This diff is collapsed.
Click to expand it.
tester/liblinphone_tester.h
View file @
1cf7027e
...
...
@@ -319,6 +319,8 @@ void liblinphone_tester_add_suites(void);
void
linphone_core_manager_init
(
LinphoneCoreManager
*
mgr
,
const
char
*
rc_file
,
const
char
*
phone_alias
);
void
linphone_core_manager_start
(
LinphoneCoreManager
*
mgr
,
int
check_for_proxies
);
LinphoneCoreManager
*
linphone_core_manager_create2
(
const
char
*
rc_file
,
const
char
*
phone_alias
);
LinphoneCoreManager
*
linphone_core_manager_create
(
const
char
*
rc_file
);
LinphoneCoreManager
*
linphone_core_manager_new3
(
const
char
*
rc_file
,
int
check_for_proxies
,
const
char
*
phone_alias
);
LinphoneCoreManager
*
linphone_core_manager_new2
(
const
char
*
rc_file
,
int
check_for_proxies
);
LinphoneCoreManager
*
linphone_core_manager_new
(
const
char
*
rc_file
);
...
...
tester/tester.c
View file @
1cf7027e
...
...
@@ -426,10 +426,18 @@ void linphone_core_manager_start(LinphoneCoreManager *mgr, int check_for_proxies
}
LinphoneCoreManager
*
linphone_core_manager_
new3
(
const
char
*
rc_file
,
int
check_for_proxies
,
const
char
*
phone_alias
)
{
LinphoneCoreManager
*
linphone_core_manager_
create2
(
const
char
*
rc_file
,
const
char
*
phone_alias
)
{
LinphoneCoreManager
*
manager
=
ms_new0
(
LinphoneCoreManager
,
1
);
linphone_core_manager_init
(
manager
,
rc_file
,
phone_alias
);
return
manager
;
}
LinphoneCoreManager
*
linphone_core_manager_create
(
const
char
*
rc_file
)
{
return
linphone_core_manager_create2
(
rc_file
,
NULL
);
}
LinphoneCoreManager
*
linphone_core_manager_new3
(
const
char
*
rc_file
,
int
check_for_proxies
,
const
char
*
phone_alias
)
{
LinphoneCoreManager
*
manager
=
linphone_core_manager_create2
(
rc_file
,
phone_alias
);
linphone_core_manager_start
(
manager
,
check_for_proxies
);
return
manager
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment