From 63bb7e7af76d33121e8b2e72df0796228d00b7d3 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Wed, 13 Jul 2016 16:46:54 +0200 Subject: [PATCH] Link against SQLite and LibEtPan. --- README.md | 13 +++++++++++++ src/main.cpp | 7 +++++++ src/mrbackend.cpp | 24 ++++++++++++++++++++++++ src/mrbackend.h | 14 +++++++++++++- 4 files changed, 57 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d0a74810..e05e5fe1 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,19 @@ Build This repository contains only the messenger backend that is used by all frontends. +The backend requires _LibEtPan_ and _SQLite_ - the usage at a glance on unix +systems: + +- _LibEtPan_ is available at https://github.com/dinhviethoa/libetpan ; for + compilation, use eg. the following commands: `./autogen.sh; make; + sudo make install prefix=/usr` + To link against LibEtPan, add `libetpan-config --libs` in backticks to your + project. + +- _SQLite_ ( http://sqlite.org/ ) is available on most systems, however, you + will also need the headers, please look for packages as `libsqlite3-dev`. + To link against SQLite, add `-lsqlite3` to your project. + Information about how to build the frontends can be found in the corresponding repositories as https://github.com/r10s/messenger-android . diff --git a/src/main.cpp b/src/main.cpp index 3373b1e5..07a3e38e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,11 +27,18 @@ #include +#include "mrbackend.h" int main() { + MrBackend obj; + + obj.Init(); + std::cout << "Hello world!" << std::endl; + + return 0; } diff --git a/src/mrbackend.cpp b/src/mrbackend.cpp index 0a4a7211..32645bd6 100644 --- a/src/mrbackend.cpp +++ b/src/mrbackend.cpp @@ -26,6 +26,30 @@ ******************************************************************************/ +#include +#include +#include +#include #include "mrbackend.h" +void MrBackend::Init() +{ + // test LibEtPan + struct mailimf_mailbox * mb; + char * display_name; + char * address; + + display_name = strdup("DINH =?iso-8859-1?Q?Vi=EAt_Ho=E0?="); + address = strdup("dinh.viet.hoa@free.fr"); + mb = mailimf_mailbox_new(display_name, address); // mailimf_mailbox_new() takes ownership of the given strings! + mailimf_mailbox_free(mb); + + // test sqlite + if( sqlite3_open("~/temp/foobar.db", &m_sqlite) == SQLITE_OK ) { + sqlite3_close(m_sqlite); + } +} + + + diff --git a/src/mrbackend.h b/src/mrbackend.h index e91bcc2f..9617c514 100644 --- a/src/mrbackend.h +++ b/src/mrbackend.h @@ -30,5 +30,17 @@ #define __MRBACKEND_H__ -#endif // __MRBACKEND_H__ +struct sqlite3; + +class MrBackend +{ +public: + void Init (); + +private: + sqlite3* m_sqlite; +}; + + +#endif // __MRBACKEND_H__