Commit 58c94c86 authored by Ronan's avatar Ronan

feat(Core): database access in progress

parent bebcee53
......@@ -79,6 +79,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
conference/session/port-config.h
content/content-type.h
content/content.h
core/core-p.h
core/core.h
db/abstract/abstract-db-p.h
db/abstract/abstract-db.h
......
......@@ -17,21 +17,42 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <algorithm>
#include "address/address.h"
#include "chat/chat-room/basic-chat-room.h"
#include "core-p.h"
#include "db/main-db.h"
#include "object/object-p.h"
#include "core.h"
// =============================================================================
using namespace std;
LINPHONE_BEGIN_NAMESPACE
class CorePrivate : public ObjectPrivate {
public:
// TODO.
};
// -----------------------------------------------------------------------------
Core::Core () : Object(*new CorePrivate) {}
// -----------------------------------------------------------------------------
Core::Core (CorePrivate &p) : Object(p) {}
shared_ptr<ChatRoom> Core::createClientGroupChatRoom (const string &subject) {
// TODO.
return shared_ptr<ChatRoom>();
}
shared_ptr<ChatRoom> Core::getOrCreateChatRoom (const string &peerAddress, bool isRtt) const {
return shared_ptr<ChatRoom>();
}
const list<shared_ptr<ChatRoom>> &Core::getChatRooms () const {
L_D();
return d->chatRooms;
}
// -----------------------------------------------------------------------------
LINPHONE_END_NAMESPACE
......@@ -20,21 +20,26 @@
#ifndef _CORE_H_
#define _CORE_H_
#include "object/object.h"
#include <list>
#include "chat/chat-room/chat-room.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class ChatRoom;
class CorePrivate;
class LINPHONE_PUBLIC Core : public Object {
public:
// Nothing for the moment.
Core ();
private:
explicit Core (CorePrivate &p);
std::shared_ptr<ChatRoom> createClientGroupChatRoom (const std::string &subject);
std::shared_ptr<ChatRoom> getOrCreateChatRoom (const std::string &peerAddress, bool isRtt = false) const;
const std::list<std::shared_ptr<ChatRoom>> &getChatRooms () const;
private:
L_DECLARE_PRIVATE(Core);
L_DISABLE_COPY(Core);
};
......
......@@ -854,6 +854,12 @@ MainDb::MainDb () : AbstractDb(*new MainDbPrivate) {}
// -----------------------------------------------------------------------------
list<shared_ptr<ChatRoom>> MainDb::getChatRooms () const {
list<shared_ptr<ChatRoom>> chatRooms;
// TODO.
return chatRooms;
}
shared_ptr<ChatRoom> MainDb::findChatRoom (const string &peerAddress) const {
L_D();
......@@ -875,6 +881,8 @@ shared_ptr<ChatRoom> MainDb::findChatRoom (const string &peerAddress) const {
" )", soci::use(peerAddress), soci::into(creationDate), soci::into(lastUpdateDate),
soci::use(capabilities), soci::use(subject);
// TODO.
L_END_LOG_EXCEPTION
return shared_ptr<ChatRoom>();
......
......@@ -70,6 +70,7 @@ public:
void cleanHistory (const std::string &peerAddress = "", FilterMask mask = NoFilter);
// ChatRooms.
std::list<std::shared_ptr<ChatRoom>> getChatRooms () const;
std::shared_ptr<ChatRoom> findChatRoom (const std::string &peerAddress) const;
// Import legacy messages from old db.
......
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