mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
Added methods to get only a list of ChatMessageEventLog from a ChatRoom
This commit is contained in:
parent
884ddffb7d
commit
107aa11e13
7 changed files with 51 additions and 3 deletions
|
|
@ -179,6 +179,23 @@ LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history (LinphoneChatRoom *
|
|||
*/
|
||||
LINPHONE_PUBLIC bctbx_list_t *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int begin, int end);
|
||||
|
||||
/**
|
||||
* Gets nb_events most recent chat message 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_message_events (LinphoneChatRoom *cr, int nb_events);
|
||||
|
||||
/**
|
||||
* Gets the partial list of chat message 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_message_events (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
|
||||
|
|
|
|||
|
|
@ -204,9 +204,8 @@ void linphone_chat_room_delete_history (LinphoneChatRoom *cr) {
|
|||
|
||||
bctbx_list_t *linphone_chat_room_get_history_range (LinphoneChatRoom *cr, int startm, int endm) {
|
||||
list<shared_ptr<LinphonePrivate::ChatMessage>> chatMessages;
|
||||
for (auto &event : L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getHistoryRange(startm, endm))
|
||||
if (event->getType() == LinphonePrivate::EventLog::Type::ConferenceChatMessage)
|
||||
chatMessages.push_back(static_pointer_cast<LinphonePrivate::ConferenceChatMessageEvent>(event)->getChatMessage());
|
||||
for (auto &event : L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getMessageHistoryRange(startm, endm))
|
||||
chatMessages.push_back(static_pointer_cast<LinphonePrivate::ConferenceChatMessageEvent>(event)->getChatMessage());
|
||||
|
||||
return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(chatMessages);
|
||||
}
|
||||
|
|
@ -215,6 +214,14 @@ bctbx_list_t *linphone_chat_room_get_history (LinphoneChatRoom *cr, int nb_messa
|
|||
return linphone_chat_room_get_history_range(cr, 0, nb_message);
|
||||
}
|
||||
|
||||
bctbx_list_t *linphone_chat_room_get_history_range_message_events (LinphoneChatRoom *cr, int startm, int endm) {
|
||||
return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getMessageHistoryRange(startm, endm));
|
||||
}
|
||||
|
||||
bctbx_list_t *linphone_chat_room_get_history_message_events (LinphoneChatRoom *cr, int nb_events) {
|
||||
return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getMessageHistory(nb_events));
|
||||
}
|
||||
|
||||
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_CPP_PTR_FROM_C_OBJECT(cr)->getHistory(nb_events));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,8 @@ public:
|
|||
virtual State getState () const = 0;
|
||||
virtual bool hasBeenLeft () const = 0;
|
||||
|
||||
virtual std::list<std::shared_ptr<EventLog>> getMessageHistory (int nLast) const = 0;
|
||||
virtual std::list<std::shared_ptr<EventLog>> getMessageHistoryRange (int begin, int end) const = 0;
|
||||
virtual std::list<std::shared_ptr<EventLog>> getHistory (int nLast) const = 0;
|
||||
virtual std::list<std::shared_ptr<EventLog>> getHistoryRange (int begin, int end) const = 0;
|
||||
virtual int getHistorySize () const = 0;
|
||||
|
|
|
|||
|
|
@ -321,6 +321,14 @@ ChatRoom::State ChatRoom::getState () const {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
list<shared_ptr<EventLog>> ChatRoom::getMessageHistory (int nLast) const {
|
||||
return getCore()->getPrivate()->mainDb->getHistory(getChatRoomId(), nLast, MainDb::Filter::ConferenceChatMessageFilter);
|
||||
}
|
||||
|
||||
list<shared_ptr<EventLog>> ChatRoom::getMessageHistoryRange (int begin, int end) const {
|
||||
return getCore()->getPrivate()->mainDb->getHistoryRange(getChatRoomId(), begin, end, MainDb::Filter::ConferenceChatMessageFilter);
|
||||
}
|
||||
|
||||
list<shared_ptr<EventLog>> ChatRoom::getHistory (int nLast) const {
|
||||
return getCore()->getPrivate()->mainDb->getHistory(getChatRoomId(), nLast);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ public:
|
|||
|
||||
State getState () const override;
|
||||
|
||||
std::list<std::shared_ptr<EventLog>> getMessageHistory (int nLast) const override;
|
||||
std::list<std::shared_ptr<EventLog>> getMessageHistoryRange (int begin, int end) const override;
|
||||
std::list<std::shared_ptr<EventLog>> getHistory (int nLast) const override;
|
||||
std::list<std::shared_ptr<EventLog>> getHistoryRange (int begin, int end) const override;
|
||||
int getHistorySize () const override;
|
||||
|
|
|
|||
|
|
@ -195,6 +195,16 @@ bool ProxyChatRoom::hasBeenLeft () const {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
list<shared_ptr<EventLog>> ProxyChatRoom::getMessageHistory (int nLast) const {
|
||||
L_D();
|
||||
return d->chatRoom->getMessageHistory(nLast);
|
||||
}
|
||||
|
||||
list<shared_ptr<EventLog>> ProxyChatRoom::getMessageHistoryRange (int begin, int end) const {
|
||||
L_D();
|
||||
return d->chatRoom->getMessageHistoryRange(begin, end);
|
||||
}
|
||||
|
||||
list<shared_ptr<EventLog>> ProxyChatRoom::getHistory (int nLast) const {
|
||||
L_D();
|
||||
return d->chatRoom->getHistory(nLast);
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ public:
|
|||
State getState () const override;
|
||||
bool hasBeenLeft () const override;
|
||||
|
||||
std::list<std::shared_ptr<EventLog>> getMessageHistory (int nLast) const override;
|
||||
std::list<std::shared_ptr<EventLog>> getMessageHistoryRange (int begin, int end) const override;
|
||||
std::list<std::shared_ptr<EventLog>> getHistory (int nLast) const override;
|
||||
std::list<std::shared_ptr<EventLog>> getHistoryRange (int begin, int end) const override;
|
||||
int getHistorySize () const override;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue