mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-04-29 23:26:23 +00:00
fix index issue in data base
This commit is contained in:
parent
a6b6b7aeb4
commit
81ff3c8813
3 changed files with 10 additions and 10 deletions
|
|
@ -218,7 +218,10 @@ bctbx_list_t *linphone_chat_room_get_history_range_events (LinphoneChatRoom *cr,
|
||||||
}
|
}
|
||||||
|
|
||||||
LinphoneChatMessage *linphone_chat_room_get_last_message_in_history(LinphoneChatRoom *cr) {
|
LinphoneChatMessage *linphone_chat_room_get_last_message_in_history(LinphoneChatRoom *cr) {
|
||||||
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getLastMessageInHistory());
|
shared_ptr<LinphonePrivate::ChatMessage> cppPtr = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getLastMessageInHistory();
|
||||||
|
LinphoneChatMessage *object = L_INIT(ChatMessage);
|
||||||
|
L_SET_CPP_PTR_FROM_C_OBJECT(object, cppPtr);
|
||||||
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinphoneChatMessage *linphone_chat_room_find_message (LinphoneChatRoom *cr, const char *message_id) {
|
LinphoneChatMessage *linphone_chat_room_find_message (LinphoneChatRoom *cr, const char *message_id) {
|
||||||
|
|
|
||||||
|
|
@ -1391,19 +1391,16 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
|
||||||
return list<shared_ptr<ChatMessage>>();
|
return list<shared_ptr<ChatMessage>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<ChatMessage> MainDb::getLastChatMessage(const ChatRoomId &chatRoomId) const {
|
shared_ptr<ChatMessage> MainDb::getLastChatMessage (const ChatRoomId &chatRoomId) const {
|
||||||
list<shared_ptr<EventLog>> chatList = getHistory (chatRoomId, 1, Filter::ConferenceChatMessageFilter);
|
list<shared_ptr<EventLog>> chatList = getHistory(chatRoomId, 1, Filter::ConferenceChatMessageFilter);
|
||||||
if (chatList.size() == 0)
|
if (chatList.empty())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
L_ASSERT(chatList.size() == 1);
|
return static_pointer_cast<ConferenceChatMessageEvent>(chatList.front())->getChatMessage();
|
||||||
shared_ptr<EventLog> chatEvent = chatList.front();
|
|
||||||
L_ASSERT(chatEvent->getType() == EventLog::Type::ConferenceChatMessage);
|
|
||||||
return static_pointer_cast<ConferenceChatMessageEvent>(chatEvent)->getChatMessage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
list<shared_ptr<EventLog>> MainDb::getHistory (const ChatRoomId &chatRoomId, int nLast, FilterMask mask) const {
|
list<shared_ptr<EventLog>> MainDb::getHistory (const ChatRoomId &chatRoomId, int nLast, FilterMask mask) const {
|
||||||
return getHistoryRange(chatRoomId, 0, nLast - 1, mask);
|
return getHistoryRange(chatRoomId, 0, nLast, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
list<shared_ptr<EventLog>> MainDb::getHistoryRange (
|
list<shared_ptr<EventLog>> MainDb::getHistoryRange (
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ public:
|
||||||
int getUnreadChatMessagesCount (const ChatRoomId &chatRoomId = ChatRoomId()) const;
|
int getUnreadChatMessagesCount (const ChatRoomId &chatRoomId = ChatRoomId()) const;
|
||||||
void markChatMessagesAsRead (const ChatRoomId &chatRoomId = ChatRoomId()) const;
|
void markChatMessagesAsRead (const ChatRoomId &chatRoomId = ChatRoomId()) const;
|
||||||
std::list<std::shared_ptr<ChatMessage>> getUnreadChatMessages (const ChatRoomId &chatRoomId = ChatRoomId()) const;
|
std::list<std::shared_ptr<ChatMessage>> getUnreadChatMessages (const ChatRoomId &chatRoomId = ChatRoomId()) const;
|
||||||
std::shared_ptr<ChatMessage> getLastChatMessage(const ChatRoomId &chatRoomId = ChatRoomId()) const;
|
std::shared_ptr<ChatMessage> getLastChatMessage (const ChatRoomId &chatRoomId = ChatRoomId()) const;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Conference events.
|
// Conference events.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue