diff --git a/include/linphone/api/c-chat-room.h b/include/linphone/api/c-chat-room.h index 966f36896..a566a5829 100644 --- a/include/linphone/api/c-chat-room.h +++ b/include/linphone/api/c-chat-room.h @@ -273,6 +273,13 @@ LINPHONE_PUBLIC LinphoneChatRoomCbs * linphone_chat_room_get_callbacks (const Li */ LINPHONE_PUBLIC LinphoneChatRoomState linphone_chat_room_get_state (const LinphoneChatRoom *cr); +/** + * Return whether or not the chat room is read only. + * @param[in] cr LinphoneChatRoom object + * @return whether or not the chat room is read only + */ +LINPHONE_PUBLIC bool_t linphone_chat_room_is_read_only (const LinphoneChatRoom *cr); + /** * Add a participant to a chat room. This may fail if this type of chat room does not handle participants. * Use linphone_chat_room_can_handle_participants() to know if this chat room handles participants. diff --git a/src/c-wrapper/api/c-chat-room.cpp b/src/c-wrapper/api/c-chat-room.cpp index 3fac4d189..667312688 100644 --- a/src/c-wrapper/api/c-chat-room.cpp +++ b/src/c-wrapper/api/c-chat-room.cpp @@ -244,6 +244,10 @@ LinphoneChatRoomState linphone_chat_room_get_state (const LinphoneChatRoom *cr) return (LinphoneChatRoomState)L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getState(); } +bool_t linphone_chat_room_is_read_only (const LinphoneChatRoom *cr) { + return (bool_t)L_GET_CPP_PTR_FROM_C_OBJECT(cr)->isReadOnly(); +} + void linphone_chat_room_add_participant (LinphoneChatRoom *cr, const LinphoneAddress *addr) { L_GET_CPP_PTR_FROM_C_OBJECT(cr)->addParticipant( LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(addr)), nullptr, false diff --git a/src/chat/chat-room/client-group-chat-room.cpp b/src/chat/chat-room/client-group-chat-room.cpp index ffbca8196..4ae71e314 100644 --- a/src/chat/chat-room/client-group-chat-room.cpp +++ b/src/chat/chat-room/client-group-chat-room.cpp @@ -132,7 +132,7 @@ ClientGroupChatRoom::CapabilitiesMask ClientGroupChatRoom::getCapabilities () co } bool ClientGroupChatRoom::isReadOnly () const { - return getState() == State::Created; + return getState() != State::Created; } bool ClientGroupChatRoom::canHandleParticipants () const {