diff --git a/include/linphone/api/c-chat-room.h b/include/linphone/api/c-chat-room.h
index a190ac8be..61650f833 100644
--- a/include/linphone/api/c-chat-room.h
+++ b/include/linphone/api/c-chat-room.h
@@ -284,6 +284,7 @@ LINPHONE_PUBLIC bool_t linphone_chat_room_can_handle_participants (const Linphon
* Find a participant of a chat room from its address.
* @param[in] cr A LinphoneChatRoom object
* @param[in] addr The address to search in the list of participants of the chat room
+ * @return The participant if found, NULL otherwise.
*/
LINPHONE_PUBLIC LinphoneParticipant *linphone_chat_room_find_participant (const LinphoneChatRoom *cr, const LinphoneAddress *addr);
@@ -294,6 +295,13 @@ LINPHONE_PUBLIC LinphoneParticipant *linphone_chat_room_find_participant (const
*/
LINPHONE_PUBLIC const LinphoneAddress *linphone_chat_room_get_conference_address (const LinphoneChatRoom *cr);
+/**
+ * Get the participant representing myself in the chat room.
+ * @param[in] cr A LinphoneChatRoom object
+ * @return The participant representing myself in the conference.
+ */
+LINPHONE_PUBLIC LinphoneParticipant *linphone_chat_room_get_me (const LinphoneChatRoom *cr);
+
/**
* Get the number of participants in the chat room (that is without ourselves).
* @param[in] cr A LinphoneChatRoom object
diff --git a/src/c-wrapper/api/c-chat-room.cpp b/src/c-wrapper/api/c-chat-room.cpp
index 0717bee48..ef3aa923f 100644
--- a/src/c-wrapper/api/c-chat-room.cpp
+++ b/src/c-wrapper/api/c-chat-room.cpp
@@ -266,6 +266,10 @@ const LinphoneAddress *linphone_chat_room_get_conference_address (const Linphone
return cr->conferenceAddressCache;
}
+LinphoneParticipant *linphone_chat_room_get_me (const LinphoneChatRoom *cr) {
+ return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getMe());
+}
+
int linphone_chat_room_get_nb_participants (const LinphoneChatRoom *cr) {
return L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getNbParticipants();
}
diff --git a/src/chat/chat-room/basic-chat-room.cpp b/src/chat/chat-room/basic-chat-room.cpp
index 4d9d9e470..c67a830d2 100644
--- a/src/chat/chat-room/basic-chat-room.cpp
+++ b/src/chat/chat-room/basic-chat-room.cpp
@@ -64,6 +64,11 @@ const Address &BasicChatRoom::getConferenceAddress () const {
return Utils::getEmptyConstRefObject
();
}
+shared_ptr BasicChatRoom::getMe () const {
+ lError() << "a BasicChatRoom does not handle participants";
+ return nullptr;
+}
+
int BasicChatRoom::getNbParticipants () const {
return 1;
}
diff --git a/src/chat/chat-room/basic-chat-room.h b/src/chat/chat-room/basic-chat-room.h
index 402ce990f..d4dc2e948 100644
--- a/src/chat/chat-room/basic-chat-room.h
+++ b/src/chat/chat-room/basic-chat-room.h
@@ -41,6 +41,7 @@ public:
bool canHandleParticipants () const override;
std::shared_ptr findParticipant (const Address &addr) const override;
const Address &getConferenceAddress () const override;
+ std::shared_ptr getMe () const override;
int getNbParticipants () const override;
std::list> getParticipants () const override;
const std::string &getSubject () const override;
diff --git a/src/chat/chat-room/client-group-chat-room.cpp b/src/chat/chat-room/client-group-chat-room.cpp
index 8b25a87e4..d04aedf98 100644
--- a/src/chat/chat-room/client-group-chat-room.cpp
+++ b/src/chat/chat-room/client-group-chat-room.cpp
@@ -145,6 +145,10 @@ const Address &ClientGroupChatRoom::getConferenceAddress () const {
return RemoteConference::getConferenceAddress();
}
+shared_ptr ClientGroupChatRoom::getMe () const {
+ return RemoteConference::getMe();
+}
+
int ClientGroupChatRoom::getNbParticipants () const {
return RemoteConference::getNbParticipants();
}
diff --git a/src/chat/chat-room/client-group-chat-room.h b/src/chat/chat-room/client-group-chat-room.h
index 9d1614ccf..8b4ae10c0 100644
--- a/src/chat/chat-room/client-group-chat-room.h
+++ b/src/chat/chat-room/client-group-chat-room.h
@@ -47,6 +47,7 @@ public:
bool canHandleParticipants () const override;
std::shared_ptr findParticipant (const Address &addr) const override;
const Address &getConferenceAddress () const override;
+ std::shared_ptr getMe () const override;
int getNbParticipants () const override;
std::list> getParticipants () const override;
const std::string &getSubject () const override;
diff --git a/src/chat/chat-room/real-time-text-chat-room.cpp b/src/chat/chat-room/real-time-text-chat-room.cpp
index 2242cdd3c..6c872b9eb 100644
--- a/src/chat/chat-room/real-time-text-chat-room.cpp
+++ b/src/chat/chat-room/real-time-text-chat-room.cpp
@@ -164,6 +164,11 @@ const Address &RealTimeTextChatRoom::getConferenceAddress () const {
return Utils::getEmptyConstRefObject();
}
+shared_ptr RealTimeTextChatRoom::getMe () const {
+ lError() << "a RealTimeTextChatRoom does not handle participants";
+ return nullptr;
+}
+
int RealTimeTextChatRoom::getNbParticipants () const {
return 1;
}
diff --git a/src/chat/chat-room/real-time-text-chat-room.h b/src/chat/chat-room/real-time-text-chat-room.h
index 31a24b166..71ffc59ae 100644
--- a/src/chat/chat-room/real-time-text-chat-room.h
+++ b/src/chat/chat-room/real-time-text-chat-room.h
@@ -47,6 +47,7 @@ public:
bool canHandleParticipants () const override;
std::shared_ptr findParticipant (const Address &addr) const override;
const Address &getConferenceAddress () const override;
+ std::shared_ptr getMe () const override;
int getNbParticipants () const override;
std::list> getParticipants () const override;
const std::string &getSubject () const override;
diff --git a/src/conference/conference-interface.h b/src/conference/conference-interface.h
index 42bdca4e2..104d7dbbc 100644
--- a/src/conference/conference-interface.h
+++ b/src/conference/conference-interface.h
@@ -42,6 +42,7 @@ public:
virtual bool canHandleParticipants () const = 0;
virtual std::shared_ptr findParticipant (const Address &addr) const = 0;
virtual const Address &getConferenceAddress () const = 0;
+ virtual std::shared_ptr getMe () const = 0;
virtual int getNbParticipants () const = 0;
virtual std::list> getParticipants () const = 0;
virtual const std::string &getSubject () const = 0;
diff --git a/src/conference/conference.cpp b/src/conference/conference.cpp
index 1ad341793..3cbc5c93b 100644
--- a/src/conference/conference.cpp
+++ b/src/conference/conference.cpp
@@ -48,11 +48,6 @@ shared_ptr Conference::getActiveParticipant () const {
return d->activeParticipant;
}
-shared_ptr Conference::getMe () const {
- L_D();
- return d->me;
-}
-
LinphoneCore *Conference::getCore () const {
L_D();
return d->core;
@@ -84,6 +79,11 @@ const Address &Conference::getConferenceAddress () const {
return d->conferenceAddress;
}
+shared_ptr Conference::getMe () const {
+ L_D();
+ return d->me;
+}
+
int Conference::getNbParticipants () const {
L_D();
return static_cast(d->participants.size());
diff --git a/src/conference/conference.h b/src/conference/conference.h
index b89117c25..6bd9eb783 100644
--- a/src/conference/conference.h
+++ b/src/conference/conference.h
@@ -40,7 +40,6 @@ public:
virtual ~Conference();
std::shared_ptr getActiveParticipant () const;
- std::shared_ptr getMe () const;
LinphoneCore * getCore () const;
@@ -52,6 +51,7 @@ public:
bool canHandleParticipants () const override;
std::shared_ptr findParticipant (const Address &addr) const override;
const Address &getConferenceAddress () const override;
+ std::shared_ptr getMe () const override;
int getNbParticipants () const override;
std::list> getParticipants () const override;
const std::string &getSubject () const override;