From b4403f74cfced3fa02f1436f4c9a2bf23c0ac1a0 Mon Sep 17 00:00:00 2001
From: Andrea Gianarda <andrea.gianarda@belledonne-communications.com>
Date: Tue, 11 Feb 2025 11:12:02 +0100
Subject: [PATCH] Do not add me participant when it is in the resource list of
 an incoming INVITE

---
 src/chat/chat-room/client-group-chat-room.cpp | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/chat/chat-room/client-group-chat-room.cpp b/src/chat/chat-room/client-group-chat-room.cpp
index 26f175bee5..dd1f4bcbb9 100644
--- a/src/chat/chat-room/client-group-chat-room.cpp
+++ b/src/chat/chat-room/client-group-chat-room.cpp
@@ -194,10 +194,12 @@ void ClientGroupChatRoomPrivate::confirmJoining(SalCallOp *op) {
 		const auto participantList = Utils::parseResourceLists(op->getContentInRemote(ContentType::ResourceLists));
 		for (const auto &participantInfo : participantList) {
 			const auto &address = participantInfo->getAddress();
-			auto participant = q->findParticipant(address);
-			if (!participant) {
-				participant = Participant::create(q->getConference().get(), address);
-				q->getConference()->participants.push_back(participant);
+			if (!q->isMe(address)) {
+				auto participant = q->findParticipant(address);
+				if (!participant) {
+					participant = Participant::create(q->getConference().get(), address);
+					q->getConference()->participants.push_back(participant);
+				}
 			}
 		}
 	}
@@ -422,8 +424,10 @@ ClientGroupChatRoom::ClientGroupChatRoom(const shared_ptr<Core> &core,
 	getConference()->setSubject(subject);
 	const auto participantList = Utils::parseResourceLists(content);
 	for (const auto &participantInfo : participantList) {
-		getConference()->participants.push_back(
-		    Participant::create(getConference().get(), participantInfo->getAddress()));
+		const auto &address = participantInfo->getAddress();
+		if (!isMe(address)) {
+			getConference()->participants.push_back(Participant::create(getConference().get(), address));
+		}
 	}
 
 	if (params->getEphemeralMode() == AbstractChatRoom::EphemeralMode::AdminManaged) {
-- 
GitLab