mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
feat(Core): database access in progress
This commit is contained in:
parent
bebcee53d6
commit
58c94c8672
5 changed files with 46 additions and 10 deletions
|
|
@ -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"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
using namespace std;
|
||||
|
||||
class CorePrivate : public ObjectPrivate {
|
||||
public:
|
||||
// TODO.
|
||||
};
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Core::Core (CorePrivate &p) : Object(p) {}
|
||||
Core::Core () : Object(*new CorePrivate) {}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
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 ();
|
||||
|
||||
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:
|
||||
explicit Core (CorePrivate &p);
|
||||
|
||||
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.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue