Read visible DM generations in the desktop conversation list
This commit is contained in:
1 parent
fd82e7bf1b
commit
f0b7b22f92
3 files changed
+11
-3
No files matched your search
@@ -354,10 +354,11 @@ QList<DmConversation> DbManager::getDmConversations() const {
|
||||
QList<DmConversation> list;
|
||||
if (!m_db) return list;
|
||||
sqlite3_stmt* stmt = prepareOrNull(
|
||||
"SELECT conv_id, peer_node_id, COALESCE(peer_name,''), last_ts, last_out_seq, last_in_seq"
|
||||
" FROM dm_conversations ORDER BY last_ts DESC");
|
||||
"SELECT c.conv_id, peer_node_id, COALESCE(peer_name,''), last_ts, last_out_seq, last_in_seq, COALESCE(h.generation,1)"
|
||||
" FROM dm_conversations c LEFT JOIN dm_history h USING(conv_id) WHERE COALESCE(h.hidden,0)=0 ORDER BY last_ts DESC");
|
||||
if (!stmt) return list;
|
||||
while (sqlite3_step(stmt) == SQLITE_ROW) {
|
||||
int rc;
|
||||
while ((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
|
||||
DmConversation c;
|
||||
c.convId = colText(stmt, 0);
|
||||
c.peerNodeId = (quint64)sqlite3_column_int64(stmt, 1);
|
||||
@@ -365,8 +366,13 @@ QList<DmConversation> DbManager::getDmConversations() const {
|
||||
c.lastTs = sqlite3_column_int64(stmt, 3);
|
||||
c.lastOutSeq = sqlite3_column_int64(stmt, 4);
|
||||
c.lastInSeq = sqlite3_column_int64(stmt, 5);
|
||||
c.generation = (quint64)sqlite3_column_int64(stmt, 6);
|
||||
list.append(c);
|
||||
}
|
||||
if (rc != SQLITE_DONE) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_DM, "DM list: read failed rc=%d sql=%s", rc, sqlite3_errmsg(m_db));
|
||||
list.clear();
|
||||
}
|
||||
sqlite3_finalize(stmt);
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ struct IntegrityResult {
|
||||
|
||||
struct DmConversation {
|
||||
QString convId;
|
||||
quint64 generation = 0; /* Поколение видимой истории: фиксируется в действиях PM до передачи ядру. */
|
||||
quint64 peerNodeId = 0;
|
||||
QString peerName;
|
||||
qint64 lastTs = 0;
|
||||
|
||||
@@ -13,6 +13,7 @@ enum ChannelDataRole {
|
||||
ChannelUnreadCountRole = Qt::UserRole + 6, /* int: unread message count, 0 if none */
|
||||
ChannelLastMsgAtRole = Qt::UserRole + 7, /* qint64: last message timestamp for sorting */
|
||||
ChannelDmOnlineRole = Qt::UserRole + 11, /* bool: живой BGP-путь PM */
|
||||
ChannelDmGenerationRole = Qt::UserRole + 12, /* quint64: поколение видимой истории PM */
|
||||
ChannelIsSectionRole = Qt::UserRole + 10 /* bool: 1 = заголовок секции (не выбирается) */
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user