Commit 44507caa authored by Ronan's avatar Ronan

feat(MainDb): fetch in progress

parent 353411e1
......@@ -50,6 +50,14 @@ private:
// Events API.
// ---------------------------------------------------------------------------
std::shared_ptr<EventLog> selectEvent (long eventId, EventLog::Type type, time_t date) const;
std::shared_ptr<EventLog> selectConferenceEvent (long eventId, EventLog::Type type, time_t date) const;
std::shared_ptr<EventLog> selectConferenceCallEvent (long eventId, EventLog::Type type, time_t date) const;
std::shared_ptr<EventLog> selectConferenceChatMessageEvent (long eventId, EventLog::Type type, time_t date) const;
std::shared_ptr<EventLog> selectConferenceParticipantEvent (long eventId, EventLog::Type type, time_t date) const;
std::shared_ptr<EventLog> selectConferenceParticipantDeviceEvent (long eventId, EventLog::Type type, time_t date) const;
std::shared_ptr<EventLog> selectConferenceSubjectEvent (long eventId, EventLog::Type type, time_t date) const;
long insertEvent (const EventLog &eventLog);
long insertConferenceEvent (const EventLog &eventLog, long *chatRoomId = nullptr);
long insertConferenceCallEvent (const EventLog &eventLog);
......
......@@ -203,6 +203,71 @@ MainDb::MainDb () : AbstractDb(*new MainDbPrivate) {}
soci::use(eventId), soci::use(sipAddressId), soci::use(state);
}
// -----------------------------------------------------------------------------
shared_ptr<EventLog> MainDbPrivate::selectEvent (long eventId, EventLog::Type type, time_t date) const {
switch (type) {
case EventLog::Type::None:
return nullptr;
case EventLog::Type::ConferenceCreated:
case EventLog::Type::ConferenceDestroyed:
return selectConferenceEvent(eventId, type, date);
case EventLog::Type::CallStart:
case EventLog::Type::CallEnd:
return selectConferenceCallEvent(eventId, type, date);
case EventLog::Type::ConferenceChatMessage:
return selectConferenceChatMessageEvent(eventId, type, date);
case EventLog::Type::ConferenceParticipantAdded:
case EventLog::Type::ConferenceParticipantRemoved:
case EventLog::Type::ConferenceParticipantSetAdmin:
case EventLog::Type::ConferenceParticipantUnsetAdmin:
return selectConferenceParticipantEvent(eventId, type, date);
case EventLog::Type::ConferenceParticipantDeviceAdded:
case EventLog::Type::ConferenceParticipantDeviceRemoved:
return selectConferenceParticipantDeviceEvent(eventId, type, date);
case EventLog::Type::ConferenceSubjectChanged:
return selectConferenceSubjectEvent(eventId, type, date);
}
return nullptr;
}
shared_ptr<EventLog> MainDbPrivate::selectConferenceEvent (long eventId, EventLog::Type type, time_t date) const {
// TODO.
return nullptr;
}
shared_ptr<EventLog> MainDbPrivate::selectConferenceCallEvent (long eventId, EventLog::Type type, time_t date) const {
// TODO.
return nullptr;
}
shared_ptr<EventLog> MainDbPrivate::selectConferenceChatMessageEvent (long eventId, EventLog::Type type, time_t date) const {
// TODO.
return nullptr;
}
shared_ptr<EventLog> MainDbPrivate::selectConferenceParticipantEvent (long eventId, EventLog::Type type, time_t date) const {
// TODO.
return nullptr;
}
shared_ptr<EventLog> MainDbPrivate::selectConferenceParticipantDeviceEvent (long eventId, EventLog::Type type, time_t date) const {
// TODO.
return nullptr;
}
shared_ptr<EventLog> MainDbPrivate::selectConferenceSubjectEvent (long eventId, EventLog::Type type, time_t date) const {
// TODO.
return nullptr;
}
// -----------------------------------------------------------------------------
long MainDbPrivate::insertEvent (const EventLog &eventLog) {
......@@ -793,8 +858,8 @@ MainDb::MainDb () : AbstractDb(*new MainDbPrivate) {}
soci::rowset<soci::row> rows = (session->prepare << query, soci::use(peerAddress));
for (const auto &row : rows) {
(void)row;
events.push_back(std::make_shared<EventLog>());
tm date = row.get<tm>(2);
events.push_back(d->selectEvent(row.get<long>(0), static_cast<EventLog::Type>(row.get<int>(1)), mktime(&date)));
}
L_END_LOG_EXCEPTION
......
......@@ -73,6 +73,12 @@ static void get_history () {
int,
"%d"
);
BC_ASSERT_EQUAL(
eventsDb.getHistory("sip:test-7@sip.linphone.org", 0, -1, MainDb::Filter::ConferenceCallFilter).size(),
0,
int,
"%d"
);
}
test_t events_db_tests[] = {
......
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