Commit 65d98ad4 authored by Ronan's avatar Ronan

fix(MainDb): update correctly last update time on chat room in import case

parent a1dc06d3
......@@ -53,7 +53,7 @@ private:
long long insertSipAddress (const std::string &sipAddress);
void insertContent (long long messageEventId, const Content &content);
long long insertContentType (const std::string &contentType);
long long insertBasicChatRoom (
long long insertOrUpdateBasicChatRoom (
long long peerSipAddressId,
long long localSipAddressId,
const tm &creationTime
......
......@@ -190,7 +190,7 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
return q->getLastInsertId();
}
long long MainDbPrivate::insertBasicChatRoom (
long long MainDbPrivate::insertOrUpdateBasicChatRoom (
long long peerSipAddressId,
long long localSipAddressId,
const tm &creationTime
......@@ -200,8 +200,11 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
soci::session *session = dbSession.getBackendSession<soci::session>();
long long id = selectChatRoomId(peerSipAddressId, localSipAddressId);
if (id >= 0)
if (id >= 0) {
*session << "UPDATE chat_room SET last_update_time = :lastUpdateTime WHERE id = :id",
soci::use(creationTime), soci::use(id);
return id;
}
static const int capabilities = static_cast<int>(ChatRoom::Capabilities::Basic);
lInfo() << "Insert new chat room in database: (peer=" << peerSipAddressId <<
......@@ -2244,7 +2247,7 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
const long long &eventId = getLastInsertId();
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 &chatRoomId = d->insertBasicChatRoom(
const long long &chatRoomId = d->insertOrUpdateBasicChatRoom(
remoteSipAddressId,
localSipAddressId,
creationTime
......
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