Commit c26031d7 authored by Ronan's avatar Ronan
Browse files

feat(c-chat-room): provide a way to get history events

parent 18690440
......@@ -165,7 +165,7 @@ LINPHONE_PUBLIC int linphone_chat_room_get_history_size(LinphoneChatRoom *cr);
* @param[in] nb_message Number of message to retrieve. 0 means everything.
* @return \bctbx_list{LinphoneChatMessage}
*/
LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history(LinphoneChatRoom *cr,int nb_message);
LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history (LinphoneChatRoom *cr,int nb_message);
/**
* Gets the partial list of messages in the given range, sorted from oldest to most recent.
......@@ -176,6 +176,23 @@ LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history(LinphoneChatRoom *c
*/
LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int begin, int end);
/**
* Gets nb_events most recent events from cr chat room, sorted from oldest to most recent.
* @param[in] cr The #LinphoneChatRoom object corresponding to the conversation for which events should be retrieved
* @param[in] nb_events Number of events to retrieve. 0 means everything.
* @return \bctbx_list{LinphoneEventLog}
*/
LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history_events (LinphoneChatRoom *cr, int nb_events);
/**
* Gets the partial list of events in the given range, sorted from oldest to most recent.
* @param[in] cr The #LinphoneChatRoom object corresponding to the conversation for which events should be retrieved
* @param[in] begin The first event of the range to be retrieved. History most recent event has index 0.
* @param[in] end The last event of the range to be retrieved. History oldest event has index of history size - 1
* @return \bctbx_list{LinphoneEventLog}
*/
LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history_range_events (LinphoneChatRoom *cr, int begin, int end);
LINPHONE_PUBLIC LinphoneChatMessage * linphone_chat_room_find_message(LinphoneChatRoom *cr, const char *message_id);
/**
......
......@@ -23,11 +23,13 @@
#include "linphone/wrapper_utils.h"
#include "linphone/api/c-chat-room.h"
#include "event-log/event-log.h"
#include "c-wrapper/c-wrapper.h"
#include "chat/chat-room/basic-chat-room.h"
#include "chat/chat-room/client-group-chat-room.h"
#include "chat/chat-room/real-time-text-chat-room-p.h"
#include "conference/participant.h"
#include "core/core-p.h"
// =============================================================================
......@@ -201,6 +203,25 @@ bctbx_list_t *linphone_chat_room_get_history (LinphoneChatRoom *cr, int nb_messa
return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getHistory(nb_message));
}
bctbx_list_t *linphone_chat_room_get_history_events (LinphoneChatRoom *cr, int nb_events) {
return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(
L_GET_PRIVATE(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getCore()->cppCore)->mainDb.getHistory(
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getPeerAddress().asStringUriOnly(),
nb_events
)
);
}
bctbx_list_t *linphone_chat_room_get_history_range_events (LinphoneChatRoom *cr, int begin, int end) {
return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(
L_GET_PRIVATE(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getCore()->cppCore)->mainDb.getHistory(
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getPeerAddress().asStringUriOnly(),
begin,
end
)
);
}
LinphoneChatMessage *linphone_chat_room_find_message (LinphoneChatRoom *cr, const char *message_id) {
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->findMessage(message_id));
}
......
......@@ -413,7 +413,7 @@ public:
template<
typename CppType,
typename = typename std::enable_if<IsDefinedCppObject<CppType>::value, CppType>::type
typename = typename std::enable_if<IsDefinedBaseCppObject<CppType>::value, CppType>::type
>
static inline bctbx_list_t *getResolvedCListFromCppList (const std::list<std::shared_ptr<CppType>> &cppList) {
bctbx_list_t *result = nullptr;
......
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