PostgreSqlStorage: Fix apparently-incorrect index in requestAllMsgs
authorMichael Marley <michael@michaelmarley.com>
Tue, 27 Mar 2018 23:41:28 +0000 (19:41 -0400)
committerManuel Nickschas <sputnick@quassel-irc.org>
Fri, 6 Apr 2018 16:37:27 +0000 (18:37 +0200)
This function was using 1 for its date index, which is the same
index as was used for bufferid.  The correct index to use is 2.

Closes GH-346.

(cherry picked from commit 3bf86a5278e26bec5e708a566e6926125f1941f0)

src/core/postgresqlstorage.cpp

index acb7f37..8ee24d4 100644 (file)
@@ -1601,7 +1601,7 @@ QList<Message> PostgreSqlStorage::requestAllMsgs(UserId user, MsgId first, MsgId
 
     QDateTime timestamp;
     for (int i = 0; i < limit && query.next(); i++) {
-        timestamp = query.value(1).toDateTime();
+        timestamp = query.value(2).toDateTime();
         timestamp.setTimeSpec(Qt::UTC);
         Message msg(timestamp,
             bufferInfoHash[query.value(1).toInt()],