mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
[#1214] History integration in build system; unit test squeleton
This commit is contained in:
@ -53,7 +53,8 @@ AC_CONFIG_FILES([src/Makefile \
|
||||
src/plug-in/audiorecorder/Makefile \
|
||||
src/plug-in/Makefile \
|
||||
src/plug-in/test/Makefile \
|
||||
src/hooks/Makefile])
|
||||
src/hooks/Makefile \
|
||||
src/history/Makefile])
|
||||
|
||||
dnl Unitary test section
|
||||
AC_CONFIG_FILES([test/Makefile])
|
||||
|
@ -47,6 +47,7 @@ AM_CPPFLAGS = \
|
||||
-I$(src)/libs/iax2 \
|
||||
-I$(src)/libs/pjproject-1.0.1 \
|
||||
-I$(src)/src \
|
||||
-I$(src)/src/config \
|
||||
-I$(src)/test \
|
||||
-DPREFIX=\"$(prefix)\" \
|
||||
-DPROGSHAREDIR=\"${datadir}/sflphone\" \
|
||||
|
@ -13,7 +13,7 @@ IAXSOURCES =
|
||||
IAXHEADERS =
|
||||
endif
|
||||
|
||||
SUBDIRS = dbus audio config plug-in hooks
|
||||
SUBDIRS = dbus audio config plug-in hooks history
|
||||
|
||||
# Add here the cpp files to be build with sflphone
|
||||
sflphoned_SOURCES = \
|
||||
@ -84,6 +84,7 @@ libsflphone_la_LIBADD = \
|
||||
./config/libconfig.la \
|
||||
./plug-in/libplugin.la \
|
||||
./plug-in/audiorecorder/libaudiorecorder.la \
|
||||
./hooks/libhooks.la
|
||||
./hooks/libhooks.la \
|
||||
./history/libhistory.la
|
||||
|
||||
libsflphone_la_SOURCES =
|
||||
|
@ -1,3 +1,5 @@
|
||||
include ../../globals.mak
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
noinst_LTLIBRARIES = libhistory.la
|
||||
@ -6,5 +8,4 @@ libhistory_la_SOURCES = \
|
||||
historyitem.h \
|
||||
historyitem.cpp \
|
||||
historymanager.h \
|
||||
historymanager.cpp \
|
||||
|
||||
historymanager.cpp
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include <historyitem.h>
|
||||
|
||||
HistoryItem::HistoryItem (int timestamp, CallType call_type, std::string peer, AccountID account_id)
|
||||
HistoryItem::HistoryItem (int timestamp, CallType call_type, std::string peer, std::string account_id)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
@ -21,7 +21,9 @@
|
||||
#ifndef _HISTORY_ITEM
|
||||
#define _HISTORY_ITEM
|
||||
|
||||
typedef struct {
|
||||
#include <string>
|
||||
|
||||
typedef enum CallType {
|
||||
CALL_MISSED,
|
||||
CALL_INCOMING,
|
||||
CALL_OUTGOING
|
||||
@ -34,7 +36,7 @@ class HistoryItem {
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
HistoryItem (int, CallType, std::string, AccountID = "");
|
||||
HistoryItem (int, CallType, std::string, std::string="");
|
||||
|
||||
/*
|
||||
* Destructor
|
||||
@ -63,7 +65,7 @@ class HistoryItem {
|
||||
/*
|
||||
* The account the call was made with
|
||||
*/
|
||||
AccountID _account_id;
|
||||
std::string _account_id;
|
||||
};
|
||||
|
||||
|
||||
|
@ -19,9 +19,19 @@
|
||||
*/
|
||||
|
||||
#include <historymanager.h>
|
||||
#include <errno.h>
|
||||
#include <cc++/file.h>
|
||||
|
||||
HistoryManager::HistoryManager () {
|
||||
// TODO
|
||||
|
||||
bool exist;
|
||||
|
||||
// Load the path to the file
|
||||
if (create_history_path () ==1){
|
||||
exist = _history_config.populateFromFile (_history_path);
|
||||
}
|
||||
|
||||
_history_loaded = (exist == 2 ) ? false : true;
|
||||
}
|
||||
|
||||
HistoryManager::~HistoryManager () {
|
||||
@ -30,7 +40,7 @@ HistoryManager::~HistoryManager () {
|
||||
|
||||
int HistoryManager::load_history_from_file (void)
|
||||
{
|
||||
// TODO
|
||||
//
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -45,3 +55,21 @@ void HistoryManager::add_new_history_entry (HistoryItem new_item)
|
||||
// TODO
|
||||
}
|
||||
|
||||
int HistoryManager::create_history_path (void) {
|
||||
|
||||
std::string path;
|
||||
|
||||
path = std::string(HOMEDIR) + DIR_SEPARATOR_STR + "." + PROGDIR;
|
||||
|
||||
if (mkdir (path.data(), 0755) != 0) {
|
||||
// If directory creation failed
|
||||
if (errno != EEXIST) {
|
||||
_debug("Cannot create directory: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Load user's history
|
||||
_history_path = path + DIR_SEPARATOR_STR + "history";
|
||||
return 0;
|
||||
}
|
||||
|
@ -21,7 +21,10 @@
|
||||
#ifndef _HISTORY_MANAGER
|
||||
#define _HISTORY_MANAGER
|
||||
|
||||
#include <historyitem.h>
|
||||
#include "historyitem.h"
|
||||
#include <config/config.h>
|
||||
#include <global.h>
|
||||
#include <user_cfg.h>
|
||||
|
||||
typedef std::map <std::string, HistoryItem*> HistoryItemMap;
|
||||
|
||||
@ -49,6 +52,10 @@ class HistoryManager {
|
||||
int save_history_to_file (void);
|
||||
|
||||
private:
|
||||
/*
|
||||
* Set the path to the history file
|
||||
*/
|
||||
int create_history_path (void);
|
||||
/*
|
||||
* Add a new history item in the data structure
|
||||
*/
|
||||
@ -59,6 +66,21 @@ class HistoryManager {
|
||||
*/
|
||||
HistoryItemMap _history_items;
|
||||
|
||||
/*
|
||||
* The path to the history file
|
||||
*/
|
||||
|
||||
std::string _history_path;
|
||||
|
||||
/*
|
||||
* History has been loaded
|
||||
*/
|
||||
bool _history_loaded;
|
||||
|
||||
/*
|
||||
* The history tree. It contains the call history
|
||||
*/
|
||||
Conf::ConfigTree _history_config;
|
||||
};
|
||||
|
||||
#endif //_HISTORY_MANAGER
|
||||
|
@ -1,6 +1,6 @@
|
||||
include ../globals.mak
|
||||
|
||||
bin_PROGRAMS = numbercleanerTester pluginmanagerTester hookmanagerTester audiolayerTester rtpTester
|
||||
bin_PROGRAMS = numbercleanerTester pluginmanagerTester hookmanagerTester audiolayerTester rtpTester historyTester
|
||||
|
||||
OBJECT_FILES= \
|
||||
../src/sflphoned-managerimpl.o \
|
||||
@ -20,7 +20,8 @@ OBJECT_FILES= \
|
||||
../src/sflphoned-samplerateconverter.o \
|
||||
../src/sflphoned-sdp.o \
|
||||
../src/sflphoned-sdpmedia.o \
|
||||
../src/sflphoned-numbercleaner.o
|
||||
../src/sflphoned-numbercleaner.o \
|
||||
../src/history/historymanager.o
|
||||
|
||||
numbercleanerTester_SOURCES = \
|
||||
numbercleanerTest.h \
|
||||
@ -116,3 +117,22 @@ rtpTester_LDADD = \
|
||||
-luuid \
|
||||
$(OBJECT_FILES)
|
||||
|
||||
historyTester_SOURCES = \
|
||||
historyTest.h \
|
||||
historyTest.cpp \
|
||||
TestMain.cpp
|
||||
|
||||
historyTester_LDADD = \
|
||||
../src/libsflphone.la \
|
||||
$(SFLPHONE_LIBS) $(ZEROCONFLIB) $(LIB_DNSSD) \
|
||||
@ALSA_LIBS@ \
|
||||
@PULSEAUDIO_LIBS@ \
|
||||
@CPPUNIT_LIBS@ \
|
||||
@CCEXT2_LIBS@ \
|
||||
@CCGNU2_LIBS@ \
|
||||
@CCRTP_LIBS@ \
|
||||
@SAMPLERATE_LIBS@ \
|
||||
$(PJSIP_LIBS) \
|
||||
-luuid \
|
||||
$(OBJECT_FILES)
|
||||
|
||||
|
Reference in New Issue
Block a user