Commit c53f70e2 authored by Gautier Pelloux-Prayer's avatar Gautier Pelloux-Prayer
Browse files

Fix erroneous documentation from conversation history new methods

parent da96438e
......@@ -1355,7 +1355,7 @@ LINPHONE_PUBLIC void linphone_chat_room_delete_history(LinphoneChatRoom *cr);
LINPHONE_PUBLIC int linphone_chat_room_get_history_size(LinphoneChatRoom *cr);
/**
* Gets the partial list of messages in the given range, sorted from most recent to oldest.
* Gets the partial list of messages in the given range, sorted from oldest to most recent.
* @param[in] cr The #LinphoneChatRoom object corresponding to the conversation for which messages should be retrieved
* @param[in] begin The first message of the range to be retrieved. History most recent message has index 0.
* @param[in] end The last message of the range to be retrieved. History oldest message has index of history size - 1 (use #linphone_chat_room_get_history_size to retrieve history size)
......
......@@ -112,7 +112,7 @@ void linphone_sql_request_message(sqlite3 *db,const char *stmt,LinphoneChatRoom
int ret;
ret=sqlite3_exec(db,stmt,callback,cr,&errmsg);
if(ret != SQLITE_OK) {
ms_error("Error in creation: %s.\n", errmsg);
ms_error("Error in creation: %s.", errmsg);
sqlite3_free(errmsg);
}
}
......@@ -122,7 +122,7 @@ int linphone_sql_request(sqlite3* db,const char *stmt){
int ret;
ret=sqlite3_exec(db,stmt,NULL,NULL,&errmsg);
if(ret != SQLITE_OK) {
ms_error("linphone_sql_request: error sqlite3_exec(): %s.\n", errmsg);
ms_error("linphone_sql_request: error sqlite3_exec(): %s.", errmsg);
sqlite3_free(errmsg);
}
return ret;
......@@ -134,7 +134,7 @@ void linphone_sql_request_all(sqlite3* db,const char *stmt, LinphoneCore* lc){
int ret;
ret=sqlite3_exec(db,stmt,callback_all,lc,&errmsg);
if(ret != SQLITE_OK) {
ms_error("linphone_sql_request_all: error sqlite3_exec(): %s.\n", errmsg);
ms_error("linphone_sql_request_all: error sqlite3_exec(): %s.", errmsg);
sqlite3_free(errmsg);
}
}
......@@ -285,6 +285,8 @@ MSList *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int startm, i
buf=ms_malloc(buf_max_size);
buf=sqlite3_snprintf(buf_max_size-1,buf,"SELECT * FROM history WHERE remoteContact = %Q ORDER BY id DESC",peer);
if (startm<0) startm=0;
if (endm>0&&endm>=startm){
buf=sqlite3_snprintf(buf_max_size-1,buf,"%s LIMIT %i ",buf,endm+1-startm);
}else if(startm>0){
......
......@@ -66,7 +66,7 @@ public interface LinphoneChatRoom {
LinphoneChatMessage[] getHistory(int limit);
/**
* Returns the chat history associated with the peer address associated with this chat room for the given range
* Returns the chat history associated with the peer address associated with this chat room for the given range, sorted from oldest to most recent
* @param begin the first (most recent) message to retrieve. Newest message has index 0. If negative, use value 0 instead.
* @param end the last (oldest) message to retrieve. Oldest message has value "history size" - 1 (equivalent to -1). If negative or lower than begin value, value is given, use -1.
* @return an array of LinphoneChatMessage, empty if nothing has been found
......
......@@ -824,6 +824,9 @@ static void message_storage_migration() {
// check that all messages have been migrated to the UTC time storage
CU_ASSERT(sqlite3_exec(marie->lc->db, "SELECT * FROM history WHERE time != '-1';", check_no_strange_time, NULL, NULL) == SQLITE_OK );
linphone_core_manager_destroy(marie);
remove(tmp_db);
}
static void history_messages_count() {
......@@ -859,9 +862,13 @@ static void history_messages_count() {
/*test limit without offset*/
CU_ASSERT_EQUAL(ms_list_size(linphone_chat_room_get_history_range(chatroom, 0, 5)), 6);
/*test invalid start*/
CU_ASSERT_EQUAL(ms_list_size(linphone_chat_room_get_history_range(chatroom, 1265, 1260)), 1270-1265);
}
linphone_core_manager_destroy(marie);
linphone_address_destroy(jehan_addr);
remove(tmp_db);
}
......
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