diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1eec8481e..1283185a3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,35 +38,37 @@ include(CMakeDependentOption)
option(ENABLE_SHARED "Build shared library." YES)
option(ENABLE_STATIC "Build static library." YES)
+
option(ENABLE_CONSOLE_UI "Turn on or off compilation of console interface." YES)
-option(ENABLE_DATE "Use build date in internal version number." NO)
+option(ENABLE_CSHARP_WRAPPER "Build the C# wrapper for Liblinphone." OFF)
+option(ENABLE_CXX_WRAPPER "Build the C++ wrapper for Liblinphone." YES)
option(ENABLE_DAEMON "Enable the linphone daemon interface." YES)
+option(ENABLE_DATE "Use build date in internal version number." NO)
+option(ENABLE_DEBUG_LOGS "Turn on or off debug level logs." NO)
option(ENABLE_DOC "Enable documentation generation with Doxygen." YES)
-option(ENABLE_JAVADOC "Add a target to generate documentation for Java API" NO)
option(ENABLE_GTK_UI "Turn on or off compilation of gtk interface." NO)
+option(ENABLE_JAVADOC "Add a target to generate documentation for Java API" NO)
option(ENABLE_LDAP "Enable LDAP support." NO)
-option(ENABLE_SQLITE_STORAGE "Turn on compilation sqlite storage, for messages, contacts, history" YES)
-cmake_dependent_option(ENABLE_LIME "Enable Instant Messaging Encryption." YES "ENABLE_SQLITE_STORAGE" NO)
-cmake_dependent_option(ENABLE_NOTIFY "Enable libnotify support." YES "ENABLE_GTK_UI;NOT APPLE" NO)
+option(ENABLE_NLS "Build with internationalisation support" YES)
option(ENABLE_RELATIVE_PREFIX "Find resources relatively to the installation directory." NO)
+option(ENABLE_ROOTCA_DOWNLOAD "Download rootca.pem at build time." YES)
+option(ENABLE_SOCI_STORAGE "Turn on compilation soci storage, for messages, contacts, history" YES)
+option(ENABLE_SQLITE_STORAGE "Turn on compilation sqlite storage, for messages, contacts, history" YES)
option(ENABLE_STRICT "Build with strict compile options." YES)
option(ENABLE_TOOLS "Turn on or off compilation of tools." YES)
option(ENABLE_TUNNEL "Turn on compilation of tunnel support." NO)
option(ENABLE_TUTORIALS "Enable compilation of tutorials." YES)
option(ENABLE_UNIT_TESTS "Enable compilation of unit tests." YES)
option(ENABLE_UPDATE_CHECK "Enable update check." NO)
-option(ENABLE_VIDEO "Build with video support." YES)
-cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENABLE_GTK_UI" NO)
-option(ENABLE_DEBUG_LOGS "Turn on or off debug level logs." NO)
-option(ENABLE_NLS "Build with internationalisation support" YES)
option(ENABLE_VCARD "Turn on compilation of vcard4 support." YES)
-option(ENABLE_ROOTCA_DOWNLOAD "Download rootca.pem at build time." YES)
-option(ENABLE_CXX_WRAPPER "Build the C++ wrapper for Liblinphone." YES)
-option(ENABLE_CSHARP_WRAPPER "Build the C# wrapper for Liblinphone." OFF)
+option(ENABLE_VIDEO "Build with video support." YES)
+
+cmake_dependent_option(ENABLE_LIME "Enable Instant Messaging Encryption." YES "ENABLE_SQLITE_STORAGE" NO)
+cmake_dependent_option(ENABLE_NOTIFY "Enable libnotify support." YES "ENABLE_GTK_UI;NOT APPLE" NO)
+cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENABLE_GTK_UI" NO)
set(CMAKE_CXX_STANDARD 11)
-
if(ENABLE_STATIC)
set(LINPHONE_LIBS_FOR_TOOLS linphone-static)
else()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6615525fe..65bd7f49c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -29,13 +29,20 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
cpim/message/cpim-message.h
cpim/parser/cpim-grammar.h
cpim/parser/cpim-parser.h
+ db/abstract/abstract-db-p.h
+ db/abstract/abstract-db.h
+ db/events-db.h
+ event/call-event.h
+ event/event.h
+ event/message-event.h
logger/logger.h
- object/clonable-object.h
object/clonable-object-p.h
+ object/clonable-object.h
object/object-p.h
object/object.h
object/singleton.h
utils/general.h
+ utils/linphone.h
utils/utils.h
)
@@ -46,6 +53,11 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
cpim/message/cpim-message.cpp
cpim/parser/cpim-grammar.cpp
cpim/parser/cpim-parser.cpp
+ db/abstract/abstract-db.cpp
+ db/events-db.cpp
+ event/call-event.cpp
+ event/event.cpp
+ event/message-event.cpp
logger/logger.cpp
object/clonable-object.cpp
object/object.cpp
@@ -57,6 +69,7 @@ set(LINPHONE_CXX_OBJECTS_INCLUDE_DIRS ${BELR_INCLUDE_DIRS})
if(SOCI_FOUND)
list(APPEND LINPHONE_CXX_OBJECTS_INCLUDE_DIRS ${SOCI_INCLUDE_DIRS} ${SOCI_MYSQL_INCLUDES})
+ add_definitions(-DSOCI_ENABLED)
endif()
set(LINPHONE_PRIVATE_HEADER_FILES)
diff --git a/src/db/abstract/abstract-db-p.h b/src/db/abstract/abstract-db-p.h
new file mode 100644
index 000000000..c04110813
--- /dev/null
+++ b/src/db/abstract/abstract-db-p.h
@@ -0,0 +1,46 @@
+/*
+ * abstract-db-p.h
+ * Copyright (C) 2017 Belledonne Communications SARL
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef _ABSTRACT_DB_P_H_
+#define _ABSTRACT_DB_P_H_
+
+#include
+
+#include "abstract-db.h"
+#include "object/object-p.h"
+
+// =============================================================================
+
+LINPHONE_BEGIN_NAMESPACE
+
+class AbstractDbPrivate : public ObjectPrivate {
+public:
+ #ifdef SOCI_ENABLED
+ soci::session session;
+ #endif // ifndef SOCI_ENABLED
+
+private:
+ AbstractDb::Backend backend;
+ bool isConnected = false;
+
+ L_DECLARE_PUBLIC(AbstractDb);
+};
+
+LINPHONE_END_NAMESPACE
+
+#endif // ifndef _ABSTRACT_DB_P_H_
diff --git a/src/db/abstract/abstract-db.cpp b/src/db/abstract/abstract-db.cpp
new file mode 100644
index 000000000..158f76628
--- /dev/null
+++ b/src/db/abstract/abstract-db.cpp
@@ -0,0 +1,90 @@
+/*
+ * abstract-db.cpp
+ * Copyright (C) 2017 Belledonne Communications SARL
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "abstract-db-p.h"
+#include "logger/logger.h"
+
+#include "abstract-db.h"
+
+using namespace std;
+
+// =============================================================================
+
+LINPHONE_BEGIN_NAMESPACE
+
+AbstractDb::AbstractDb (AbstractDbPrivate &p) : Object(*new AbstractDbPrivate) {}
+
+bool AbstractDb::connect (Backend backend, const std::string ¶meters) {
+ L_D(AbstractDb);
+
+ #ifdef SOCI_ENABLED
+
+ try {
+ if (d->isConnected) {
+ d->session.close();
+ d->isConnected = false;
+ }
+
+ d->session.open(backend == Mysql ? "mysql" : "sqlite3", parameters);
+ init();
+ } catch (const exception &e) {
+ return false;
+ }
+
+ return true;
+
+ #else
+
+ lWarning() << "Cannot use AbstractDb. Soci is not enabled.";
+ return false;
+
+ #endif // ifndef SOCI_ENABLED
+}
+
+bool AbstractDb::isConnected () const {
+ L_D(const AbstractDb);
+ return d->isConnected;
+}
+
+AbstractDb::Backend AbstractDb::getBackend () const {
+ L_D(const AbstractDb);
+ return d->backend;
+}
+
+// -----------------------------------------------------------------------------
+
+void AbstractDb::init () {
+ // Nothing.
+}
+
+// -----------------------------------------------------------------------------
+
+string AbstractDb::primaryKeyAutoIncrementStr () const {
+ L_D(const AbstractDb);
+
+ switch (d->backend) {
+ case Mysql:
+ return " BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT";
+ case Sqlite3:
+ return " INTEGER PRIMARY KEY AUTOINCREMENT";
+ }
+
+ return "";
+}
+
+LINPHONE_END_NAMESPACE
diff --git a/src/db/abstract/abstract-db.h b/src/db/abstract/abstract-db.h
new file mode 100644
index 000000000..1e54943b2
--- /dev/null
+++ b/src/db/abstract/abstract-db.h
@@ -0,0 +1,62 @@
+/*
+ * abstract-db.h
+ * Copyright (C) 2017 Belledonne Communications SARL
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef _ABSTRACT_DB_H_
+#define _ABSTRACT_DB_H_
+
+#include
+
+#include "object/object.h"
+
+// =============================================================================
+
+LINPHONE_BEGIN_NAMESPACE
+
+class AbstractDbPrivate;
+
+class LINPHONE_PUBLIC AbstractDb : public Object {
+public:
+ enum Backend {
+ Mysql,
+ Sqlite3
+ };
+
+ virtual ~AbstractDb () = default;
+
+ bool connect (Backend backend, const std::string ¶meters);
+ bool disconnect ();
+
+ bool isConnected () const;
+
+ Backend getBackend () const;
+
+protected:
+ explicit AbstractDb (AbstractDbPrivate &p);
+
+ virtual void init ();
+
+ std::string primaryKeyAutoIncrementStr () const;
+
+private:
+ L_DECLARE_PRIVATE(AbstractDb);
+ L_DISABLE_COPY(AbstractDb);
+};
+
+LINPHONE_END_NAMESPACE
+
+#endif // ifndef _ABSTRACT_DB_H_
diff --git a/src/db/events-db.cpp b/src/db/events-db.cpp
new file mode 100644
index 000000000..226866121
--- /dev/null
+++ b/src/db/events-db.cpp
@@ -0,0 +1,100 @@
+/*
+ * events-db.cpp
+ * Copyright (C) 2017 Belledonne Communications SARL
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "abstract/abstract-db-p.h"
+
+#include "events-db.h"
+
+// =============================================================================
+
+LINPHONE_BEGIN_NAMESPACE
+
+class EventsDbPrivate : public AbstractDbPrivate {};
+
+// -----------------------------------------------------------------------------
+
+EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
+
+void EventsDb::init () {
+ #ifdef SOCI_ENABLED
+
+ L_D(EventsDb);
+
+ d->session <<
+ "CREATE TABLE IF NOT EXISTS sip_address ("
+ " id" + primaryKeyAutoIncrementStr() + ","
+ " value VARCHAR(255) NOT NULL"
+ ")";
+
+ d->session <<
+ "CREATE TABLE IF NOT EXISTS event ("
+ " id" + primaryKeyAutoIncrementStr() + ","
+ " timestamp TIMESTAMP NOT NULL"
+ ")";
+
+ d->session <<
+ "CREATE TABLE IF NOT EXISTS message_status ("
+ " id" + primaryKeyAutoIncrementStr() + ","
+ " status VARCHAR(255) NOT NULL"
+ ")";
+
+ d->session <<
+ "CREATE TABLE IF NOT EXISTS message_direction ("
+ " id" + primaryKeyAutoIncrementStr() + ","
+ " direction VARCHAR(255) NOT NULL"
+ ")";
+
+ d->session <<
+ "CREATE TABLE IF NOT EXISTS dialog ("
+ " local_sip_address_id BIGINT UNSIGNED NOT NULL," // Sip address used to communicate.
+ " remote_sip_address_id BIGINT UNSIGNED NOT NULL," // Server (for conference) or user sip address.
+ " creation_timestamp TIMESTAMP NOT NULL," // Dialog creation date.
+ " last_update_timestamp TIMESTAMP NOT NULL," // Last event timestamp (call, message...).
+ " FOREIGN KEY (local_sip_address_id)"
+ " REFERENCES sip_address(id)"
+ " ON DELETE CASCADE,"
+ " FOREIGN KEY (remote_sip_address_id)"
+ " REFERENCES sip_address(id)"
+ " ON DELETE CASCADE"
+ ")";
+
+ d->session <<
+ "CREATE TABLE IF NOT EXISTS message_event ("
+ " id" + primaryKeyAutoIncrementStr() + ","
+ " dialog_id BIGINT UNSIGNED NOT NULL,"
+ " status_id TINYINT UNSIGNED NOT NULL,"
+ " direction_id TINYINT UNSIGNED NOT NULL,"
+ " imdn_message_id VARCHAR(255) NOT NULL," // See: https://tools.ietf.org/html/rfc5438#section-6.3
+ " content_type VARCHAR(255) NOT NULL,"
+ " is_secured BOOLEAN NOT NULL,"
+ " app_data VARCHAR(2048),"
+ " FOREIGN KEY (dialog_id)"
+ " REFERENCES dialog(id)"
+ " ON DELETE CASCADE,"
+ " FOREIGN KEY (status_id)"
+ " REFERENCES message_status(id)"
+ " ON DELETE CASCADE,"
+ " FOREIGN KEY (direction_id)"
+ " REFERENCES message_direction(id)"
+ " ON DELETE CASCADE"
+ ")";
+
+ #endif // ifndef SOCI_ENABLED
+}
+
+LINPHONE_END_NAMESPACE
diff --git a/src/db/events-db.h b/src/db/events-db.h
new file mode 100644
index 000000000..3cd201a25
--- /dev/null
+++ b/src/db/events-db.h
@@ -0,0 +1,47 @@
+/*
+ * events-db.h
+ * Copyright (C) 2017 Belledonne Communications SARL
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef _EVENTS_DB_H_
+#define _EVENTS_DB_H_
+
+#include "abstract/abstract-db.h"
+
+// =============================================================================
+
+LINPHONE_BEGIN_NAMESPACE
+
+class Event;
+class EventsDbPrivate;
+
+class LINPHONE_PUBLIC EventsDb : public AbstractDb {
+public:
+ EventsDb ();
+
+ bool writeEvent (const Event &event);
+
+protected:
+ void init () override;
+
+private:
+ L_DECLARE_PRIVATE(EventsDb);
+ L_DISABLE_COPY(EventsDb);
+};
+
+LINPHONE_END_NAMESPACE
+
+#endif // ifndef _EVENTS_DB_H_
diff --git a/src/event/call-event.cpp b/src/event/call-event.cpp
new file mode 100644
index 000000000..5620cb303
--- /dev/null
+++ b/src/event/call-event.cpp
@@ -0,0 +1,23 @@
+/*
+ * call-event.cpp
+ * Copyright (C) 2017 Belledonne Communications SARL
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "call-event.h"
+
+// =============================================================================
+
+// TODO.
diff --git a/src/event/call-event.h b/src/event/call-event.h
new file mode 100644
index 000000000..0cbdb7f0f
--- /dev/null
+++ b/src/event/call-event.h
@@ -0,0 +1,42 @@
+/*
+ * call-event.h
+ * Copyright (C) 2017 Belledonne Communications SARL
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef _CALL_EVENT_H_
+#define _CALL_EVENT_H_
+
+#include "event.h"
+
+// =============================================================================
+
+LINPHONE_BEGIN_NAMESPACE
+
+class Call;
+class CallEventPrivate;
+
+class CallEvent : public Event {
+public:
+ CallEvent (const Call &message);
+ CallEvent (const CallEvent &src);
+
+private:
+ L_DECLARE_PRIVATE(CallEvent);
+};
+
+LINPHONE_END_NAMESPACE
+
+#endif // ifndef _CALL_EVENT_H_
diff --git a/src/event/event-p.h b/src/event/event-p.h
new file mode 100644
index 000000000..0499716fd
--- /dev/null
+++ b/src/event/event-p.h
@@ -0,0 +1,38 @@
+/*
+ * event-p.h
+ * Copyright (C) 2017 Belledonne Communications SARL
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef _EVENT_P_H_
+#define _EVENT_P_H_
+
+#include "event.h"
+#include "object/clonable-object-p.h"
+
+// =============================================================================
+
+LINPHONE_BEGIN_NAMESPACE
+
+class EventPrivate : public ClonableObjectPrivate {
+private:
+ Event::Type type = Event::None;
+
+ L_DECLARE_PUBLIC(Event);
+};
+
+LINPHONE_END_NAMESPACE
+
+#endif // ifndef _EVENT_P_H_
diff --git a/src/event/event.cpp b/src/event/event.cpp
new file mode 100644
index 000000000..03d887f3a
--- /dev/null
+++ b/src/event/event.cpp
@@ -0,0 +1,40 @@
+/*
+ * event.cpp
+ * Copyright (C) 2017 Belledonne Communications SARL
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "event-p.h"
+
+#include "event.h"
+
+// =============================================================================
+
+LINPHONE_BEGIN_NAMESPACE
+
+Event::Event () : ClonableObject(*new EventPrivate) {}
+
+Event::Event (const Event &) : ClonableObject(*new EventPrivate) {
+ // `src` parameter is useless.
+}
+
+Event::Event (EventPrivate &p) : ClonableObject(p) {}
+
+Event::Type Event::getType () const {
+ L_D(const Event);
+ return d->type;
+}
+
+LINPHONE_END_NAMESPACE
diff --git a/src/event/event.h b/src/event/event.h
new file mode 100644
index 000000000..e4724112c
--- /dev/null
+++ b/src/event/event.h
@@ -0,0 +1,54 @@
+/*
+ * event.h
+ * Copyright (C) 2017 Belledonne Communications SARL
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef _EVENT_H_
+#define _EVENT_H_
+
+#include "object/clonable-object.h"
+
+// =============================================================================
+
+LINPHONE_BEGIN_NAMESPACE
+
+class EventPrivate;
+
+class Event : public ClonableObject {
+public:
+ enum Type {
+ None,
+ MessageEvent,
+ FileMessageEvent,
+ CallEvent
+ };
+
+ Event ();
+ Event (const Event &src);
+ virtual ~Event () = default;
+
+ Type getType () const;
+
+protected:
+ Event (EventPrivate &p);
+
+private:
+ L_DECLARE_PRIVATE(Event);
+};
+
+LINPHONE_END_NAMESPACE
+
+#endif // ifndef _EVENT_H_
diff --git a/src/event/message-event.cpp b/src/event/message-event.cpp
new file mode 100644
index 000000000..4791ed3b7
--- /dev/null
+++ b/src/event/message-event.cpp
@@ -0,0 +1,23 @@
+/*
+ * message-event.cpp
+ * Copyright (C) 2017 Belledonne Communications SARL
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "message-event.h"
+
+// =============================================================================
+
+// TODO.
diff --git a/src/event/message-event.h b/src/event/message-event.h
new file mode 100644
index 000000000..e3a3ac725
--- /dev/null
+++ b/src/event/message-event.h
@@ -0,0 +1,57 @@
+/*
+ * message-event.h
+ * Copyright (C) 2017 Belledonne Communications SARL
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef _MESSAGE_EVENT_H_
+#define _MESSAGE_EVENT_H_
+
+#include
+#include
+
+#include "event.h"
+#include "utils/linphone.h"
+
+// =============================================================================
+
+LINPHONE_BEGIN_NAMESPACE
+
+class ErrorInfo;
+class Message;
+class MessageEventPrivate;
+
+class MessageEvent : public Event {
+public:
+ typedef std::pair CustomHeader;
+
+ MessageEvent (const Message &message);
+ MessageEvent (const MessageEvent &src);
+
+ std::string getText () const;
+ MessageState getState () const;
+
+ MessageDirection getDirection () const;
+ ErrorInfo getErrorInfo () const;
+ std::string getImdnMessageId () const;
+ std::list getCustomHeaders () const;
+
+private:
+ L_DECLARE_PRIVATE(MessageEvent);
+};
+
+LINPHONE_END_NAMESPACE
+
+#endif // ifndef _MESSAGE_EVENT_H_
diff --git a/src/object/clonable-object.cpp b/src/object/clonable-object.cpp
index 5b21b09b3..2b50da650 100644
--- a/src/object/clonable-object.cpp
+++ b/src/object/clonable-object.cpp
@@ -24,12 +24,12 @@ LINPHONE_BEGIN_NAMESPACE
// =============================================================================
-ClonableObject::~ClonableObject () {
- delete mPrivate;
-}
-
ClonableObject::ClonableObject (ClonableObjectPrivate &p) : mPrivate(&p) {
mPrivate->mPublic = this;
}
+ClonableObject::~ClonableObject () {
+ delete mPrivate;
+}
+
LINPHONE_END_NAMESPACE
diff --git a/src/object/clonable-object.h b/src/object/clonable-object.h
index bda4392e1..fdca68b99 100644
--- a/src/object/clonable-object.h
+++ b/src/object/clonable-object.h
@@ -38,6 +38,10 @@ protected:
private:
L_DECLARE_PRIVATE(ClonableObject);
+
+ // Yeah, it's a `ClonableObject` that cannot be copied.
+ // Only inherited classes must implement copy.
+ L_DISABLE_COPY(ClonableObject);
};
LINPHONE_END_NAMESPACE
diff --git a/src/utils/general.h b/src/utils/general.h
index 17a911eb6..41eac6087 100644
--- a/src/utils/general.h
+++ b/src/utils/general.h
@@ -21,6 +21,14 @@
#ifndef _GENERAL_H_
#define _GENERAL_H_
+#define LINPHONE_NAMESPACE LinphonePrivate
+#define LINPHONE_BEGIN_NAMESPACE namespace LINPHONE_NAMESPACE {
+#define LINPHONE_END_NAMESPACE }
+
+// -----------------------------------------------------------------------------
+
+LINPHONE_BEGIN_NAMESPACE
+
#ifndef LINPHONE_PUBLIC
#if defined(_MSC_VER)
#ifdef LINPHONE_STATIC
@@ -39,12 +47,6 @@
// -----------------------------------------------------------------------------
-#define LINPHONE_NAMESPACE LinphonePrivate
-#define LINPHONE_BEGIN_NAMESPACE namespace LINPHONE_NAMESPACE {
-#define LINPHONE_END_NAMESPACE }
-
-// -----------------------------------------------------------------------------
-
#define L_DECLARE_PRIVATE(CLASS) \
inline CLASS ## Private * getPrivate() { \
return reinterpret_cast(mPrivate); \
@@ -70,4 +72,6 @@
#define L_D(CLASS) CLASS ## Private * const d = getPrivate();
#define L_Q(CLASS) CLASS * const q = getPublic();
+LINPHONE_END_NAMESPACE
+
#endif // ifndef _GENERAL_H_
diff --git a/src/utils/linphone.h b/src/utils/linphone.h
new file mode 100644
index 000000000..7c81b5512
--- /dev/null
+++ b/src/utils/linphone.h
@@ -0,0 +1,46 @@
+/*
+ * linphone.h
+ * Copyright (C) 2017 Belledonne Communications SARL
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef _LINPHONE_H_
+#define _LINPHONE_H_
+
+#include "general.h"
+
+// =============================================================================
+
+LINPHONE_BEGIN_NAMESPACE
+
+enum MessageDirection {
+ IncomingMessage,
+ OutgoingMessage
+};
+
+enum MessageState {
+ IdleMessageState,
+ InProgressMessageState,
+ DeliveredMessageState,
+ NotDeliveredMessageState,
+ FileTransferErrorMessageState,
+ FileTransferDoneMessageState,
+ DeliveredToUserMessageState,
+ DisplayedMessageState
+};
+
+LINPHONE_END_NAMESPACE
+
+#endif // ifndef _LINPHONE_H_
diff --git a/src/utils/utils.h b/src/utils/utils.h
index 3e5ca768d..799de2287 100644
--- a/src/utils/utils.h
+++ b/src/utils/utils.h
@@ -29,15 +29,15 @@
LINPHONE_BEGIN_NAMESPACE
namespace Utils {
- bool iequals (const std::string &a, const std::string &b);
+ bool iequals (const std::string &a, const std::string &b);
- std::vector split (const std::string &str, const std::string &delimiter);
+ std::vector split (const std::string &str, const std::string &delimiter);
- inline std::vector split (const std::string &str, char delimiter) {
- return split(str, std::string(1, delimiter));
- }
+ inline std::vector split (const std::string &str, char delimiter) {
+ return split(str, std::string(1, delimiter));
+ }
- int stoi (const std::string &str, size_t *idx = 0, int base = 10);
+ int stoi (const std::string &str, size_t *idx = 0, int base = 10);
}
LINPHONE_END_NAMESPACE