mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-30 09:49:26 +00:00
feat(MainDb): supports getHistory and getHistoryRange
This commit is contained in:
parent
84ef68ebc1
commit
6467c77042
3 changed files with 18 additions and 12 deletions
|
|
@ -906,16 +906,10 @@ MainDb::MainDb () : AbstractDb(*new MainDbPrivate) {}
|
|||
}
|
||||
|
||||
list<shared_ptr<EventLog>> MainDb::getHistory (const string &peerAddress, int nLast, FilterMask mask) const {
|
||||
if (!isConnected()) {
|
||||
lWarning() << "Unable to get history. Not connected.";
|
||||
return list<shared_ptr<EventLog>>();
|
||||
}
|
||||
|
||||
// TODO.
|
||||
return list<shared_ptr<EventLog>>();
|
||||
return getHistoryRange(peerAddress, 0, nLast - 1, mask);
|
||||
}
|
||||
|
||||
list<shared_ptr<EventLog>> MainDb::getHistory (
|
||||
list<shared_ptr<EventLog>> MainDb::getHistoryRange (
|
||||
const string &peerAddress,
|
||||
int begin,
|
||||
int end,
|
||||
|
|
@ -1228,7 +1222,7 @@ shared_ptr<ChatRoom> MainDb::findChatRoom (const string &peerAddress) const {
|
|||
return list<shared_ptr<EventLog>>();
|
||||
}
|
||||
|
||||
list<shared_ptr<EventLog>> MainDb::getHistory (const string &, int, int, FilterMask) const {
|
||||
list<shared_ptr<EventLog>> MainDb::getHistoryRange (const string &, int, int, FilterMask) const {
|
||||
return list<shared_ptr<EventLog>>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public:
|
|||
int nLast,
|
||||
FilterMask mask = NoFilter
|
||||
) const;
|
||||
std::list<std::shared_ptr<EventLog>> getHistory (
|
||||
std::list<std::shared_ptr<EventLog>> getHistoryRange (
|
||||
const std::string &peerAddress,
|
||||
int begin,
|
||||
int end,
|
||||
|
|
|
|||
|
|
@ -68,17 +68,29 @@ static void get_history () {
|
|||
MainDb mainDb;
|
||||
BC_ASSERT_TRUE(mainDb.connect(MainDb::Sqlite3, getDatabasePath()));
|
||||
BC_ASSERT_EQUAL(
|
||||
mainDb.getHistory("sip:test-39@sip.linphone.org", 0, -1, MainDb::Filter::ConferenceChatMessageFilter).size(),
|
||||
mainDb.getHistoryRange("sip:test-39@sip.linphone.org", 0, -1, MainDb::Filter::ConferenceChatMessageFilter).size(),
|
||||
3,
|
||||
int,
|
||||
"%d"
|
||||
);
|
||||
BC_ASSERT_EQUAL(
|
||||
mainDb.getHistory("sip:test-7@sip.linphone.org", 0, -1, MainDb::Filter::ConferenceCallFilter).size(),
|
||||
mainDb.getHistoryRange("sip:test-7@sip.linphone.org", 0, -1, MainDb::Filter::ConferenceCallFilter).size(),
|
||||
0,
|
||||
int,
|
||||
"%d"
|
||||
);
|
||||
BC_ASSERT_EQUAL(
|
||||
mainDb.getHistoryRange("sip:test-1@sip.linphone.org", 0, -1, MainDb::Filter::ConferenceChatMessageFilter).size(),
|
||||
862,
|
||||
int,
|
||||
"%d"
|
||||
);
|
||||
BC_ASSERT_EQUAL(
|
||||
mainDb.getHistory("sip:test-1@sip.linphone.org", 100, MainDb::Filter::ConferenceChatMessageFilter).size(),
|
||||
100,
|
||||
int,
|
||||
"%d"
|
||||
);
|
||||
}
|
||||
|
||||
test_t main_db_tests[] = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue