Commit d5347f4b authored by Ghislain MARY's avatar Ghislain MARY

Restore check of transient messages in message tester.

parent c74511d4
......@@ -21,10 +21,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "private.h"
#include "call/call-p.h"
#include "chat/chat-room/chat-room.h"
#include "chat/chat-room/chat-room-p.h"
#include "core/core-p.h"
#include "c-wrapper/c-wrapper.h"
#include "conference/session/media-session-p.h"
#include "event-log/conference/conference-chat-message-event.h"
using namespace std;
......@@ -159,3 +160,18 @@ void _linphone_chat_room_enable_migration(LinphoneChatRoom *cr, bool_t enable) {
shared_ptr<AbstractChatRoom> acr = L_GET_CPP_PTR_FROM_C_OBJECT(cr);
L_GET_PRIVATE(acr->getCore())->mainDb->enableChatRoomMigration(acr->getChatRoomId(), !!enable);
}
int _linphone_chat_room_get_transient_message_count (const LinphoneChatRoom *cr) {
shared_ptr<const ChatRoom> chatRoom = static_pointer_cast<const ChatRoom>(L_GET_CPP_PTR_FROM_C_OBJECT(cr));
return (int)L_GET_PRIVATE(chatRoom)->transientEvents.size();
}
LinphoneChatMessage * _linphone_chat_room_get_first_transient_message (const LinphoneChatRoom *cr) {
shared_ptr<const ChatRoom> chatRoom = static_pointer_cast<const ChatRoom>(L_GET_CPP_PTR_FROM_C_OBJECT(cr));
if (L_GET_PRIVATE(chatRoom)->transientEvents.empty())
return nullptr;
shared_ptr<ConferenceChatMessageEvent> event = static_pointer_cast<ConferenceChatMessageEvent>(
L_GET_PRIVATE(chatRoom)->transientEvents.front()
);
return L_GET_C_BACK_PTR(event->getChatMessage());
}
\ No newline at end of file
......@@ -104,6 +104,8 @@ LINPHONE_PUBLIC LinphoneQualityReporting *linphone_call_log_get_quality_reportin
LINPHONE_PUBLIC reporting_session_report_t **linphone_quality_reporting_get_reports(LinphoneQualityReporting *qreporting);
LINPHONE_PUBLIC void _linphone_chat_room_enable_migration(LinphoneChatRoom *cr, bool_t enable);
LINPHONE_PUBLIC int _linphone_chat_room_get_transient_message_count (const LinphoneChatRoom *cr);
LINPHONE_PUBLIC LinphoneChatMessage * _linphone_chat_room_get_first_transient_message (const LinphoneChatRoom *cr);
LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list);
LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc);
......
......@@ -66,6 +66,7 @@ public:
void onIsRemoteComposingStateChanged (const Address &remoteAddress, bool isComposing) override;
std::list<IdentityAddress> remoteIsComposing;
std::list<std::shared_ptr<EventLog>> transientEvents;
ChatRoomId chatRoomId;
......@@ -79,7 +80,6 @@ private:
std::unique_ptr<IsComposing> isComposingHandler;
bool isComposing = false;
std::list<std::shared_ptr<EventLog>> transientEvents;
L_DECLARE_PUBLIC(ChatRoom);
};
......
......@@ -365,7 +365,6 @@ static void text_message_with_privacy(void) {
linphone_proxy_config_set_privacy(linphone_core_get_default_proxy_config(pauline->lc),LinphonePrivacyId);
text_message_base(marie, pauline);
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1, int, "%d");
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
......@@ -420,15 +419,15 @@ static void text_message_with_send_error(void) {
linphone_chat_room_send_chat_message(chat_room,msg);
/* check transient msg list: the msg should be in it, and should be the only one */
/*BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(linphone_chat_room_get_transient_messages(chat_room)), 1, unsigned int, "%u");
BC_ASSERT_PTR_EQUAL(bctbx_list_nth_data(linphone_chat_room_get_transient_messages(chat_room),0), msg);*/
BC_ASSERT_EQUAL(_linphone_chat_room_get_transient_message_count(chat_room), 1, int, "%d");
BC_ASSERT_PTR_EQUAL(_linphone_chat_room_get_first_transient_message(chat_room), msg);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageNotDelivered,1));
/*BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageInProgress,1, int, "%d");*/
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageReceived,0, int, "%d");
/* the msg should have been discarded from transient list after an error */
//BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(linphone_chat_room_get_transient_messages(chat_room)), 0, unsigned int, "%u");
BC_ASSERT_EQUAL(_linphone_chat_room_get_transient_message_count(chat_room), 0, int, "%d");
sal_set_send_error(linphone_core_get_sal(marie->lc), 0);
......@@ -436,6 +435,7 @@ static void text_message_with_send_error(void) {
linphone_core_refresh_registers(marie->lc);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneRegistrationOk,marie->stat.number_of_LinphoneRegistrationOk + 1));
linphone_chat_message_unref(msg);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment