summaryrefslogtreecommitdiff
path: root/plugins/Dbx_sqlite/src/dbevents.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2025-04-10 14:03:38 +0300
committerGeorge Hazan <george.hazan@gmail.com>2025-04-10 14:03:38 +0300
commitaeb5c84e9c3a013f0ae12b4a7b2297f6f45dca4c (patch)
tree9bf96a6faa0c0408ba9ebed26ccea418be48638b /plugins/Dbx_sqlite/src/dbevents.cpp
parente5123d11e822a76eaea81d207b5b2932d04b3ced (diff)
Dbx_Sqlite: fix for database checker & unread events
Diffstat (limited to 'plugins/Dbx_sqlite/src/dbevents.cpp')
-rw-r--r--plugins/Dbx_sqlite/src/dbevents.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp
index 2e75c8e2ea..814e6428c6 100644
--- a/plugins/Dbx_sqlite/src/dbevents.cpp
+++ b/plugins/Dbx_sqlite/src/dbevents.cpp
@@ -71,7 +71,8 @@ int CDbxSQLite::AddEventSrt(MEVENT hDbEvent, MCONTACT hContact, int64_t ts)
sqlite3_bind_int64(stmt, 2, hContact);
sqlite3_bind_int64(stmt, 3, ts);
rc = sqlite3_step(stmt);
- logError(rc, __FILE__, __LINE__);
+ if (rc != SQLITE_CONSTRAINT)
+ logError(rc, __FILE__, __LINE__);
sqlite3_reset(stmt);
ts++;
@@ -134,6 +135,9 @@ MEVENT CDbxSQLite::AddEvent(MCONTACT hContact, const DBEVENTINFO *dbei)
}
}
+ if (tmp.bSent)
+ tmp.bRead = true;
+
mir_cslockfull lock(m_csDbAccess);
sqlite3_stmt *stmt = InitQuery(
"INSERT INTO events(contact_id, module, timestamp, type, flags, data, server_id, user_id, is_read, reply_id) "
@@ -279,6 +283,9 @@ BOOL CDbxSQLite::EditEvent(MEVENT hDbEvent, const DBEVENTINFO *dbei)
else tmp.flags |= DBEF_ENCRYPTED;
}
+ if (tmp.bSent)
+ tmp.bRead = true;
+
mir_cslockfull lock(m_csDbAccess);
sqlite3_stmt *stmt;
if (tmp.pBlob)
@@ -293,7 +300,7 @@ BOOL CDbxSQLite::EditEvent(MEVENT hDbEvent, const DBEVENTINFO *dbei)
sqlite3_bind_int64(stmt, i++, tmp.flags);
if (tmp.pBlob)
sqlite3_bind_blob(stmt, i++, tmp.pBlob, tmp.cbBlob, nullptr);
- sqlite3_bind_int(stmt, i++, tmp.markedRead());
+ sqlite3_bind_int(stmt, i++, tmp.bRead);
sqlite3_bind_text(stmt, i++, tmp.szId, (int)mir_strlen(tmp.szId), nullptr);
sqlite3_bind_text(stmt, i++, tmp.szUserId, (int)mir_strlen(tmp.szUserId), nullptr);
sqlite3_bind_text(stmt, i++, tmp.szReplyId, (int)mir_strlen(tmp.szReplyId), nullptr);