mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'pr703'
This commit is contained in:
commit
6f9cff2499
|
@ -112,6 +112,7 @@ HistoryKeeper::HistoryKeeper(GenericDdInterface *db_) :
|
|||
QSqlQuery ans = db->exec("select seq from sqlite_sequence where name=\"history\";");
|
||||
if (ans.first())
|
||||
{
|
||||
int idMax = ans.value(0).toInt();
|
||||
QSqlQuery ret = db->exec("select seq from sqlite_sequence where name=\"sent_status\";");
|
||||
int idCur = 0;
|
||||
if (ret.first())
|
||||
|
@ -119,10 +120,9 @@ HistoryKeeper::HistoryKeeper(GenericDdInterface *db_) :
|
|||
idCur = ret.value(0).toInt();
|
||||
}
|
||||
|
||||
int idMax = ans.value(0).toInt();
|
||||
for (int i = idCur; i < idMax; i++)
|
||||
if (idCur != idMax)
|
||||
{
|
||||
QString cmd = QString("INSERT INTO sent_status (status) VALUES (1)");
|
||||
QString cmd = QString("INSERT INTO sent_status (id, status) VALUES (%1, 1)").arg(idMax);
|
||||
db->exec(cmd);
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ QList<HistoryKeeper::HistMessage> HistoryKeeper::getChatHistory(HistoryKeeper::C
|
|||
if (ct == ctSingle)
|
||||
{
|
||||
dbAnswer = db->exec(QString("SELECT history.id, timestamp, user_id, message, status FROM history INNER JOIN aliases ON history.sender = aliases.id ") +
|
||||
QString("INNER JOIN sent_status ON history.id = sent_status.id AND timestamp BETWEEN %1 AND %2 AND chat_id = %3;")
|
||||
QString("LEFT OUTER JOIN sent_status ON history.id = sent_status.id AND timestamp BETWEEN %1 AND %2 AND chat_id = %3;")
|
||||
.arg(time64_from).arg(time64_to).arg(chat_id));
|
||||
} else {
|
||||
// no groupchats yet
|
||||
|
|
Loading…
Reference in New Issue
Block a user