Commit ec8327d1 authored by Ronan's avatar Ronan

feat(EventsDb): add deleteEvent impl

parent 086a7495
......@@ -28,11 +28,12 @@
#include "abstract/abstract-db-p.h"
#include "chat/chat-message.h"
#include "content/content.h"
#include "conference/participant.h"
#include "content/content.h"
#include "db/provider/db-session-provider.h"
#include "event-log/call-event.h"
#include "event-log/chat-message-event.h"
#include "event-log/event-log-p.h"
#include "logger/logger.h"
#include "events-db.h"
......@@ -501,14 +502,26 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
}
bool EventsDb::deleteEvent (const EventLog &eventLog) {
L_D();
if (!isConnected()) {
lWarning() << "Unable to delete event. Not connected.";
return false;
}
// TODO.
(void)eventLog;
return true;
int &id = const_cast<EventLog &>(eventLog).getPrivate()->id;
if (id < 0)
return false;
L_BEGIN_LOG_EXCEPTION
soci::session *session = d->dbSession.getBackendSession<soci::session>();
*session << "DELETE FROM event WHERE id = :id", soci::use(id);
id = -1;
L_END_LOG_EXCEPTION
return id == -1;
}
void EventsDb::cleanEvents (FilterMask mask) {
......
......@@ -28,6 +28,9 @@
LINPHONE_BEGIN_NAMESPACE
class EventLogPrivate : public ClonableObjectPrivate {
public:
int id = -1;
private:
EventLog::Type type = EventLog::Type::None;
......
......@@ -32,6 +32,8 @@ LINPHONE_BEGIN_NAMESPACE
class EventLogPrivate;
class LINPHONE_PUBLIC EventLog : public ClonableObject {
friend class EventsDb;
public:
L_DECLARE_ENUM(Type, L_ENUM_VALUES_EVENT_LOG_TYPE);
......
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