diff --git a/src/address/address.cpp b/src/address/address.cpp index 5f8c30e34..228bf53ef 100644 --- a/src/address/address.cpp +++ b/src/address/address.cpp @@ -20,9 +20,9 @@ #include "linphone/utils/utils.h" #include "address-p.h" +#include "address/identity-address.h" #include "c-wrapper/c-wrapper.h" #include "logger/logger.h" -#include "address/identity-address.h" // ============================================================================= @@ -403,7 +403,7 @@ bool Address::setUriParams (const string &uriParams) { return true; } -bool Address::removeUriParam(const string &uriParamName) { +bool Address::removeUriParam (const string &uriParamName) { L_D(); if (!d->internalAddress) diff --git a/src/address/address.h b/src/address/address.h index 5ce007018..8f02ad263 100644 --- a/src/address/address.h +++ b/src/address/address.h @@ -101,7 +101,7 @@ public: const std::string &getUriParamValue (const std::string &uriParamName) const; bool setUriParam (const std::string &uriParamName, const std::string &uriParamValue = ""); bool setUriParams (const std::string &uriParams); - bool removeUriParam(const std::string &uriParamName); + bool removeUriParam (const std::string &uriParamName); private: L_DECLARE_PRIVATE(Address); diff --git a/src/address/identity-address.cpp b/src/address/identity-address.cpp index 16cc1b965..2c8800896 100644 --- a/src/address/identity-address.cpp +++ b/src/address/identity-address.cpp @@ -17,10 +17,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "linphone/utils/utils.h" - -#include "identity-address-p.h" #include "c-wrapper/c-wrapper.h" +#include "identity-address-p.h" #include "logger/logger.h" // ============================================================================= diff --git a/src/c-wrapper/api/c-chat-room.cpp b/src/c-wrapper/api/c-chat-room.cpp index 61cbd97e4..093ec5750 100644 --- a/src/c-wrapper/api/c-chat-room.cpp +++ b/src/c-wrapper/api/c-chat-room.cpp @@ -217,7 +217,7 @@ bctbx_list_t *linphone_chat_room_get_history_range_events (LinphoneChatRoom *cr, } LinphoneChatMessage *linphone_chat_room_get_last_message_in_history(LinphoneChatRoom *cr) { - shared_ptr cppPtr = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getLastMessageInHistory(); + shared_ptr cppPtr = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getLastChatMessageInHistory(); if (!cppPtr) return nullptr; diff --git a/src/chat/chat-room/chat-room.cpp b/src/chat/chat-room/chat-room.cpp index cf2ca6664..ce9e6af53 100644 --- a/src/chat/chat-room/chat-room.cpp +++ b/src/chat/chat-room/chat-room.cpp @@ -92,37 +92,6 @@ shared_ptr ChatRoomPrivate::createChatMessage (ChatMessage::Directi return shared_ptr(new ChatMessage(q->getSharedFromThis(), direction)); } -// ----------------------------------------------------------------------------- - -const ChatRoomId &ChatRoom::getChatRoomId () const { - L_D(); - return d->chatRoomId; -} - -const IdentityAddress &ChatRoom::getPeerAddress () const { - L_D(); - return d->chatRoomId.getPeerAddress(); -} - -const IdentityAddress &ChatRoom::getLocalAddress () const { - L_D(); - return d->chatRoomId.getLocalAddress(); -} - -// ----------------------------------------------------------------------------- - -time_t ChatRoom::getCreationTime () const { - L_D(); - return d->creationTime; -} - -time_t ChatRoom::getLastUpdateTime () const { - L_D(); - return d->lastUpdateTime; -} - -// ----------------------------------------------------------------------------- - list > ChatRoomPrivate::findMessages (const string &messageId) const { L_Q(); return q->getCore()->getPrivate()->mainDb->findChatMessages(q->getChatRoomId(), messageId); @@ -167,8 +136,6 @@ LinphoneReason ChatRoomPrivate::messageReceived (SalOp *op, const SalMessage *sa shared_ptr msg; shared_ptr core = q->getCore(); - if (!core) - return reason; LinphoneCore *cCore = core->getCCore(); msg = createChatMessage( @@ -349,6 +316,61 @@ ChatRoom::ChatRoom (ChatRoomPrivate &p, const shared_ptr &core, const Chat // ----------------------------------------------------------------------------- +const ChatRoomId &ChatRoom::getChatRoomId () const { + L_D(); + return d->chatRoomId; +} + +const IdentityAddress &ChatRoom::getPeerAddress () const { + L_D(); + return d->chatRoomId.getPeerAddress(); +} + +const IdentityAddress &ChatRoom::getLocalAddress () const { + L_D(); + return d->chatRoomId.getLocalAddress(); +} + +// ----------------------------------------------------------------------------- + +time_t ChatRoom::getCreationTime () const { + L_D(); + return d->creationTime; +} + +time_t ChatRoom::getLastUpdateTime () const { + L_D(); + return d->lastUpdateTime; +} + +// ----------------------------------------------------------------------------- + +list> ChatRoom::getHistory (int nLast) { + return getCore()->getPrivate()->mainDb->getHistory(getChatRoomId(), nLast); +} + +list> ChatRoom::getHistoryRange (int begin, int end) { + return getCore()->getPrivate()->mainDb->getHistoryRange(getChatRoomId(), begin, end); +} + +int ChatRoom::getHistorySize () { + return getCore()->getPrivate()->mainDb->getChatMessagesCount(getChatRoomId()); +} + +shared_ptr ChatRoom::getLastChatMessageInHistory() const { + return getCore()->getPrivate()->mainDb->getLastChatMessage(getChatRoomId()); +} + +void ChatRoom::deleteHistory () { + getCore()->getPrivate()->mainDb->cleanHistory(getChatRoomId()); +} + +int ChatRoom::getUnreadChatMessagesCount () { + return getCore()->getPrivate()->mainDb->getUnreadChatMessagesCount(getChatRoomId()); +} + +// ----------------------------------------------------------------------------- + void ChatRoom::compose () { L_D(); if (!d->isComposing) { @@ -379,10 +401,6 @@ shared_ptr ChatRoom::createMessage () { return d->createChatMessage(ChatMessage::Direction::Outgoing); } -void ChatRoom::deleteHistory () { - getCore()->getPrivate()->mainDb->cleanHistory(getChatRoomId()); -} - shared_ptr ChatRoom::findMessage (const string &messageId) { L_D(); shared_ptr cm = nullptr; @@ -406,26 +424,6 @@ shared_ptr ChatRoom::findMessageWithDirection (const string &messag return ret; } -list> ChatRoom::getHistory (int nLast) { - return getCore()->getPrivate()->mainDb->getHistory(getChatRoomId(), nLast); -} - -list> ChatRoom::getHistoryRange (int begin, int end) { - return getCore()->getPrivate()->mainDb->getHistoryRange(getChatRoomId(), begin, end); -} - -int ChatRoom::getHistorySize () { - return getCore()->getPrivate()->mainDb->getChatMessagesCount(getChatRoomId()); -} - -shared_ptr ChatRoom::getLastMessageInHistory() const { - return getCore()->getPrivate()->mainDb->getLastChatMessage(getChatRoomId()); -} - -int ChatRoom::getUnreadChatMessagesCount () { - return getCore()->getPrivate()->mainDb->getUnreadChatMessagesCount(getChatRoomId()); -} - bool ChatRoom::isRemoteComposing () const { L_D(); return d->remoteIsComposing.size() > 0; diff --git a/src/chat/chat-room/chat-room.h b/src/chat/chat-room/chat-room.h index 62c387c52..36dd0e998 100644 --- a/src/chat/chat-room/chat-room.h +++ b/src/chat/chat-room/chat-room.h @@ -64,17 +64,19 @@ public: std::list> getHistoryRange (int begin, int end); int getHistorySize (); - std::shared_ptr getLastMessageInHistory () const; + std::shared_ptr getLastChatMessageInHistory () const; + + void deleteHistory (); + + int getUnreadChatMessagesCount (); // TODO: Remove useless functions. void compose (); std::shared_ptr createFileTransferMessage (const LinphoneContent *initialContent); std::shared_ptr createMessage (const std::string &msg); std::shared_ptr createMessage (); - void deleteHistory (); std::shared_ptr findMessage (const std::string &messageId); std::shared_ptr findMessageWithDirection (const std::string &messageId, ChatMessage::Direction direction); - int getUnreadChatMessagesCount (); bool isRemoteComposing () const; std::list
getComposingAddresses () const;