Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblinphone
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
10
Issues
10
List
Board
Labels
Milestones
Merge Requests
22
Merge Requests
22
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
External Wiki
External Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BC
public
liblinphone
Commits
7b59cd6e
Commit
7b59cd6e
authored
Oct 06, 2017
by
Ghislain MARY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add API to leave a chat room.
parent
d60b5fab
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
62 additions
and
13 deletions
+62
-13
c-chat-room.h
include/linphone/api/c-chat-room.h
+6
-0
chat-room-enums.h
include/linphone/enums/chat-room-enums.h
+1
-0
c-chat-room.cpp
src/c-wrapper/api/c-chat-room.cpp
+4
-0
basic-chat-room.cpp
src/chat/basic-chat-room.cpp
+2
-0
basic-chat-room.h
src/chat/basic-chat-room.h
+1
-0
client-group-chat-room.cpp
src/chat/client-group-chat-room.cpp
+28
-11
client-group-chat-room.h
src/chat/client-group-chat-room.h
+3
-2
real-time-text-chat-room.cpp
src/chat/real-time-text-chat-room.cpp
+2
-0
real-time-text-chat-room.h
src/chat/real-time-text-chat-room.h
+1
-0
conference-interface.h
src/conference/conference-interface.h
+1
-0
conference.cpp
src/conference/conference.cpp
+10
-0
conference.h
src/conference/conference.h
+2
-0
participant.h
src/conference/participant.h
+1
-0
No files found.
include/linphone/api/c-chat-room.h
View file @
7b59cd6e
...
...
@@ -289,6 +289,12 @@ LINPHONE_PUBLIC bctbx_list_t * linphone_chat_room_get_participants (const Linpho
*/
LINPHONE_PUBLIC
const
char
*
linphone_chat_room_get_subject
(
const
LinphoneChatRoom
*
cr
);
/**
* Leave a chat room.
* @param[in] cr A LinphoneChatRoom object
*/
LINPHONE_PUBLIC
void
linphone_chat_room_leave
(
LinphoneChatRoom
*
cr
);
/**
* Remove a participant of a chat room.
* @param[in] cr A LinphoneChatRoom object
...
...
include/linphone/enums/chat-room-enums.h
View file @
7b59cd6e
...
...
@@ -27,6 +27,7 @@
F(Instantiated) \
F(CreationPending) \
F(Created) \
F(TerminationPending) \
F(Terminated) \
F(CreationFailed)
...
...
src/c-wrapper/api/c-chat-room.cpp
View file @
7b59cd6e
...
...
@@ -248,6 +248,10 @@ const char * linphone_chat_room_get_subject (const LinphoneChatRoom *cr) {
return
L_STRING_TO_C
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
cr
)
->
getSubject
());
}
void
linphone_chat_room_leave
(
LinphoneChatRoom
*
cr
)
{
L_GET_CPP_PTR_FROM_C_OBJECT
(
cr
)
->
leave
();
}
void
linphone_chat_room_remove_participant
(
LinphoneChatRoom
*
cr
,
LinphoneParticipant
*
participant
)
{
L_GET_CPP_PTR_FROM_C_OBJECT
(
cr
)
->
removeParticipant
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
participant
));
}
...
...
src/chat/basic-chat-room.cpp
View file @
7b59cd6e
...
...
@@ -69,6 +69,8 @@ const string &BasicChatRoom::getSubject () const {
return
d
->
subject
;
}
void
BasicChatRoom
::
leave
()
{}
void
BasicChatRoom
::
removeParticipant
(
const
shared_ptr
<
const
Participant
>
&
participant
)
{
lError
()
<<
"removeParticipant() is not allowed on a BasicChatRoom"
;
}
...
...
src/chat/basic-chat-room.h
View file @
7b59cd6e
...
...
@@ -41,6 +41,7 @@ public:
int
getNbParticipants
()
const
override
;
std
::
list
<
std
::
shared_ptr
<
Participant
>>
getParticipants
()
const
override
;
const
std
::
string
&
getSubject
()
const
override
;
void
leave
()
override
;
void
removeParticipant
(
const
std
::
shared_ptr
<
const
Participant
>
&
participant
)
override
;
void
removeParticipants
(
const
std
::
list
<
std
::
shared_ptr
<
Participant
>>
&
participants
)
override
;
void
setSubject
(
const
std
::
string
&
subject
)
override
;
...
...
src/chat/client-group-chat-room.cpp
View file @
7b59cd6e
...
...
@@ -59,11 +59,6 @@ ClientGroupChatRoom::ClientGroupChatRoom (LinphoneCore *core, const Address &me,
this
->
subject
=
subject
;
}
ClientGroupChatRoom
::~
ClientGroupChatRoom
()
{
shared_ptr
<
CallSession
>
session
=
focus
->
getPrivate
()
->
getSession
();
session
->
terminate
();
}
// -----------------------------------------------------------------------------
void
ClientGroupChatRoom
::
addParticipant
(
const
Address
&
addr
,
const
CallSessionParams
*
params
,
bool
hasMedia
)
{
...
...
@@ -119,6 +114,19 @@ const string &ClientGroupChatRoom::getSubject () const {
return
RemoteConference
::
getSubject
();
}
void
ClientGroupChatRoom
::
leave
()
{
L_D
();
eventHandler
->
unsubscribe
();
shared_ptr
<
CallSession
>
session
=
focus
->
getPrivate
()
->
getSession
();
if
(
session
)
session
->
terminate
();
else
{
session
=
d
->
createSession
();
session
->
startInvite
(
nullptr
,
""
,
nullptr
);
}
d
->
setState
(
ChatRoom
::
State
::
TerminationPending
);
}
void
ClientGroupChatRoom
::
removeParticipant
(
const
shared_ptr
<
const
Participant
>
&
participant
)
{
// TODO
}
...
...
@@ -219,18 +227,27 @@ void ClientGroupChatRoom::onSubjectChanged (const std::string &subject) {
// -----------------------------------------------------------------------------
void
ClientGroupChatRoom
::
onCallSessionSet
Terminat
ed
(
const
std
::
shared_ptr
<
const
CallSession
>
session
)
{
void
ClientGroupChatRoom
::
onCallSessionSet
Releas
ed
(
const
std
::
shared_ptr
<
const
CallSession
>
session
)
{
if
(
session
==
focus
->
getPrivate
()
->
getSession
())
focus
->
getPrivate
()
->
removeSession
();
}
void
ClientGroupChatRoom
::
onCallSessionStateChanged
(
const
std
::
shared_ptr
<
const
CallSession
>
session
,
LinphoneCallState
state
,
const
string
&
message
)
{
L_D
();
if
(
state
==
LinphoneCallConnected
)
{
Address
addr
(
session
->
getRemoteContact
());
addr
.
clean
();
onConferenceCreated
(
addr
);
if
(
session
->
getRemoteContactAddress
()
->
hasParam
(
"isfocus"
))
eventHandler
->
subscribe
(
conferenceAddress
);
if
(
d
->
state
==
ChatRoom
::
State
::
CreationPending
)
{
Address
addr
(
session
->
getRemoteContact
());
addr
.
clean
();
onConferenceCreated
(
addr
);
if
(
session
->
getRemoteContactAddress
()
->
hasParam
(
"isfocus"
))
eventHandler
->
subscribe
(
conferenceAddress
);
}
else
if
(
d
->
state
==
ChatRoom
::
State
::
TerminationPending
)
{
focus
->
getPrivate
()
->
getSession
()
->
terminate
();
}
}
else
{
if
((
state
==
LinphoneCallReleased
)
&&
(
d
->
state
==
ChatRoom
::
State
::
TerminationPending
))
{
onConferenceTerminated
(
conferenceAddress
);
}
}
}
...
...
src/chat/client-group-chat-room.h
View file @
7b59cd6e
...
...
@@ -38,7 +38,7 @@ class ClientGroupChatRoomPrivate;
class
LINPHONE_PUBLIC
ClientGroupChatRoom
:
public
ChatRoom
,
public
RemoteConference
{
public
:
ClientGroupChatRoom
(
LinphoneCore
*
core
,
const
Address
&
me
,
const
std
::
string
&
subject
);
virtual
~
ClientGroupChatRoom
();
virtual
~
ClientGroupChatRoom
()
=
default
;
public
:
/* ConferenceInterface */
...
...
@@ -49,6 +49,7 @@ public:
int
getNbParticipants
()
const
override
;
std
::
list
<
std
::
shared_ptr
<
Participant
>>
getParticipants
()
const
override
;
const
std
::
string
&
getSubject
()
const
override
;
void
leave
()
override
;
void
removeParticipant
(
const
std
::
shared_ptr
<
const
Participant
>
&
participant
)
override
;
void
removeParticipants
(
const
std
::
list
<
std
::
shared_ptr
<
Participant
>>
&
participants
)
override
;
void
setSubject
(
const
std
::
string
&
subject
)
override
;
...
...
@@ -64,7 +65,7 @@ private:
private
:
/* CallSessionListener */
void
onCallSessionSet
Terminat
ed
(
const
std
::
shared_ptr
<
const
CallSession
>
session
)
override
;
void
onCallSessionSet
Releas
ed
(
const
std
::
shared_ptr
<
const
CallSession
>
session
)
override
;
void
onCallSessionStateChanged
(
const
std
::
shared_ptr
<
const
CallSession
>
session
,
LinphoneCallState
state
,
const
std
::
string
&
message
)
override
;
private
:
...
...
src/chat/real-time-text-chat-room.cpp
View file @
7b59cd6e
...
...
@@ -165,6 +165,8 @@ const string &RealTimeTextChatRoom::getSubject () const {
return
d
->
subject
;
}
void
RealTimeTextChatRoom
::
leave
()
{}
void
RealTimeTextChatRoom
::
removeParticipant
(
const
shared_ptr
<
const
Participant
>
&
participant
)
{
lError
()
<<
"removeParticipant() is not allowed on a RealTimeTextChatRoom"
;
}
...
...
src/chat/real-time-text-chat-room.h
View file @
7b59cd6e
...
...
@@ -51,6 +51,7 @@ public:
int
getNbParticipants
()
const
override
;
std
::
list
<
std
::
shared_ptr
<
Participant
>>
getParticipants
()
const
override
;
const
std
::
string
&
getSubject
()
const
override
;
void
leave
()
override
;
void
removeParticipant
(
const
std
::
shared_ptr
<
const
Participant
>
&
participant
)
override
;
void
removeParticipants
(
const
std
::
list
<
std
::
shared_ptr
<
Participant
>>
&
participants
)
override
;
void
setSubject
(
const
std
::
string
&
subject
)
override
;
...
...
src/conference/conference-interface.h
View file @
7b59cd6e
...
...
@@ -42,6 +42,7 @@ public:
virtual
int
getNbParticipants
()
const
=
0
;
virtual
std
::
list
<
std
::
shared_ptr
<
Participant
>>
getParticipants
()
const
=
0
;
virtual
const
std
::
string
&
getSubject
()
const
=
0
;
virtual
void
leave
()
=
0
;
virtual
void
removeParticipant
(
const
std
::
shared_ptr
<
const
Participant
>
&
participant
)
=
0
;
virtual
void
removeParticipants
(
const
std
::
list
<
std
::
shared_ptr
<
Participant
>>
&
participants
)
=
0
;
virtual
void
setSubject
(
const
std
::
string
&
subject
)
=
0
;
...
...
src/conference/conference.cpp
View file @
7b59cd6e
...
...
@@ -76,6 +76,8 @@ const string &Conference::getSubject () const {
return
subject
;
}
void
Conference
::
leave
()
{}
void
Conference
::
removeParticipant
(
const
shared_ptr
<
const
Participant
>
&
participant
)
{
lError
()
<<
"Conference class does not handle removeParticipant() generically"
;
}
...
...
@@ -171,6 +173,14 @@ shared_ptr<Participant> Conference::findParticipant (const Address &addr) const
return
nullptr
;
}
shared_ptr
<
Participant
>
Conference
::
findParticipant
(
const
shared_ptr
<
const
CallSession
>
session
)
{
for
(
const
auto
&
participant
:
participants
)
{
if
(
participant
->
getPrivate
()
->
getSession
()
==
session
)
return
participant
;
}
return
nullptr
;
}
bool
Conference
::
isMe
(
const
Address
&
addr
)
const
{
Address
cleanedAddress
=
me
->
getAddress
();
cleanedAddress
.
setPort
(
0
);
...
...
src/conference/conference.h
View file @
7b59cd6e
...
...
@@ -55,6 +55,7 @@ public:
int
getNbParticipants
()
const
override
;
std
::
list
<
std
::
shared_ptr
<
Participant
>>
getParticipants
()
const
override
;
const
std
::
string
&
getSubject
()
const
override
;
void
leave
()
override
;
void
removeParticipant
(
const
std
::
shared_ptr
<
const
Participant
>
&
participant
)
override
;
void
removeParticipants
(
const
std
::
list
<
std
::
shared_ptr
<
Participant
>>
&
participants
)
override
;
void
setSubject
(
const
std
::
string
&
subject
)
override
;
...
...
@@ -80,6 +81,7 @@ protected:
explicit
Conference
(
LinphoneCore
*
core
,
const
Address
&
myAddress
,
CallListener
*
listener
=
nullptr
);
std
::
shared_ptr
<
Participant
>
findParticipant
(
const
Address
&
addr
)
const
;
std
::
shared_ptr
<
Participant
>
findParticipant
(
const
std
::
shared_ptr
<
const
CallSession
>
session
);
bool
isMe
(
const
Address
&
addr
)
const
;
protected
:
...
...
src/conference/participant.h
View file @
7b59cd6e
...
...
@@ -37,6 +37,7 @@ class Participant : public Object {
friend
class
CallPrivate
;
friend
class
ClientGroupChatRoom
;
friend
class
ClientGroupChatRoomPrivate
;
friend
class
Conference
;
friend
class
LocalConference
;
friend
class
MediaSessionPrivate
;
friend
class
RemoteConference
;
...
...
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