(jikstra, hpk) fix markseen logic to work like C: ignore if we get no rows for a message (eg desktop calls itwith msg_id=9 which is a special id -- and C just ignored it)

This commit is contained in:
holger krekel
2019-07-26 01:03:03 +02:00
parent f63e79cd6d
commit 67d9515033
3 changed files with 30 additions and 4 deletions

View File

@@ -552,9 +552,13 @@ pub fn dc_markseen_msgs(context: &Context, msg_ids: *const u32, msg_cnt: usize)
let mut res = Vec::with_capacity(msg_cnt);
for i in 0..msg_cnt {
let id = unsafe { *msg_ids.offset(i as isize) };
let (state, blocked) = stmt.query_row(params![id as i32], |row| {
let query_res = stmt.query_row(params![id as i32], |row| {
Ok((row.get::<_, i32>(0)?, row.get::<_, Option<i32>>(1)?.unwrap_or_default()))
})?;
});
if let Err(rusqlite::Error::QueryReturnedNoRows) = query_res {
continue;
}
let (state, blocked) = query_res?;
res.push((id, state, blocked));
}
Ok(res)