From c07a0cd7f8fc5ecb90e878ddfd5d1534630991c0 Mon Sep 17 00:00:00 2001 From: apprb Date: Tue, 14 Oct 2014 22:52:23 +0900 Subject: [PATCH] Fetch history only from asked profile ID --- src/historykeeper.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/historykeeper.cpp b/src/historykeeper.cpp index 44a5e3a14..0295e3095 100644 --- a/src/historykeeper.cpp +++ b/src/historykeeper.cpp @@ -116,20 +116,20 @@ QList HistoryKeeper::getChatHistory(HistoryKeeper::C const QString &chat, const QDateTime &time_from, const QDateTime &time_to) { - Q_UNUSED(profile) - QList res; qint64 time64_from = time_from.toMSecsSinceEpoch(); qint64 time64_to = time_to.toMSecsSinceEpoch(); int chat_id = getChatID(chat, ct).first; + int profile_id = getAliasID(profile); QSqlQuery dbAnswer; if (ct == ctSingle) { dbAnswer = db.exec(QString("SELECT timestamp, user_id, message, mtype FROM history INNER JOIN aliases ON history.sender = aliases.id ") + - QString("AND timestamp BETWEEN %1 AND %2 AND chat_id = %3;").arg(time64_from).arg(time64_to).arg(chat_id)); + QString("AND timestamp BETWEEN %1 AND %2 AND chat_id = %3 AND profile_id = %4;") + .arg(time64_from).arg(time64_to).arg(chat_id).arg(profile_id)); } else { // no groupchats yet }