diff --git a/src/c-wrapper/api/c-chat-room.cpp b/src/c-wrapper/api/c-chat-room.cpp index dd3d35c40..3fac4d189 100644 --- a/src/c-wrapper/api/c-chat-room.cpp +++ b/src/c-wrapper/api/c-chat-room.cpp @@ -23,8 +23,9 @@ #include "linphone/api/c-chat-room.h" #include "linphone/wrapper_utils.h" -#include "c-wrapper/c-wrapper.h" #include "address/identity-address.h" +#include "c-wrapper/c-wrapper.h" +#include "chat/chat-message/chat-message-p.h" #include "chat/chat-room/basic-chat-room.h" #include "chat/chat-room/client-group-chat-room.h" #include "chat/chat-room/real-time-text-chat-room-p.h" @@ -183,7 +184,11 @@ int linphone_chat_room_get_history_size (LinphoneChatRoom *cr) { } void linphone_chat_room_delete_message (LinphoneChatRoom *cr, LinphoneChatMessage *msg) { - L_GET_CPP_PTR_FROM_C_OBJECT(cr)->deleteMessage(L_GET_CPP_PTR_FROM_C_OBJECT(msg)); + shared_ptr event = LinphonePrivate::MainDb::getEventFromKey( + L_GET_PRIVATE_FROM_C_OBJECT(msg)->dbKey + ); + if (event) + LinphonePrivate::EventLog::deleteFromDatabase(event); } void linphone_chat_room_delete_history (LinphoneChatRoom *cr) { diff --git a/src/chat/chat-room/chat-room.cpp b/src/chat/chat-room/chat-room.cpp index 4c70fa249..a49416b49 100644 --- a/src/chat/chat-room/chat-room.cpp +++ b/src/chat/chat-room/chat-room.cpp @@ -383,10 +383,6 @@ void ChatRoom::deleteHistory () { // TODO: history. } -void ChatRoom::deleteMessage (const shared_ptr &msg) { - // TODO: history. -} - shared_ptr ChatRoom::findMessage (const string &messageId) { L_D(); shared_ptr cm = nullptr; diff --git a/src/chat/chat-room/chat-room.h b/src/chat/chat-room/chat-room.h index a4d6c126a..6c988a583 100644 --- a/src/chat/chat-room/chat-room.h +++ b/src/chat/chat-room/chat-room.h @@ -66,7 +66,6 @@ public: std::shared_ptr createMessage (const std::string &msg); std::shared_ptr createMessage (); void deleteHistory (); - void deleteMessage (const std::shared_ptr &msg); std::shared_ptr findMessage (const std::string &messageId); std::shared_ptr findMessageWithDirection (const std::string &messageId, ChatMessage::Direction direction); std::list> getHistory (int nbMessages);