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>
Thu, 5 Apr 2018 22:28:38 +0000 (00:28 +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.

src/core/postgresqlstorage.cpp

index 955253b..715442d 100644 (file)
@@ -1685,7 +1685,7 @@ QList<Message> PostgreSqlStorage::requestAllMsgs(UserId user, MsgId first, MsgId
 
     QDateTime timestamp;
     for (int i = 0; i < limit && query.next(); i++) {
 
     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()],
         timestamp.setTimeSpec(Qt::UTC);
         Message msg(timestamp,
             bufferInfoHash[query.value(1).toInt()],