Commit 220ab0f1 authored by Ronan's avatar Ronan
Browse files

feat(MainDb): explicit insert of basic chat room

parent a23c0e4f
...@@ -54,10 +54,9 @@ private: ...@@ -54,10 +54,9 @@ private:
void insertContent (long long messageEventId, const Content &content); void insertContent (long long messageEventId, const Content &content);
void updateContent (long long messageEventId, long long messageContentId, const Content &content); void updateContent (long long messageEventId, long long messageContentId, const Content &content);
long long insertContentType (const std::string &contentType); long long insertContentType (const std::string &contentType);
long long insertChatRoom ( long long insertBasicChatRoom (
long long peerSipAddressId, long long peerSipAddressId,
long long localSipAddressId, long long localSipAddressId,
int capabilities,
const tm &creationTime const tm &creationTime
); );
long long insertChatRoom (const std::shared_ptr<ChatRoom> &chatRoom); long long insertChatRoom (const std::shared_ptr<ChatRoom> &chatRoom);
......
...@@ -200,10 +200,9 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate), ...@@ -200,10 +200,9 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
return q->getLastInsertId(); return q->getLastInsertId();
} }
long long MainDbPrivate::insertChatRoom ( long long MainDbPrivate::insertBasicChatRoom (
long long peerSipAddressId, long long peerSipAddressId,
long long localSipAddressId, long long localSipAddressId,
int capabilities,
const tm &creationTime const tm &creationTime
) { ) {
L_Q(); L_Q();
...@@ -214,6 +213,7 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate), ...@@ -214,6 +213,7 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
if (id >= 0) if (id >= 0)
return id; return id;
static const int capabilities = static_cast<int>(ChatRoom::Capabilities::Basic);
lInfo() << "Insert new chat room in database: (peer=" << peerSipAddressId << lInfo() << "Insert new chat room in database: (peer=" << peerSipAddressId <<
", local=" << localSipAddressId << ", capabilities=" << capabilities << ")."; ", local=" << localSipAddressId << ", capabilities=" << capabilities << ").";
*session << "INSERT INTO chat_room (" *session << "INSERT INTO chat_room ("
...@@ -1989,10 +1989,9 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate), ...@@ -1989,10 +1989,9 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
const long long &eventId = getLastInsertId(); const long long &eventId = getLastInsertId();
const long long &localSipAddressId = d->insertSipAddress(message.get<string>(LEGACY_MESSAGE_COL_LOCAL_ADDRESS)); const long long &localSipAddressId = d->insertSipAddress(message.get<string>(LEGACY_MESSAGE_COL_LOCAL_ADDRESS));
const long long &remoteSipAddressId = d->insertSipAddress(message.get<string>(LEGACY_MESSAGE_COL_REMOTE_ADDRESS)); const long long &remoteSipAddressId = d->insertSipAddress(message.get<string>(LEGACY_MESSAGE_COL_REMOTE_ADDRESS));
const long long &chatRoomId = d->insertChatRoom( const long long &chatRoomId = d->insertBasicChatRoom(
remoteSipAddressId, remoteSipAddressId,
localSipAddressId, localSipAddressId,
static_cast<int>(ChatRoom::Capabilities::Basic),
creationTime creationTime
); );
const int &isSecured = message.get<int>(LEGACY_MESSAGE_COL_IS_SECURED, 0); const int &isSecured = message.get<int>(LEGACY_MESSAGE_COL_IS_SECURED, 0);
......
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