diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e87a09ea7..eaa452bfd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,6 +46,9 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES chat/chat-room/chat-room.h chat/chat-room/client-group-chat-room-p.h chat/chat-room/client-group-chat-room.h + chat/chat-room/client-group-to-basic-chat-room.h + chat/chat-room/proxy-chat-room-p.h + chat/chat-room/proxy-chat-room.h chat/chat-room/real-time-text-chat-room-p.h chat/chat-room/real-time-text-chat-room.h chat/chat-room/server-group-chat-room-p.h @@ -177,6 +180,8 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES chat/chat-room/chat-room-id.cpp chat/chat-room/chat-room.cpp chat/chat-room/client-group-chat-room.cpp + chat/chat-room/client-group-to-basic-chat-room.cpp + chat/chat-room/proxy-chat-room.cpp chat/chat-room/real-time-text-chat-room.cpp chat/chat-room/server-group-chat-room-stub.cpp chat/cpim/header/cpim-core-headers.cpp diff --git a/src/chat/chat-room/abstract-chat-room.h b/src/chat/chat-room/abstract-chat-room.h index b44b12db1..ffcf5b047 100644 --- a/src/chat/chat-room/abstract-chat-room.h +++ b/src/chat/chat-room/abstract-chat-room.h @@ -33,11 +33,11 @@ class ChatRoomId; class EventLog; class LINPHONE_PUBLIC AbstractChatRoom : public Object, public CoreAccessor, public ConferenceInterface { - friend class BasicToClientGroupChatRoomPrivate; friend class ChatMessage; friend class ChatMessagePrivate; friend class CorePrivate; friend class MainDb; + friend class ProxyChatRoomPrivate; public: L_DECLARE_ENUM(Capabilities, L_ENUM_VALUES_CHAT_ROOM_CAPABILITIES); diff --git a/src/chat/chat-room/basic-to-client-group-chat-room.cpp b/src/chat/chat-room/basic-to-client-group-chat-room.cpp index 4dfe8d88b..2667a4630 100644 --- a/src/chat/chat-room/basic-to-client-group-chat-room.cpp +++ b/src/chat/chat-room/basic-to-client-group-chat-room.cpp @@ -17,9 +17,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "abstract-chat-room-p.h" #include "basic-to-client-group-chat-room.h" -#include "chat-room.h" +#include "proxy-chat-room-p.h" // ============================================================================= @@ -29,181 +28,22 @@ LINPHONE_BEGIN_NAMESPACE // ----------------------------------------------------------------------------- -class BasicToClientGroupChatRoomPrivate : public AbstractChatRoomPrivate { +class BasicToClientGroupChatRoomPrivate : public ProxyChatRoomPrivate { public: - shared_ptr chatRoom; - -private: - inline void setCreationTime (time_t creationTime) override { - chatRoom->getPrivate()->setCreationTime(creationTime); - } - - inline void setLastUpdateTime (time_t lastUpdateTime) override { - chatRoom->getPrivate()->setLastUpdateTime(lastUpdateTime); - } - - inline void setState (BasicToClientGroupChatRoom::State state) override { - chatRoom->getPrivate()->setState(state); - } - inline void sendChatMessage (const shared_ptr &chatMessage) override { - chatRoom->getPrivate()->sendChatMessage(chatMessage); - } - - inline void addTransientEvent (const shared_ptr &eventLog) override { - chatRoom->getPrivate()->addTransientEvent(eventLog); - } - - inline void removeTransientEvent (const shared_ptr &eventLog) override { - chatRoom->getPrivate()->removeTransientEvent(eventLog); - } - - inline void notifyUndecryptableChatMessageReceived (const shared_ptr &chatMessage) override { - chatRoom->getPrivate()->notifyUndecryptableChatMessageReceived(chatMessage); - } - - inline LinphoneReason onSipMessageReceived (SalOp *op, const SalMessage *message) override { - return chatRoom->getPrivate()->onSipMessageReceived(op, message); + ProxyChatRoomPrivate::sendChatMessage(chatMessage); + // TODO: Try migration. } inline void onChatMessageReceived (const shared_ptr &chatMessage) override { - chatRoom->getPrivate()->onChatMessageReceived(chatMessage); + ProxyChatRoomPrivate::onChatMessageReceived(chatMessage); + // TODO: Try migration. } }; // ============================================================================= BasicToClientGroupChatRoom::BasicToClientGroupChatRoom (const shared_ptr &chatRoom) : - AbstractChatRoom(*new BasicToClientGroupChatRoomPrivate, chatRoom->getCore()) { - L_D(); - d->chatRoom = chatRoom; -} - -// ----------------------------------------------------------------------------- - -const ChatRoomId &BasicToClientGroupChatRoom::getChatRoomId () const { - L_D(); - return d->chatRoom->getChatRoomId(); -} - -const IdentityAddress &BasicToClientGroupChatRoom::getPeerAddress () const { - L_D(); - return d->chatRoom->getPeerAddress(); -} - -const IdentityAddress &BasicToClientGroupChatRoom::getLocalAddress () const { - L_D(); - return d->chatRoom->getLocalAddress(); -} - -// ----------------------------------------------------------------------------- - -time_t BasicToClientGroupChatRoom::getCreationTime () const { - L_D(); - return d->chatRoom->getCreationTime(); -} - -time_t BasicToClientGroupChatRoom::getLastUpdateTime () const { - L_D(); - return d->chatRoom->getLastUpdateTime(); -} - -// ----------------------------------------------------------------------------- - -BasicToClientGroupChatRoom::State BasicToClientGroupChatRoom::getState () const { - L_D(); - return d->chatRoom->getState(); -} - -// ----------------------------------------------------------------------------- - -list> BasicToClientGroupChatRoom::getHistory (int nLast) const { - L_D(); - return d->chatRoom->getHistory(nLast); -} - -list> BasicToClientGroupChatRoom::getHistoryRange (int begin, int end) const { - L_D(); - return d->chatRoom->getHistoryRange(begin, end); -} - -int BasicToClientGroupChatRoom::getHistorySize () const { - L_D(); - return d->chatRoom->getHistorySize(); -} - -void BasicToClientGroupChatRoom::deleteHistory () { - L_D(); - d->chatRoom->deleteHistory(); -} - -shared_ptr BasicToClientGroupChatRoom::getLastChatMessageInHistory () const { - L_D(); - return d->chatRoom->getLastChatMessageInHistory(); -} - -int BasicToClientGroupChatRoom::getChatMessageCount () const { - L_D(); - return d->chatRoom->getChatMessageCount(); -} - -int BasicToClientGroupChatRoom::getUnreadChatMessageCount () const { - L_D(); - return d->chatRoom->getUnreadChatMessageCount(); -} - -// ----------------------------------------------------------------------------- - -void BasicToClientGroupChatRoom::compose () { - L_D(); - return d->chatRoom->compose(); -} - -bool BasicToClientGroupChatRoom::isRemoteComposing () const { - L_D(); - return d->chatRoom->isRemoteComposing(); -} - -list BasicToClientGroupChatRoom::getComposingAddresses () const { - L_D(); - return d->chatRoom->getComposingAddresses(); -} - -// ----------------------------------------------------------------------------- - -shared_ptr BasicToClientGroupChatRoom::createChatMessage () { - L_D(); - return d->chatRoom->createChatMessage(); -} - -shared_ptr BasicToClientGroupChatRoom::createChatMessage (const string &text) { - L_D(); - return d->chatRoom->createChatMessage(text); -} - -shared_ptr BasicToClientGroupChatRoom::createFileTransferMessage (const LinphoneContent *initialContent) { - L_D(); - return d->chatRoom->createFileTransferMessage(initialContent); -} - -// ----------------------------------------------------------------------------- - -shared_ptr BasicToClientGroupChatRoom::findChatMessage (const string &messageId) const { - L_D(); - return d->chatRoom->findChatMessage(messageId); -} - -shared_ptr BasicToClientGroupChatRoom::findChatMessage ( - const string &messageId, - ChatMessage::Direction direction -) const { - L_D(); - return d->chatRoom->findChatMessage(messageId, direction); -} - -void BasicToClientGroupChatRoom::markAsRead () { - L_D(); - d->chatRoom->markAsRead(); -} + ProxyChatRoom(*new BasicToClientGroupChatRoomPrivate, chatRoom) {} LINPHONE_END_NAMESPACE diff --git a/src/chat/chat-room/basic-to-client-group-chat-room.h b/src/chat/chat-room/basic-to-client-group-chat-room.h index d4d11b546..2bff6bce0 100644 --- a/src/chat/chat-room/basic-to-client-group-chat-room.h +++ b/src/chat/chat-room/basic-to-client-group-chat-room.h @@ -20,58 +20,18 @@ #ifndef _BASIC_TO_CLIENT_GROUP_CHAT_ROOM_H_ #define _BASIC_TO_CLIENT_GROUP_CHAT_ROOM_H_ -#include "abstract-chat-room.h" +#include "proxy-chat-room.h" // ============================================================================= LINPHONE_BEGIN_NAMESPACE class BasicToClientGroupChatRoomPrivate; -class ChatRoom; -class LINPHONE_PUBLIC BasicToClientGroupChatRoom : public AbstractChatRoom { +class LINPHONE_PUBLIC BasicToClientGroupChatRoom : public ProxyChatRoom { public: BasicToClientGroupChatRoom (const std::shared_ptr &chatRoom); - const ChatRoomId &getChatRoomId () const override; - - const IdentityAddress &getPeerAddress () const override; - const IdentityAddress &getLocalAddress () const override; - - time_t getCreationTime () const override; - time_t getLastUpdateTime () const override; - - State getState () const override; - - std::list> getHistory (int nLast) const override; - std::list> getHistoryRange (int begin, int end) const override; - int getHistorySize () const override; - - void deleteHistory () override; - - std::shared_ptr getLastChatMessageInHistory () const override; - - int getChatMessageCount () const override; - int getUnreadChatMessageCount () const override; - - void compose () override; - bool isRemoteComposing () const override; - std::list getComposingAddresses () const override; - - std::shared_ptr createChatMessage () override; - std::shared_ptr createChatMessage (const std::string &text) override; - - // TODO: Remove LinphoneContent by LinphonePrivate::Content. - std::shared_ptr createFileTransferMessage (const LinphoneContent *initialContent) override; - - std::shared_ptr findChatMessage (const std::string &messageId) const override; - std::shared_ptr findChatMessage ( - const std::string &messageId, - ChatMessage::Direction direction - ) const override; - - void markAsRead () override; - private: L_DECLARE_PRIVATE(BasicToClientGroupChatRoom); L_DISABLE_COPY(BasicToClientGroupChatRoom); diff --git a/src/chat/chat-room/client-group-to-basic-chat-room.cpp b/src/chat/chat-room/client-group-to-basic-chat-room.cpp new file mode 100644 index 000000000..3cf1783a6 --- /dev/null +++ b/src/chat/chat-room/client-group-to-basic-chat-room.cpp @@ -0,0 +1,49 @@ +/* + * client-group-to-basic-chat-room.cpp + * Copyright (C) 2010-2017 Belledonne Communications SARL + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "client-group-to-basic-chat-room.h" +#include "proxy-chat-room-p.h" + +// ============================================================================= + +using namespace std; + +LINPHONE_BEGIN_NAMESPACE + +// ----------------------------------------------------------------------------- + +class ClientGroupToBasicChatRoomPrivate : public ProxyChatRoomPrivate { +public: + inline void sendChatMessage (const shared_ptr &chatMessage) override { + ProxyChatRoomPrivate::sendChatMessage(chatMessage); + // TODO: Try migration. + } + + inline void onChatMessageReceived (const shared_ptr &chatMessage) override { + ProxyChatRoomPrivate::onChatMessageReceived(chatMessage); + // TODO: Try migration. + } +}; + +// ============================================================================= + +ClientGroupToBasicChatRoom::ClientGroupToBasicChatRoom (const shared_ptr &chatRoom) : + ProxyChatRoom(*new ClientGroupToBasicChatRoomPrivate, chatRoom) {} + +LINPHONE_END_NAMESPACE diff --git a/src/chat/chat-room/client-group-to-basic-chat-room.h b/src/chat/chat-room/client-group-to-basic-chat-room.h new file mode 100644 index 000000000..6e5cc1173 --- /dev/null +++ b/src/chat/chat-room/client-group-to-basic-chat-room.h @@ -0,0 +1,42 @@ +/* + * basic-to-client-group-chat-room.h + * Copyright (C) 2010-2017 Belledonne Communications SARL + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef _CLIENT_GROUP_TO_BASIC_CHAT_ROOM_H_ +#define _CLIENT_GROUP_TO_BASIC_CHAT_ROOM_H_ + +#include "proxy-chat-room.h" + +// ============================================================================= + +LINPHONE_BEGIN_NAMESPACE + +class ClientGroupToBasicChatRoomPrivate; + +class LINPHONE_PUBLIC ClientGroupToBasicChatRoom : public ProxyChatRoom { +public: + ClientGroupToBasicChatRoom (const std::shared_ptr &chatRoom); + +private: + L_DECLARE_PRIVATE(ClientGroupToBasicChatRoom); + L_DISABLE_COPY(ClientGroupToBasicChatRoom); +}; + +LINPHONE_END_NAMESPACE + +#endif // ifndef _CLIENT_GROUP_TO_BASIC_CHAT_ROOM_H_ diff --git a/src/chat/chat-room/proxy-chat-room-p.h b/src/chat/chat-room/proxy-chat-room-p.h new file mode 100644 index 000000000..6fad6c69e --- /dev/null +++ b/src/chat/chat-room/proxy-chat-room-p.h @@ -0,0 +1,72 @@ +/* + * proxy-chat-room-p.h + * Copyright (C) 2010-2017 Belledonne Communications SARL + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef _PROXY_CHAT_ROOM_P_H_ +#define _PROXY_CHAT_ROOM_P_H_ + +#include "abstract-chat-room-p.h" + +// ============================================================================= + +LINPHONE_BEGIN_NAMESPACE + +class ProxyChatRoomPrivate : public AbstractChatRoomPrivate { +public: + inline void setCreationTime (time_t creationTime) override { + chatRoom->getPrivate()->setCreationTime(creationTime); + } + + inline void setLastUpdateTime (time_t lastUpdateTime) override { + chatRoom->getPrivate()->setLastUpdateTime(lastUpdateTime); + } + + inline void setState (AbstractChatRoom::State state) override { + chatRoom->getPrivate()->setState(state); + } + + inline void sendChatMessage (const std::shared_ptr &chatMessage) override { + chatRoom->getPrivate()->sendChatMessage(chatMessage); + } + + inline void addTransientEvent (const std::shared_ptr &eventLog) override { + chatRoom->getPrivate()->addTransientEvent(eventLog); + } + + inline void removeTransientEvent (const std::shared_ptr &eventLog) override { + chatRoom->getPrivate()->removeTransientEvent(eventLog); + } + + inline void notifyUndecryptableChatMessageReceived (const std::shared_ptr &chatMessage) override { + chatRoom->getPrivate()->notifyUndecryptableChatMessageReceived(chatMessage); + } + + inline LinphoneReason onSipMessageReceived (SalOp *op, const SalMessage *message) override { + return chatRoom->getPrivate()->onSipMessageReceived(op, message); + } + + inline void onChatMessageReceived (const std::shared_ptr &chatMessage) override { + chatRoom->getPrivate()->onChatMessageReceived(chatMessage); + } + + std::shared_ptr chatRoom; +}; + +LINPHONE_END_NAMESPACE + +#endif // ifndef _PROXY_CHAT_ROOM_P_H_ diff --git a/src/chat/chat-room/proxy-chat-room.cpp b/src/chat/chat-room/proxy-chat-room.cpp new file mode 100644 index 000000000..bb6bba60f --- /dev/null +++ b/src/chat/chat-room/proxy-chat-room.cpp @@ -0,0 +1,255 @@ +/* + * proxy-chat-room.cpp + * Copyright (C) 2010-2017 Belledonne Communications SARL + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "basic-to-client-group-chat-room.h" +#include "chat-room.h" +#include "proxy-chat-room-p.h" + +// ============================================================================= + +using namespace std; + +LINPHONE_BEGIN_NAMESPACE + +// ----------------------------------------------------------------------------- + + ProxyChatRoom::ProxyChatRoom (ProxyChatRoomPrivate &p, const shared_ptr &chatRoom) : + AbstractChatRoom(p, chatRoom->getCore()) { + L_D(); + d->chatRoom = chatRoom; +} + +// ----------------------------------------------------------------------------- + +const ChatRoomId &ProxyChatRoom::getChatRoomId () const { + L_D(); + return d->chatRoom->getChatRoomId(); +} + +const IdentityAddress &ProxyChatRoom::getPeerAddress () const { + L_D(); + return d->chatRoom->getPeerAddress(); +} + +const IdentityAddress &ProxyChatRoom::getLocalAddress () const { + L_D(); + return d->chatRoom->getLocalAddress(); +} + +// ----------------------------------------------------------------------------- + +time_t ProxyChatRoom::getCreationTime () const { + L_D(); + return d->chatRoom->getCreationTime(); +} + +time_t ProxyChatRoom::getLastUpdateTime () const { + L_D(); + return d->chatRoom->getLastUpdateTime(); +} + +// ----------------------------------------------------------------------------- + ProxyChatRoom::State ProxyChatRoom::getState () const { + L_D(); + return d->chatRoom->getState(); +} + +// ----------------------------------------------------------------------------- + +list> ProxyChatRoom::getHistory (int nLast) const { + L_D(); + return d->chatRoom->getHistory(nLast); +} + +list> ProxyChatRoom::getHistoryRange (int begin, int end) const { + L_D(); + return d->chatRoom->getHistoryRange(begin, end); +} + +int ProxyChatRoom::getHistorySize () const { + L_D(); + return d->chatRoom->getHistorySize(); +} + +void ProxyChatRoom::deleteHistory () { + L_D(); + d->chatRoom->deleteHistory(); +} + +shared_ptr ProxyChatRoom::getLastChatMessageInHistory () const { + L_D(); + return d->chatRoom->getLastChatMessageInHistory(); +} + +int ProxyChatRoom::getChatMessageCount () const { + L_D(); + return d->chatRoom->getChatMessageCount(); +} + +int ProxyChatRoom::getUnreadChatMessageCount () const { + L_D(); + return d->chatRoom->getUnreadChatMessageCount(); +} + +// ----------------------------------------------------------------------------- + +void ProxyChatRoom::compose () { + L_D(); + return d->chatRoom->compose(); +} + +bool ProxyChatRoom::isRemoteComposing () const { + L_D(); + return d->chatRoom->isRemoteComposing(); +} + +list ProxyChatRoom::getComposingAddresses () const { + L_D(); + return d->chatRoom->getComposingAddresses(); +} + +// ----------------------------------------------------------------------------- + +shared_ptr ProxyChatRoom::createChatMessage () { + L_D(); + return d->chatRoom->createChatMessage(); +} + +shared_ptr ProxyChatRoom::createChatMessage (const string &text) { + L_D(); + return d->chatRoom->createChatMessage(text); +} + +shared_ptr ProxyChatRoom::createFileTransferMessage (const LinphoneContent *initialContent) { + L_D(); + return d->chatRoom->createFileTransferMessage(initialContent); +} + +// ----------------------------------------------------------------------------- + +shared_ptr ProxyChatRoom::findChatMessage (const string &messageId) const { + L_D(); + return d->chatRoom->findChatMessage(messageId); +} + +shared_ptr ProxyChatRoom::findChatMessage ( + const string &messageId, + ChatMessage::Direction direction +) const { + L_D(); + return d->chatRoom->findChatMessage(messageId, direction); +} + +void ProxyChatRoom::markAsRead () { + L_D(); + d->chatRoom->markAsRead(); +} + +// ----------------------------------------------------------------------------- + +const IdentityAddress &ProxyChatRoom::getConferenceAddress () const { + L_D(); + return d->chatRoom->getConferenceAddress(); +} + +// ----------------------------------------------------------------------------- + +bool ProxyChatRoom::canHandleParticipants () const { + L_D(); + return d->chatRoom->canHandleParticipants(); +} + +void ProxyChatRoom::addParticipant ( + const IdentityAddress &participantAddress, + const CallSessionParams *params, + bool hasMedia +) { + L_D(); + return d->chatRoom->addParticipant(participantAddress, params, hasMedia); +} + +void ProxyChatRoom::addParticipants ( + const list &addresses, + const CallSessionParams *params, + bool hasMedia +) { + L_D(); + return d->chatRoom->addParticipants(addresses, params, hasMedia); +} + +void ProxyChatRoom::removeParticipant (const shared_ptr &participant) { + L_D(); + d->chatRoom->removeParticipant(participant); +} + +void ProxyChatRoom::removeParticipants (const list> &participants) { + L_D(); + d->chatRoom->removeParticipants(participants); +} + +shared_ptr ProxyChatRoom::findParticipant (const IdentityAddress &participantAddress) const { + L_D(); + return d->chatRoom->findParticipant(participantAddress); +} + +shared_ptr ProxyChatRoom::getMe () const { + L_D(); + return d->chatRoom->getMe(); +} + +int ProxyChatRoom::getParticipantCount () const { + L_D(); + return d->chatRoom->getParticipantCount(); +} + +const list> &ProxyChatRoom::getParticipants () const { + L_D(); + return d->chatRoom->getParticipants(); +} + +void ProxyChatRoom::setParticipantAdminStatus (const shared_ptr &participant, bool isAdmin) { + L_D(); + d->chatRoom->setParticipantAdminStatus(participant, isAdmin); +} + +// ----------------------------------------------------------------------------- + +const string &ProxyChatRoom::getSubject () const { + L_D(); + return d->chatRoom->getSubject(); +} + +void ProxyChatRoom::setSubject (const string &subject) { + L_D(); + d->chatRoom->setSubject(subject); +} + +// ----------------------------------------------------------------------------- + +void ProxyChatRoom::join () { + L_D(); + d->chatRoom->join(); +} + +void ProxyChatRoom::leave () { + L_D(); + d->chatRoom->leave(); +} + +LINPHONE_END_NAMESPACE diff --git a/src/chat/chat-room/proxy-chat-room.h b/src/chat/chat-room/proxy-chat-room.h new file mode 100644 index 000000000..e78c40fe4 --- /dev/null +++ b/src/chat/chat-room/proxy-chat-room.h @@ -0,0 +1,115 @@ +/* + * proxy-chat-room.h + * Copyright (C) 2010-2017 Belledonne Communications SARL + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef _PROXY_CHAT_ROOM_H_ +#define _PROXY_CHAT_ROOM_H_ + +#include "abstract-chat-room.h" + +// ============================================================================= + +LINPHONE_BEGIN_NAMESPACE + +class ChatRoom; +class ProxyChatRoomPrivate; + +class LINPHONE_PUBLIC ProxyChatRoom : public AbstractChatRoom { +public: + const ChatRoomId &getChatRoomId () const override; + + const IdentityAddress &getPeerAddress () const override; + const IdentityAddress &getLocalAddress () const override; + + time_t getCreationTime () const override; + time_t getLastUpdateTime () const override; + + State getState () const override; + + std::list> getHistory (int nLast) const override; + std::list> getHistoryRange (int begin, int end) const override; + int getHistorySize () const override; + + void deleteHistory () override; + + std::shared_ptr getLastChatMessageInHistory () const override; + + int getChatMessageCount () const override; + int getUnreadChatMessageCount () const override; + + void compose () override; + bool isRemoteComposing () const override; + std::list getComposingAddresses () const override; + + std::shared_ptr createChatMessage () override; + std::shared_ptr createChatMessage (const std::string &text) override; + + // TODO: Remove LinphoneContent by LinphonePrivate::Content. + std::shared_ptr createFileTransferMessage (const LinphoneContent *initialContent) override; + + std::shared_ptr findChatMessage (const std::string &messageId) const override; + std::shared_ptr findChatMessage ( + const std::string &messageId, + ChatMessage::Direction direction + ) const override; + + void markAsRead () override; + + const IdentityAddress &getConferenceAddress () const override; + + bool canHandleParticipants () const override; + + void addParticipant ( + const IdentityAddress &participantAddress, + const CallSessionParams *params, + bool hasMedia + ) override; + void addParticipants ( + const std::list &addresses, + const CallSessionParams *params, + bool hasMedia + ) override; + + void removeParticipant (const std::shared_ptr &participant) override; + void removeParticipants (const std::list> &participants) override; + + std::shared_ptr findParticipant (const IdentityAddress &participantAddress) const override; + + std::shared_ptr getMe () const override; + int getParticipantCount () const override; + const std::list> &getParticipants () const override; + + void setParticipantAdminStatus (const std::shared_ptr &participant, bool isAdmin) override; + + const std::string &getSubject () const override; + void setSubject (const std::string &subject) override; + + void join () override; + void leave () override; + +protected: + ProxyChatRoom (ProxyChatRoomPrivate &p, const std::shared_ptr &chatRoom); + +private: + L_DECLARE_PRIVATE(ProxyChatRoom); + L_DISABLE_COPY(ProxyChatRoom); +}; + +LINPHONE_END_NAMESPACE + +#endif // ifndef _PROXY_CHAT_ROOM_H_ diff --git a/src/conference/conference-interface.h b/src/conference/conference-interface.h index bee481231..b1f660366 100644 --- a/src/conference/conference-interface.h +++ b/src/conference/conference-interface.h @@ -37,10 +37,18 @@ class LINPHONE_PUBLIC ConferenceInterface { public: virtual ~ConferenceInterface() = default; - virtual void addParticipant (const IdentityAddress &addr, const CallSessionParams *params, bool hasMedia) = 0; - virtual void addParticipants (const std::list &addresses, const CallSessionParams *params, bool hasMedia) = 0; + virtual void addParticipant ( + const IdentityAddress &participantAddress, + const CallSessionParams *params, + bool hasMedia + ) = 0; + virtual void addParticipants ( + const std::list &addresses, + const CallSessionParams *params, + bool hasMedia + ) = 0; virtual bool canHandleParticipants () const = 0; - virtual std::shared_ptr findParticipant (const IdentityAddress &addr) const = 0; + virtual std::shared_ptr findParticipant (const IdentityAddress &participantAddress) const = 0; virtual const IdentityAddress &getConferenceAddress () const = 0; virtual std::shared_ptr getMe () const = 0; virtual int getParticipantCount () const = 0;