diff --git a/src/chat/chat-room/client-group-chat-room-p.h b/src/chat/chat-room/client-group-chat-room-p.h
index 3eeb5ae47..39b8313b3 100644
--- a/src/chat/chat-room/client-group-chat-room-p.h
+++ b/src/chat/chat-room/client-group-chat-room-p.h
@@ -31,6 +31,7 @@ class ClientGroupChatRoomPrivate : public ChatRoomPrivate {
public:
ClientGroupChatRoomPrivate () = default;
+ std::list
cleanAddressesList (const std::list &addresses) const;
std::shared_ptr createSession ();
void notifyReceived (std::string body);
diff --git a/src/chat/chat-room/client-group-chat-room.cpp b/src/chat/chat-room/client-group-chat-room.cpp
index 071e88193..be899e8f5 100644
--- a/src/chat/chat-room/client-group-chat-room.cpp
+++ b/src/chat/chat-room/client-group-chat-room.cpp
@@ -39,6 +39,20 @@ LINPHONE_BEGIN_NAMESPACE
// -----------------------------------------------------------------------------
+list ClientGroupChatRoomPrivate::cleanAddressesList (const list &addresses) const {
+ L_Q();
+ list cleanedList(addresses);
+ cleanedList.sort();
+ cleanedList.unique();
+ for (auto it = cleanedList.begin(); it != cleanedList.end();) {
+ if (q->findParticipant(*it))
+ it = cleanedList.erase(it);
+ else
+ it++;
+ }
+ return cleanedList;
+}
+
shared_ptr ClientGroupChatRoomPrivate::createSession () {
L_Q();
L_Q_T(RemoteConference, qConference);
@@ -94,7 +108,8 @@ void ClientGroupChatRoom::addParticipants (
L_D();
L_D_T(RemoteConference, dConference);
- if (addresses.empty())
+ list addressesList = d->cleanAddressesList(addresses);
+ if (addressesList.empty())
return;
if ((d->state != ChatRoom::State::Instantiated) && (d->state != ChatRoom::State::Created)) {
@@ -102,12 +117,8 @@ void ClientGroupChatRoom::addParticipants (
return;
}
- list sortedAddresses(addresses);
- sortedAddresses.sort();
- sortedAddresses.unique();
-
Content content;
- content.setBody(getResourceLists(sortedAddresses));
+ content.setBody(getResourceLists(addressesList));
content.setContentType("application/resource-lists+xml");
content.setContentDisposition("recipient-list");