Fix a special case in message history retrieval.

This function is not yet completely tested,
This commit is contained in:
Guillaume BIENKOWSKI 2014-11-26 13:40:53 +01:00
parent 96ca18f8db
commit 06de47db2e
2 changed files with 5 additions and 1 deletions

View file

@ -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;

View file

@ -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);