diff --git a/src/db/events-db.cpp b/src/db/events-db.cpp index d4a063db1..adfad35db 100644 --- a/src/db/events-db.cpp +++ b/src/db/events-db.cpp @@ -291,8 +291,8 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {} soci::transaction tr(*session); for (const auto &message : messages) { - const int direction = message.get(LEGACY_MESSAGE_COL_DIRECTION) + 1; - if (direction != 1 && direction != 2) { + const int direction = message.get(LEGACY_MESSAGE_COL_DIRECTION); + if (direction != 0 && direction != 1) { lWarning() << "Unable to import legacy message with invalid direction."; return; } @@ -356,7 +356,7 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {} static_cast(direction), message.get(LEGACY_MESSAGE_COL_IMDN_MESSAGE_ID, ""), !!message.get(LEGACY_MESSAGE_COL_IS_SECURED, 0), - { content } + { move(content) } ); } @@ -641,7 +641,7 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {} ") AND "; query += " direction = " + Utils::toString(static_cast(ChatMessage::Direction::Incoming)) + - + " AND state = " + Utils::toString(static_cast(ChatMessage::State::Displayed)); + + " AND state <> " + Utils::toString(static_cast(ChatMessage::State::Displayed)); L_BEGIN_LOG_EXCEPTION