From 89ed9caeebc3e371bdb92ddf3328978da18ba9eb Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 30 Nov 2017 17:13:22 +0100 Subject: [PATCH] Rename isReadOnly() to hasBeenLeft() in ChatRoom. --- include/linphone/api/c-chat-room.h | 6 +++--- src/c-wrapper/api/c-chat-room.cpp | 4 ++-- src/chat/chat-room/basic-chat-room.cpp | 2 +- src/chat/chat-room/basic-chat-room.h | 2 +- src/chat/chat-room/chat-room.h | 2 +- src/chat/chat-room/client-group-chat-room.cpp | 6 +++--- src/chat/chat-room/client-group-chat-room.h | 4 ++-- src/chat/chat-room/server-group-chat-room-stub.cpp | 2 +- src/chat/chat-room/server-group-chat-room.h | 2 +- src/db/main-db.cpp | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/linphone/api/c-chat-room.h b/include/linphone/api/c-chat-room.h index a566a5829..42c6b7dee 100644 --- a/include/linphone/api/c-chat-room.h +++ b/include/linphone/api/c-chat-room.h @@ -274,11 +274,11 @@ 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. + * Return whether or not the chat room has been left. * @param[in] cr LinphoneChatRoom object - * @return whether or not the chat room is read only + * @return whether or not the chat room has been left */ -LINPHONE_PUBLIC bool_t linphone_chat_room_is_read_only (const LinphoneChatRoom *cr); +LINPHONE_PUBLIC bool_t linphone_chat_room_has_been_left (const LinphoneChatRoom *cr); /** * Add a participant to a chat room. This may fail if this type of chat room does not handle participants. diff --git a/src/c-wrapper/api/c-chat-room.cpp b/src/c-wrapper/api/c-chat-room.cpp index 667312688..e4622b267 100644 --- a/src/c-wrapper/api/c-chat-room.cpp +++ b/src/c-wrapper/api/c-chat-room.cpp @@ -244,8 +244,8 @@ 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(); +bool_t linphone_chat_room_has_been_left (const LinphoneChatRoom *cr) { + return (bool_t)L_GET_CPP_PTR_FROM_C_OBJECT(cr)->hasBeenLeft(); } void linphone_chat_room_add_participant (LinphoneChatRoom *cr, const LinphoneAddress *addr) { diff --git a/src/chat/chat-room/basic-chat-room.cpp b/src/chat/chat-room/basic-chat-room.cpp index 5e9d70d8a..885fc025d 100644 --- a/src/chat/chat-room/basic-chat-room.cpp +++ b/src/chat/chat-room/basic-chat-room.cpp @@ -51,7 +51,7 @@ BasicChatRoom::CapabilitiesMask BasicChatRoom::getCapabilities () const { return static_cast(Capabilities::Basic); } -bool BasicChatRoom::isReadOnly () const { +bool BasicChatRoom::hasBeenLeft () const { return false; } diff --git a/src/chat/chat-room/basic-chat-room.h b/src/chat/chat-room/basic-chat-room.h index c546f35d1..18f5531d5 100644 --- a/src/chat/chat-room/basic-chat-room.h +++ b/src/chat/chat-room/basic-chat-room.h @@ -33,7 +33,7 @@ class LINPHONE_PUBLIC BasicChatRoom : public ChatRoom { public: CapabilitiesMask getCapabilities () const override; - bool isReadOnly () const override; + bool hasBeenLeft () const override; const IdentityAddress &getConferenceAddress () const override; diff --git a/src/chat/chat-room/chat-room.h b/src/chat/chat-room/chat-room.h index f71ee7f84..f1dd42157 100644 --- a/src/chat/chat-room/chat-room.h +++ b/src/chat/chat-room/chat-room.h @@ -57,7 +57,7 @@ public: time_t getLastUpdateTime () const; virtual CapabilitiesMask getCapabilities () const = 0; - virtual bool isReadOnly () const = 0; + virtual bool hasBeenLeft () const = 0; std::shared_ptr getLastMessageInHistory () const; diff --git a/src/chat/chat-room/client-group-chat-room.cpp b/src/chat/chat-room/client-group-chat-room.cpp index 541da2aa9..bb72ded64 100644 --- a/src/chat/chat-room/client-group-chat-room.cpp +++ b/src/chat/chat-room/client-group-chat-room.cpp @@ -104,7 +104,7 @@ ClientGroupChatRoom::ClientGroupChatRoom ( const string &subject, list> &&participants, unsigned int lastNotifyId, - bool isReadOnly + bool hasBeenLeft ) : ChatRoom(*new ClientGroupChatRoomPrivate, core, ChatRoomId(peerAddress, me->getAddress())), RemoteConference(core, me->getAddress(), nullptr) { L_D(); @@ -115,7 +115,7 @@ RemoteConference(core, me->getAddress(), nullptr) { dConference->subject = subject; dConference->participants = move(participants); - d->state = isReadOnly ? ChatRoom::State::Terminated : ChatRoom::State::Created; + d->state = hasBeenLeft ? ChatRoom::State::Terminated : ChatRoom::State::Created; getMe()->getPrivate()->setAdmin(me->isAdmin()); @@ -131,7 +131,7 @@ ClientGroupChatRoom::CapabilitiesMask ClientGroupChatRoom::getCapabilities () co return static_cast(Capabilities::Conference); } -bool ClientGroupChatRoom::isReadOnly () const { +bool ClientGroupChatRoom::hasBeenLeft () const { return getState() != State::Created; } diff --git a/src/chat/chat-room/client-group-chat-room.h b/src/chat/chat-room/client-group-chat-room.h index 481b04377..05efc6ae7 100644 --- a/src/chat/chat-room/client-group-chat-room.h +++ b/src/chat/chat-room/client-group-chat-room.h @@ -46,13 +46,13 @@ public: const std::string &subject, std::list> &&participants, unsigned int lastNotifyId, - bool isReadOnly + bool hasBeenLeft ); std::shared_ptr getCore () const; CapabilitiesMask getCapabilities () const override; - bool isReadOnly () const override; + bool hasBeenLeft () const override; const IdentityAddress &getConferenceAddress () const override; diff --git a/src/chat/chat-room/server-group-chat-room-stub.cpp b/src/chat/chat-room/server-group-chat-room-stub.cpp index c0bfb39f1..cc145aaf5 100644 --- a/src/chat/chat-room/server-group-chat-room-stub.cpp +++ b/src/chat/chat-room/server-group-chat-room-stub.cpp @@ -85,7 +85,7 @@ int ServerGroupChatRoom::getCapabilities () const { return 0; } -bool ServerGroupChatRoom::isReadOnly () const { +bool ServerGroupChatRoom::hasBeenLeft () const { return true; } diff --git a/src/chat/chat-room/server-group-chat-room.h b/src/chat/chat-room/server-group-chat-room.h index 0f68deef5..27479e6d1 100644 --- a/src/chat/chat-room/server-group-chat-room.h +++ b/src/chat/chat-room/server-group-chat-room.h @@ -40,7 +40,7 @@ public: ServerGroupChatRoom (const std::shared_ptr &core, SalCallOp *op); CapabilitiesMask getCapabilities () const override; - bool isReadOnly () const override; + bool hasBeenLeft () const override; const IdentityAddress &getConferenceAddress () const override; diff --git a/src/db/main-db.cpp b/src/db/main-db.cpp index 596f326e2..6b391029c 100644 --- a/src/db/main-db.cpp +++ b/src/db/main-db.cpp @@ -247,7 +247,7 @@ MainDb::MainDb (const shared_ptr &core) : AbstractDb(*new MainDbPrivate), const tm &creationTime = Utils::getTimeTAsTm(chatRoom->getCreationTime()); const int &capabilities = static_cast(chatRoom->getCapabilities()); const string &subject = chatRoom->getSubject(); - const int &flags = chatRoom->isReadOnly(); + const int &flags = chatRoom->hasBeenLeft(); *session << "INSERT INTO chat_room (" " peer_sip_address_id, local_sip_address_id, creation_time, last_update_time, capabilities, subject, flags" ") VALUES (:peerSipAddressId, :localSipAddressId, :creationTime, :lastUpdateTime, :capabilities, :subject, :flags)",