Commit 06de47db authored by Guillaume BIENKOWSKI's avatar Guillaume BIENKOWSKI

Fix a special case in message history retrieval.

This function is not yet completely tested, 
parent 96ca18f8
......@@ -371,7 +371,7 @@ MSList *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int startm, i
if (startm<0) startm=0;
if (endm>0&&endm>=startm){
if ((endm>0&&endm>=startm) || (startm == 0 && endm == 0) ){
buf2=ms_strdup_printf("%s LIMIT %i ",buf,endm+1-startm);
ms_free(buf);
buf = buf2;
......
......@@ -1045,6 +1045,10 @@ static void history_messages_count() {
CU_ASSERT_EQUAL(ms_list_size(messages), 10);
ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
messages=linphone_chat_room_get_history(chatroom,1);
CU_ASSERT_EQUAL(ms_list_size(messages), 1);
ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
messages=linphone_chat_room_get_history(chatroom,0);
CU_ASSERT_EQUAL(linphone_chat_room_get_history_size(chatroom), 1270);
CU_ASSERT_EQUAL(ms_list_size(messages), 1270);
......
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