Commit 60708a53 authored by Simon Morlat's avatar Simon Morlat
Browse files

repair message storage

parent c82307a7
......@@ -187,7 +187,7 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia
ms_message("Media ip type has changed, destroying sessions context on call [%p]",call);
ms_media_stream_sessions_uninit(&call->sessions[call->main_audio_stream_index]);
ms_media_stream_sessions_uninit(&call->sessions[call->main_video_stream_index]);
if (call->params->realtimetext_enabled) ms_media_stream_sessions_uninit(&call->sessions[call->main_text_stream_index]);
ms_media_stream_sessions_uninit(&call->sessions[call->main_text_stream_index]);
}
linphone_call_init_media_streams (call);
}
......
......@@ -2947,7 +2947,7 @@ int linphone_core_restart_invite(LinphoneCore *lc, LinphoneCall *call){
linphone_call_stop_media_streams(call);
ms_media_stream_sessions_uninit(&call->sessions[call->main_audio_stream_index]);
ms_media_stream_sessions_uninit(&call->sessions[call->main_video_stream_index]);
if (call->params->realtimetext_enabled) ms_media_stream_sessions_uninit(&call->sessions[call->main_text_stream_index]);
ms_media_stream_sessions_uninit(&call->sessions[call->main_text_stream_index]);
linphone_call_init_media_streams(call);
return linphone_core_start_invite(lc,call, NULL);
}
......
......@@ -468,12 +468,13 @@ MSList *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int startm, i
ms_free(buf);
buf = buf2;
}
begin=ortp_get_cur_time_ms();
linphone_sql_request_message(lc->db,buf,cr);
end=ortp_get_cur_time_ms();
if (endm+1-startm > 1) {
//display message only if at least 2 messages are loaded
begin=ortp_get_cur_time_ms();
linphone_sql_request_message(lc->db,buf,cr);
end=ortp_get_cur_time_ms();
ms_message("%s(): completed in %i ms",__FUNCTION__, (int)(end-begin));
}
ms_free(buf);
......
......@@ -1241,8 +1241,16 @@ static void history_count(void) {
messages=linphone_chat_room_get_history(chatroom,0);
BC_ASSERT_EQUAL(linphone_chat_room_get_history_size(chatroom), 1270, int, "%d");
BC_ASSERT_EQUAL(ms_list_size(messages), 1270, int, "%d");
/*check the second most recent msg*/
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->next->data), "Fore and aft follow each other.");
BC_ASSERT_PTR_NOT_NULL(messages);
if (messages){
BC_ASSERT_PTR_NOT_NULL(messages->next->data);
if (messages->next->data){
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->next->data), "Fore and aft follow each other.");
}
}
ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
/*test offset+limit: retrieve the 42th latest msg only and check its content*/
......
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