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
a5ce479a
Commit
a5ce479a
authored
Sep 13, 2017
by
Ghislain MARY
Browse files
Add function to create a client group chat room.
parent
a7b9d99f
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
186 additions
and
173 deletions
+186
-173
coreapi/chat.c
coreapi/chat.c
+11
-1
include/linphone/chat.h
include/linphone/chat.h
+2
-0
src/CMakeLists.txt
src/CMakeLists.txt
+0
-1
src/c-wrapper/c-tools.h
src/c-wrapper/c-tools.h
+12
-2
src/call/call-listener.h
src/call/call-listener.h
+2
-0
src/chat/basic-chat-room.cpp
src/chat/basic-chat-room.cpp
+3
-1
src/chat/chat-room-p.h
src/chat/chat-room-p.h
+1
-1
src/chat/chat-room.cpp
src/chat/chat-room.cpp
+3
-3
src/chat/chat-room.h
src/chat/chat-room.h
+1
-1
src/chat/client-group-chat-room-p.h
src/chat/client-group-chat-room-p.h
+1
-1
src/chat/client-group-chat-room.cpp
src/chat/client-group-chat-room.cpp
+44
-3
src/chat/client-group-chat-room.h
src/chat/client-group-chat-room.h
+5
-3
src/chat/is-composing-listener.h
src/chat/is-composing-listener.h
+2
-0
src/chat/real-time-text-chat-room.cpp
src/chat/real-time-text-chat-room.cpp
+3
-1
src/conference/conference-interface.h
src/conference/conference-interface.h
+2
-0
src/conference/conference-p.h
src/conference/conference-p.h
+0
-70
src/conference/conference.cpp
src/conference/conference.cpp
+59
-68
src/conference/conference.h
src/conference/conference.h
+34
-5
src/conference/local-conference.cpp
src/conference/local-conference.cpp
+1
-9
src/conference/local-conference.h
src/conference/local-conference.h
+0
-3
No files found.
coreapi/chat.c
View file @
a5ce479a
...
...
@@ -37,8 +37,9 @@
#include "c-wrapper/c-tools.h"
#include "chat/basic-chat-room.h"
#include "chat/
real-time-text
-chat-room
-p
.h"
#include "chat/
client-group
-chat-room.h"
#include "chat/real-time-text-chat-room.h"
#include "chat/real-time-text-chat-room-p.h"
#include "content/content-type.h"
struct
_LinphoneChatRoom
{
...
...
@@ -255,6 +256,15 @@ LinphoneChatRoom *linphone_core_get_chat_room(LinphoneCore *lc, const LinphoneAd
return
ret
;
}
LinphoneChatRoom
*
linphone_core_create_client_group_chat_room
(
LinphoneCore
*
lc
,
bctbx_list_t
*
addresses
)
{
LinphoneChatRoom
*
cr
=
belle_sip_object_new
(
LinphoneChatRoom
);
std
::
list
<
LinphonePrivate
::
Address
>
l
=
L_GET_CPP_LIST_OF_CPP_OBJ_FROM_C_LIST_OF_STRUCT_PTR
(
addresses
,
Address
);
LinphonePrivate
::
Address
me
;
// TODO
cr
->
cr
=
new
LinphonePrivate
::
ClientGroupChatRoom
(
lc
,
me
,
l
);
L_GET_PRIVATE
(
cr
->
cr
)
->
setCBackPointer
(
cr
);
return
cr
;
}
void
linphone_core_delete_chat_room
(
LinphoneCore
*
lc
,
LinphoneChatRoom
*
cr
)
{
if
(
bctbx_list_find
(
lc
->
chatrooms
,
cr
))
{
lc
->
chatrooms
=
bctbx_list_remove
(
lc
->
chatrooms
,
cr
);
...
...
include/linphone/chat.h
View file @
a5ce479a
...
...
@@ -457,6 +457,8 @@ LINPHONE_PUBLIC void linphone_chat_message_set_user_data(LinphoneChatMessage* me
**/
LINPHONE_PUBLIC
LinphoneChatRoom
*
linphone_chat_message_get_chat_room
(
LinphoneChatMessage
*
msg
);
LINPHONE_PUBLIC
LinphoneChatRoom
*
linphone_core_create_client_group_chat_room
(
LinphoneCore
*
lc
,
bctbx_list_t
*
addresses
);
LINPHONE_PUBLIC
const
LinphoneAddress
*
linphone_chat_message_get_peer_address
(
LinphoneChatMessage
*
msg
);
/**
...
...
src/CMakeLists.txt
View file @
a5ce479a
...
...
@@ -52,7 +52,6 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
chat/real-time-text-chat-room-p.h
chat/real-time-text-chat-room.h
conference/conference-listener.h
conference/conference-p.h
conference/conference.h
conference/local-conference.h
conference/params/call-session-params-p.h
...
...
src/c-wrapper/c-tools.h
View file @
a5ce479a
...
...
@@ -116,8 +116,8 @@ public:
template
<
typename
T
>
static
inline
bctbx_list_t
*
getCListFromCppList
(
std
::
list
<
T
>
cppList
)
{
bctbx_list_t
*
result
=
nullptr
;
for
(
auto
it
=
cppList
.
begin
();
it
!=
cppList
.
end
();
it
++
)
result
=
bctbx_list_append
(
result
,
*
it
);
for
(
const
auto
&
value
:
cppList
)
result
=
bctbx_list_append
(
result
,
value
);
return
result
;
}
...
...
@@ -129,6 +129,14 @@ public:
return
result
;
}
template
<
typename
T
,
typename
U
>
static
inline
std
::
list
<
T
>
getCppListOfCppObjFromCListOfStructPtr
(
bctbx_list_t
*
cList
)
{
std
::
list
<
T
>
result
;
for
(
auto
it
=
cList
;
it
;
it
=
bctbx_list_next
(
it
))
result
.
push_back
(
*
getCppPtrFromC
<
T
>
(
reinterpret_cast
<
U
*>
(
bctbx_list_get_data
(
it
))));
return
result
;
}
private:
Wrapper
();
...
...
@@ -217,5 +225,7 @@ LINPHONE_END_NAMESPACE
LINPHONE_NAMESPACE::Wrapper::getCListFromCppList<TYPE *>(LIST)
#define L_GET_CPP_LIST_FROM_C_LIST(LIST, TYPE) \
LINPHONE_NAMESPACE::Wrapper::getCppListFromCList<TYPE *>(LIST)
#define L_GET_CPP_LIST_OF_CPP_OBJ_FROM_C_LIST_OF_STRUCT_PTR(LIST, TYPE) \
LINPHONE_NAMESPACE::Wrapper::getCppListOfCppObjFromCListOfStructPtr<LINPHONE_NAMESPACE::TYPE, Linphone ## TYPE>(LIST)
#endif // ifndef _C_TOOLS_H_
src/call/call-listener.h
View file @
a5ce479a
...
...
@@ -27,6 +27,8 @@ LINPHONE_BEGIN_NAMESPACE
class
CallListener
{
public:
virtual
~
CallListener
()
=
default
;
virtual
void
onAckBeingSent
(
LinphoneHeaders
*
headers
)
=
0
;
virtual
void
onAckReceived
(
LinphoneHeaders
*
headers
)
=
0
;
virtual
void
onCallSetReleased
()
=
0
;
...
...
src/chat/basic-chat-room.cpp
View file @
a5ce479a
...
...
@@ -25,7 +25,9 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
BasicChatRoomPrivate
::
BasicChatRoomPrivate
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
)
:
ChatRoomPrivate
(
core
,
peerAddress
)
{}
BasicChatRoomPrivate
::
BasicChatRoomPrivate
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
)
:
ChatRoomPrivate
(
core
)
{
this
->
peerAddress
=
peerAddress
;
}
// =============================================================================
...
...
src/chat/chat-room-p.h
View file @
a5ce479a
...
...
@@ -33,7 +33,7 @@ LINPHONE_BEGIN_NAMESPACE
class
ChatRoomPrivate
:
public
ObjectPrivate
,
public
IsComposingListener
{
public:
ChatRoomPrivate
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
);
ChatRoomPrivate
(
LinphoneCore
*
core
);
virtual
~
ChatRoomPrivate
();
private:
...
...
src/chat/chat-room.cpp
View file @
a5ce479a
...
...
@@ -34,8 +34,8 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
ChatRoomPrivate
::
ChatRoomPrivate
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
)
:
core
(
core
),
peerAddress
(
peerAddress
),
isComposingHandler
(
core
,
this
)
{}
ChatRoomPrivate
::
ChatRoomPrivate
(
LinphoneCore
*
core
)
:
core
(
core
),
isComposingHandler
(
core
,
this
)
{}
ChatRoomPrivate
::~
ChatRoomPrivate
()
{
for
(
auto
it
=
transientMessages
.
begin
();
it
!=
transientMessages
.
end
();
it
++
)
{
...
...
@@ -538,7 +538,7 @@ void ChatRoomPrivate::onIsComposingRefreshNeeded () {
// =============================================================================
ChatRoom
::
ChatRoom
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
)
:
Object
(
*
new
ChatRoomPrivate
(
core
,
peerAddress
))
{}
ChatRoom
::
ChatRoom
(
LinphoneCore
*
core
)
:
Object
(
*
new
ChatRoomPrivate
(
core
))
{}
ChatRoom
::
ChatRoom
(
ChatRoomPrivate
&
p
)
:
Object
(
p
)
{}
...
...
src/chat/chat-room.h
View file @
a5ce479a
...
...
@@ -38,7 +38,7 @@ class ChatRoomPrivate;
class
ChatRoom
:
public
Object
,
public
ConferenceInterface
{
public:
ChatRoom
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
);
ChatRoom
(
LinphoneCore
*
core
);
virtual
~
ChatRoom
()
=
default
;
void
compose
();
...
...
src/chat/client-group-chat-room-p.h
View file @
a5ce479a
...
...
@@ -31,7 +31,7 @@ LINPHONE_BEGIN_NAMESPACE
class
ClientGroupChatRoomPrivate
:
public
ChatRoomPrivate
{
public:
ClientGroupChatRoomPrivate
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
);
ClientGroupChatRoomPrivate
(
LinphoneCore
*
core
);
virtual
~
ClientGroupChatRoomPrivate
()
=
default
;
private:
...
...
src/chat/client-group-chat-room.cpp
View file @
a5ce479a
...
...
@@ -17,14 +17,55 @@
*/
#include "client-group-chat-room-p.h"
#include "conference/participant-p.h"
#include "logger/logger.h"
// =============================================================================
using
namespace
std
;
LINPHONE_BEGIN_NAMESPACE
ClientGroupChatRoomPrivate
::
ClientGroupChatRoomPrivate
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
)
:
ChatRoomPrivate
(
core
,
peerAddress
)
{}
// =============================================================================
ClientGroupChatRoomPrivate
::
ClientGroupChatRoomPrivate
(
LinphoneCore
*
core
)
:
ChatRoomPrivate
(
core
)
{}
// =============================================================================
ClientGroupChatRoom
::
ClientGroupChatRoom
(
LinphoneCore
*
core
,
const
Address
&
me
,
std
::
list
<
Address
>
&
addresses
)
:
ChatRoom
(
*
new
ChatRoomPrivate
(
core
)),
RemoteConference
(
core
,
me
,
nullptr
)
{
// TODO
}
// -----------------------------------------------------------------------------
shared_ptr
<
Participant
>
ClientGroupChatRoom
::
addParticipant
(
const
Address
&
addr
,
const
shared_ptr
<
CallSessionParams
>
params
,
bool
hasMedia
)
{
activeParticipant
=
make_shared
<
Participant
>
(
addr
);
activeParticipant
->
getPrivate
()
->
createSession
(
*
this
,
params
,
hasMedia
,
this
);
return
activeParticipant
;
}
void
ClientGroupChatRoom
::
addParticipants
(
const
list
<
Address
>
&
addresses
,
const
shared_ptr
<
CallSessionParams
>
params
,
bool
hasMedia
)
{
// TODO
}
const
string
&
ClientGroupChatRoom
::
getId
()
const
{
return
id
;
}
int
ClientGroupChatRoom
::
getNbParticipants
()
const
{
// TODO
return
1
;
}
list
<
shared_ptr
<
Participant
>>
ClientGroupChatRoom
::
getParticipants
()
const
{
return
participants
;
}
void
ClientGroupChatRoom
::
removeParticipant
(
const
shared_ptr
<
Participant
>
participant
)
{
// TODO
}
void
ClientGroupChatRoom
::
removeParticipants
(
const
list
<
shared_ptr
<
Participant
>>
participants
)
{
// TODO
}
LINPHONE_END_NAMESPACE
src/chat/client-group-chat-room.h
View file @
a5ce479a
...
...
@@ -23,6 +23,7 @@
#include "private.h"
#include "chat/chat-room.h"
#include "conference/remote-conference.h"
#include "linphone/types.h"
...
...
@@ -32,11 +33,12 @@ LINPHONE_BEGIN_NAMESPACE
class
ClientGroupChatRoomPrivate
;
class
ClientGroupChatRoom
:
public
ChatRoom
{
class
ClientGroupChatRoom
:
public
ChatRoom
,
public
RemoteConference
{
public:
ClientGroupChatRoom
(
LinphoneCore
*
core
,
const
Address
&
peerAddres
s
);
ClientGroupChatRoom
(
LinphoneCore
*
core
,
const
Address
&
me
,
std
::
list
<
Address
>
&
addresse
s
);
virtual
~
ClientGroupChatRoom
()
=
default
;
public:
/* ConferenceInterface */
std
::
shared_ptr
<
Participant
>
addParticipant
(
const
Address
&
addr
,
const
std
::
shared_ptr
<
CallSessionParams
>
params
,
bool
hasMedia
);
void
addParticipants
(
const
std
::
list
<
Address
>
&
addresses
,
const
std
::
shared_ptr
<
CallSessionParams
>
params
,
bool
hasMedia
);
...
...
@@ -44,7 +46,7 @@ public:
int
getNbParticipants
()
const
;
std
::
list
<
std
::
shared_ptr
<
Participant
>>
getParticipants
()
const
;
void
removeParticipant
(
const
std
::
shared_ptr
<
Participant
>
participant
);
void
removeParticipants
(
const
std
::
list
<
const
std
::
shared_ptr
<
Participant
>>
participants
);
void
removeParticipants
(
const
std
::
list
<
std
::
shared_ptr
<
Participant
>>
participants
);
private:
L_DECLARE_PRIVATE
(
ClientGroupChatRoom
);
...
...
src/chat/is-composing-listener.h
View file @
a5ce479a
...
...
@@ -27,6 +27,8 @@ LINPHONE_BEGIN_NAMESPACE
class
IsComposingListener
{
public:
virtual
~
IsComposingListener
()
=
default
;
virtual
void
onIsComposingStateChanged
(
bool
isComposing
)
=
0
;
virtual
void
onIsRemoteComposingStateChanged
(
bool
isComposing
)
=
0
;
virtual
void
onIsComposingRefreshNeeded
()
=
0
;
...
...
src/chat/real-time-text-chat-room.cpp
View file @
a5ce479a
...
...
@@ -30,7 +30,9 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
RealTimeTextChatRoomPrivate
::
RealTimeTextChatRoomPrivate
(
LinphoneCore
*
core
,
const
Address
&
peerAddress
)
:
ChatRoomPrivate
(
core
,
peerAddress
)
{}
:
ChatRoomPrivate
(
core
)
{
this
->
peerAddress
=
peerAddress
;
}
RealTimeTextChatRoomPrivate
::~
RealTimeTextChatRoomPrivate
()
{
if
(
!
receivedRttCharacters
.
empty
())
{
...
...
src/conference/conference-interface.h
View file @
a5ce479a
...
...
@@ -32,6 +32,8 @@ LINPHONE_BEGIN_NAMESPACE
class
ConferenceInterface
{
public:
virtual
~
ConferenceInterface
()
=
default
;
virtual
std
::
shared_ptr
<
Participant
>
addParticipant
(
const
Address
&
addr
,
const
std
::
shared_ptr
<
CallSessionParams
>
params
,
bool
hasMedia
)
=
0
;
virtual
void
addParticipants
(
const
std
::
list
<
Address
>
&
addresses
,
const
std
::
shared_ptr
<
CallSessionParams
>
params
,
bool
hasMedia
)
=
0
;
virtual
const
std
::
string
&
getId
()
const
=
0
;
...
...
src/conference/conference-p.h
deleted
100644 → 0
View file @
a7b9d99f
/*
* conference-p.h
* Copyright (C) 2017 Belledonne Communications SARL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _CONFERENCE_P_H_
#define _CONFERENCE_P_H_
#include <memory>
#include "object/object-p.h"
#include "conference/conference.h"
#include "conference/participant.h"
#include "conference/session/call-session-listener.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class
ConferencePrivate
:
public
ObjectPrivate
,
CallSessionListener
{
public:
virtual
~
ConferencePrivate
()
=
default
;
LinphoneCore
*
getCore
()
const
{
return
core
;
}
private:
/* CallSessionListener */
virtual
void
onAckBeingSent
(
const
CallSession
&
session
,
LinphoneHeaders
*
headers
);
virtual
void
onAckReceived
(
const
CallSession
&
session
,
LinphoneHeaders
*
headers
);
virtual
void
onCallSessionAccepted
(
const
CallSession
&
session
);
virtual
void
onCallSessionSetReleased
(
const
CallSession
&
session
);
virtual
void
onCallSessionSetTerminated
(
const
CallSession
&
session
);
virtual
void
onCallSessionStateChanged
(
const
CallSession
&
session
,
LinphoneCallState
state
,
const
std
::
string
&
message
);
virtual
void
onIncomingCallSessionStarted
(
const
CallSession
&
session
);
virtual
void
onEncryptionChanged
(
const
CallSession
&
session
,
bool
activated
,
const
std
::
string
&
authToken
);
virtual
void
onStatsUpdated
(
const
LinphoneCallStats
*
stats
);
virtual
void
onResetCurrentSession
(
const
CallSession
&
session
);
virtual
void
onSetCurrentSession
(
const
CallSession
&
session
);
virtual
void
onFirstVideoFrameDecoded
(
const
CallSession
&
session
);
virtual
void
onResetFirstVideoFrameDecoded
(
const
CallSession
&
session
);
private:
LinphoneCore
*
core
=
nullptr
;
CallListener
*
callListener
=
nullptr
;
std
::
shared_ptr
<
Participant
>
activeParticipant
=
nullptr
;
std
::
string
id
;
std
::
shared_ptr
<
Participant
>
me
=
nullptr
;
std
::
list
<
std
::
shared_ptr
<
Participant
>>
participants
;
L_DECLARE_PUBLIC
(
Conference
);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _CONFERENCE_P_H_
src/conference/conference.cpp
View file @
a5ce479a
...
...
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "conference-p.h"
#include "participant-p.h"
#include "conference.h"
...
...
@@ -27,123 +26,115 @@ LINPHONE_BEGIN_NAMESPACE
// =============================================================================
void
ConferencePrivate
::
onAckBeingSent
(
const
CallSession
&
session
,
LinphoneHeaders
*
headers
)
{
Conference
::
Conference
(
LinphoneCore
*
core
,
const
Address
&
myAddress
,
CallListener
*
listener
)
:
core
(
core
),
callListener
(
listener
)
{
me
=
make_shared
<
Participant
>
(
myAddress
);
}
// -----------------------------------------------------------------------------
shared_ptr
<
Participant
>
Conference
::
getActiveParticipant
()
const
{
return
activeParticipant
;
}
// -----------------------------------------------------------------------------
shared_ptr
<
Participant
>
Conference
::
addParticipant
(
const
Address
&
addr
,
const
shared_ptr
<
CallSessionParams
>
params
,
bool
hasMedia
)
{
activeParticipant
=
make_shared
<
Participant
>
(
addr
);
activeParticipant
->
getPrivate
()
->
createSession
(
*
this
,
params
,
hasMedia
,
this
);
return
activeParticipant
;
}
void
Conference
::
addParticipants
(
const
list
<
Address
>
&
addresses
,
const
shared_ptr
<
CallSessionParams
>
params
,
bool
hasMedia
)
{
// TODO
}
const
string
&
Conference
::
getId
()
const
{
return
id
;
}
int
Conference
::
getNbParticipants
()
const
{
// TODO
return
1
;
}
list
<
shared_ptr
<
Participant
>>
Conference
::
getParticipants
()
const
{
return
participants
;
}
void
Conference
::
removeParticipant
(
const
shared_ptr
<
Participant
>
participant
)
{
// TODO
}
void
Conference
::
removeParticipants
(
const
list
<
shared_ptr
<
Participant
>>
participants
)
{
// TODO
}
// -----------------------------------------------------------------------------
void
Conference
::
onAckBeingSent
(
const
CallSession
&
session
,
LinphoneHeaders
*
headers
)
{
if
(
callListener
)
callListener
->
onAckBeingSent
(
headers
);
}
void
Conference
Private
::
onAckReceived
(
const
CallSession
&
session
,
LinphoneHeaders
*
headers
)
{
void
Conference
::
onAckReceived
(
const
CallSession
&
session
,
LinphoneHeaders
*
headers
)
{
if
(
callListener
)
callListener
->
onAckReceived
(
headers
);
}
void
Conference
Private
::
onCallSessionAccepted
(
const
CallSession
&
session
)
{
void
Conference
::
onCallSessionAccepted
(
const
CallSession
&
session
)
{
if
(
callListener
)
callListener
->
onIncomingCallToBeAdded
();
}
void
Conference
Private
::
onCallSessionSetReleased
(
const
CallSession
&
session
)
{
void
Conference
::
onCallSessionSetReleased
(
const
CallSession
&
session
)
{
if
(
callListener
)
callListener
->
onCallSetReleased
();
}
void
Conference
Private
::
onCallSessionSetTerminated
(
const
CallSession
&
session
)
{
void
Conference
::
onCallSessionSetTerminated
(
const
CallSession
&
session
)
{
if
(
callListener
)
callListener
->
onCallSetTerminated
();
}
void
Conference
Private
::
onCallSessionStateChanged
(
const
CallSession
&
session
,
LinphoneCallState
state
,
const
string
&
message
)
{
void
Conference
::
onCallSessionStateChanged
(
const
CallSession
&
session
,
LinphoneCallState
state
,
const
string
&
message
)
{
if
(
callListener
)
callListener
->
onCallStateChanged
(
state
,
message
);
}
void
Conference
Private
::
onIncomingCallSessionStarted
(
const
CallSession
&
session
)
{
void
Conference
::
onIncomingCallSessionStarted
(
const
CallSession
&
session
)
{
if
(
callListener
)
callListener
->
onIncomingCallStarted
();
}
void
Conference
Private
::
onEncryptionChanged
(
const
CallSession
&
session
,
bool
activated
,
const
string
&
authToken
)
{
void
Conference
::
onEncryptionChanged
(
const
CallSession
&
session
,
bool
activated
,
const
string
&
authToken
)
{
if
(
callListener
)
callListener
->
onEncryptionChanged
(
activated
,
authToken
);
}
void
Conference
Private
::
onStatsUpdated
(
const
LinphoneCallStats
*
stats
)
{
void
Conference
::
onStatsUpdated
(
const
LinphoneCallStats
*
stats
)
{
if
(
callListener
)
callListener
->
onStatsUpdated
(
stats
);
}
void
Conference
Private
::
onResetCurrentSession
(
const
CallSession
&
session
)
{
void
Conference
::
onResetCurrentSession
(
const
CallSession
&
session
)
{
if
(
callListener
)
callListener
->
onResetCurrentCall
();
}
void
Conference
Private
::
onSetCurrentSession
(
const
CallSession
&
session
)
{
void
Conference
::
onSetCurrentSession
(
const
CallSession
&
session
)
{
if
(
callListener
)
callListener
->
onSetCurrentCall
();
}
void
Conference
Private
::
onFirstVideoFrameDecoded
(
const
CallSession
&
session
)
{
void
Conference
::
onFirstVideoFrameDecoded
(
const
CallSession
&
session
)
{
if
(
callListener
)
callListener
->
onFirstVideoFrameDecoded
();
}
void
Conference
Private
::
onResetFirstVideoFrameDecoded
(
const
CallSession
&
session
)
{
void
Conference
::
onResetFirstVideoFrameDecoded
(
const
CallSession
&
session
)
{
if
(
callListener
)
callListener
->
onResetFirstVideoFrameDecoded
();
}
// =============================================================================
Conference
::
Conference
(
ConferencePrivate
&
p
,
LinphoneCore
*
core
,
const
Address
&
myAddress
,
CallListener
*
listener
)
:
Object
(
p
)
{
L_D
(
Conference
);
d
->
core
=
core
;
d
->
callListener
=
listener
;
d
->
me
=
make_shared
<
Participant
>
(
myAddress
);
}
shared_ptr
<
Participant
>
Conference
::
addParticipant
(
const
Address
&
addr
,
const
shared_ptr
<
CallSessionParams
>
params
,
bool
hasMedia
)
{
L_D
(
Conference
);
d
->
activeParticipant
=
make_shared
<
Participant
>
(
addr
);
d
->
activeParticipant
->
getPrivate
()
->
createSession
(
*
this
,
params
,
hasMedia
,
d
);
return
d
->
activeParticipant
;
}
void
Conference
::
addParticipants
(
const
list
<
Address
>
&
addresses
,
const
shared_ptr
<
CallSessionParams
>
params
,
bool
hasMedia
)
{
// TODO
}
const
string
&
Conference
::
getId
()
const
{
L_D
(
const
Conference
);
return
d
->
id
;
}
int
Conference
::
getNbParticipants
()
const
{
// TODO
return
1
;
}
list
<
shared_ptr
<
Participant
>>
Conference
::
getParticipants
()
const
{
L_D
(
const
Conference
);
return
d
->
participants
;
}
void
Conference
::
removeParticipant
(
const
shared_ptr
<
Participant
>
participant
)
{
// TODO
}
void
Conference
::
removeParticipants
(
const
list
<
shared_ptr
<
Participant
>>
participants
)
{
// TODO
}
shared_ptr
<
Participant
>
Conference
::
getActiveParticipant
()
const
{
L_D
(
const
Conference
);
return
d
->
activeParticipant
;
}
shared_ptr
<
Participant
>
Conference
::
getMe
()
const
{
L_D
(
const
Conference
);
return
d
->
me
;
}
LINPHONE_END_NAMESPACE
src/conference/conference.h
View file @
a5ce479a
...
...
@@ -27,6 +27,7 @@
#include "conference/conference-interface.h"
#include "conference/params/call-session-params.h"
#include "conference/participant.h"
#include "conference/session/call-session-listener.h"
#include "linphone/types.h"
...
...
@@ -34,16 +35,20 @@
LINPHONE_BEGIN_NAMESPACE
class
ConferencePrivate
;
class
CallSessionPrivate
;
class
Conference
:
public
Object
,
public
ConferenceInterface
{
class
Conference
:
public
ConferenceInterface
,
public
CallSessionListener
{
friend
class
CallSessionPrivate
;
public:
virtual
~
Conference
()
=
default
;
std
::
shared_ptr
<
Participant
>
getActiveParticipant
()
const
;
std
::
shared_ptr
<
Participant
>
getMe
()
const
;
std
::
shared_ptr
<
Participant
>
getMe
()
const
{
return
me
;
}
LinphoneCore
*
getCore
()
const
{
return
core
;
}
public:
/* ConferenceInterface */
virtual
std
::
shared_ptr
<
Participant
>
addParticipant
(
const
Address
&
addr
,
const
std
::
shared_ptr
<
CallSessionParams
>
params
,
bool
hasMedia
);
virtual
void
addParticipants
(
const
std
::
list
<
Address
>
&
addresses
,
const
std
::
shared_ptr
<
CallSessionParams
>
params
,
bool
hasMedia
);
...
...
@@ -53,11 +58,35 @@ public:
virtual
void
removeParticipant
(
const
std
::
shared_ptr
<
Participant
>
participant
);
virtual
void
removeParticipants
(
const
std
::
list
<
std
::
shared_ptr
<
Participant
>>
participants
);
private:
/* CallSessionListener */
virtual
void
onAckBeingSent
(
const
CallSession
&
session
,
LinphoneHeaders
*
headers
);
virtual
void
onAckReceived
(
const
CallSession
&
session
,
LinphoneHeaders
*
headers
);
virtual
void
onCallSessionAccepted
(
const
CallSession
&
session
);
virtual
void
onCallSessionSetReleased
(
const
CallSession
&
session
);
virtual
void
onCallSessionSetTerminated
(
const
CallSession
&
session
);
virtual
void
onCallSessionStateChanged
(
const
CallSession
&
session
,
LinphoneCallState
state
,
const
std
::
string
&
message
);
virtual
void
onIncomingCallSessionStarted
(
const
CallSession
&
session
);
virtual
void
onEncryptionChanged
(
const
CallSession
&
session
,
bool
activated
,
const
std
::
string
&
authToken
);
virtual
void
onStatsUpdated
(
const
LinphoneCallStats
*
stats
);
virtual
void
onResetCurrentSession
(
const
CallSession
&
session
);
virtual
void
onSetCurrentSession
(
const
CallSession
&
session
);
virtual
void
onFirstVideoFrameDecoded
(
const
CallSession
&
session
);
virtual
void
onResetFirstVideoFrameDecoded
(
const
CallSession
&
session
);
protected:
explicit
Conference
(
LinphoneCore
*
core
,
const
Address
&
myAddress
,
CallListener
*
listener
=
nullptr
);
protected:
explicit
Conference
(
ConferencePrivate
&
p
,
LinphoneCore
*
core
,
const
Address
&
myAddress
,
CallListener
*
<